
################## HFLOAT makefile ##########################

#
# 'make' is a funny relict of stonetime
# any generally accepted alternative ? 
#

#
# also check src/makefile and src/fxt/makefile !
#


#----------- only phony targets here --------------------------




.PHONY: all
all: simpleex examples testing timing 


.PHONY: libs lib
lib: libs
libs: testdep
	@cd src; $(MAKE) all


.PHONY: simple simpleex si
si:       simple
simpleex: simple
simple: libs
	@cd simpleex; $(MAKE) all


.PHONY: examples example pi
pi: example
examples: example
example: libs
	@cd examples; $(MAKE) all


.PHONY: feig
feig: libs
	@cd examples; $(MAKE) feig


.PHONY: test testing te
te:   testing
test: testing
testing: libs
	@cd testing; $(MAKE) all


.PHONY: timing time ti
ti:   timing
time: timing
timing: libs
	@cd timing; $(MAKE) all


.PHONY: prof
prof: libs
	@cd timing; $(MAKE) prof


#-------------------------------------

.PHONY: dep depend
dep: depend
depend:
	cd src;      $(MAKE) $@
	cd examples; $(MAKE) $@
	cd testing;  $(MAKE) $@
	cd timing;   $(MAKE) $@
	cd simpleex; $(MAKE) $@
	rm -f $(CLOBBERFLAGFILE)


# existence of CLOBBERFLAGFILE reminds that 
# the dependency files have to be remade:
CLOBBERFLAGFILE=zzzzclfl.mk

.PHONY: testdep
testdep:
	-test -f $(CLOBBERFLAGFILE) && $(MAKE) dep


.PHONY: clean
clean:
	cd src;      $(MAKE) $@
	cd examples; $(MAKE) $@
	cd testing;  $(MAKE) $@
	cd timing;   $(MAKE) $@
	cd simpleex; $(MAKE) $@

.PHONY: clobber
clobber:
	echo "clobber was made ... " > $(CLOBBERFLAGFILE)
	rm -f bin/*
	rm -f result* core gmon.out
	rm -f .gdb_history bin/.gdb_history
	cd src;      $(MAKE) $@
	cd examples; $(MAKE) $@
	cd testing;  $(MAKE) $@
	cd timing;   $(MAKE) $@
	cd simpleex; $(MAKE) $@


.PHONY: new
new:
	@echo "RECOMPILING EVERYTHING ... "
	$(MAKE) clobber
	$(MAKE) depend
	$(MAKE) all


.PHONY: showsrc
showsrc:
	cd src;  $(MAKE) $@

.PHONY: shownonsrc
shownonsrc:
	cd src;  $(MAKE) showsrc | grep \>


.PHONY: bak
bak:
	$(MAKE) clobber
	cp -aruv * /bak/hfloat/


ZBAK=/bak/zbak/hfloat/hf`date '+%y%m%d'`.tgz


.PHONY: zbak
zbak:
	$(MAKE) clobber
	rm -f doc/arith.* doc/hfdoc.* 
	rm -f src/fxt/fxtremarks.* 
	cd ..;  tar -cvzf $(ZBAK) hfloat;  ls -l $(ZBAK)



ZDIST=/bak/zbak/hfloat/hfloat`date '+%y%m%d'`.tgz
HOME=/home/jj

.PHONY: dist
dist:
	$(MAKE) clobber
	cd $(HOME)/work/dochf;       $(MAKE) 4hfloat
	cd $(HOME)/work/arith;       $(MAKE) 4hfloat
	cd $(HOME)/work/fxtremarks;  $(MAKE) 4hfloat
	cd ..;  tar -cvzf $(ZDIST) hfloat;  ls -l $(ZDIST)


################## end HFLOAT makefile ##########################

