# Makefile for gt4f90io
# vi: set ts=8 sw=4:

all:
	cd src; $(MAKE)
#	cd gtlist; $(MAKE)
#	cd gtcopy; $(MAKE)
#	cd gtview; $(MAKE)
#	cd gtattr; $(MAKE)
#	cd gtprint; $(MAKE)
#	cd gtunary; $(MAKE)
#	cd gtbinary; $(MAKE)
#	cd f90grep; $(MAKE)
#	cd gt4frt; $(MAKE)
#	cd gt3conv; $(MAKE)
#	cd gtavg; $(MAKE)

install: all
	cd src; $(MAKE) $@
#	cd gtavg; $(MAKE) $@
#	cd gtlist; $(MAKE) $@
#	cd gtcopy; $(MAKE) $@
#	cd gtview; $(MAKE) $@ gtool.nc
#	cd gtattr; $(MAKE) $@
#	cd gtprint; $(MAKE) $@
#	cd gtunary; $(MAKE) $@
#	cd gtbinary; $(MAKE) $@
#	cd f90grep; $(MAKE) $@
#	cd gt3conv; $(MAKE) $@
#	cd gt4frt; $(MAKE) $@

install-doc:
	cd doc ; $(MAKE) install

clean:
	cd src; $(MAKE) $@
#	cd gtavg; $(MAKE) $@
#	cd gtlist; $(MAKE) $@
#	cd gtcopy; $(MAKE) $@
#	cd gtview; $(MAKE) $@
#	cd gtattr; $(MAKE) $@
#	cd gtprint; $(MAKE) $@
#	cd gtunary; $(MAKE) $@
#	cd gtbinary; $(MAKE) $@
#	cd f90grep; $(MAKE) $@
#	cd gt4frt; $(MAKE) $@
#	cd gt3conv; $(MAKE) $@
	cd test; $(MAKE) $@

distclean: clean
	-rm -f config.status chkfort.cfg config.cache config.log Config.mk
	@echo removing Config.mk, you should rerun configure to build gt4f90io.

create-configure:
	@if [ ! -x /usr/bin/autoconf ]; then \
		echo -n "autoconf(1) is not valid. "; \
		echo "This is \"configure\" Generater."; \
		exit 1; \
	fi
	@if [ ! -r configure.in ]; then \
		echo -n "configure.in is not exists or not readable. "; \
		echo "This file needed for creating \"configure\"."; \
		exit 1; \
	fi
	@if [ ! -r aclocal.m4 ]; then \
		echo -n "aclocal.m4 is not exists or not readable. "; \
		echo "This file needed for creating \"configure\"."; \
		exit 1; \
	fi
	/usr/bin/autoconf
	@echo "\"configure\" Generated."

test-f: all
	cd test; $(MAKE) $@

test: all
	cd test; $(MAKE) $@

tags:
	perl src/f90tags src/*.f90

#SUBMF = gtlist/Makefile gtcopy/Makefile gtattr/Makefile \
#	gtprint/Makefile gtunary/Makefile gtbinary/Makefile gtavg/Makefile \
#	f90grep/Makefile

#submf: $(SUBMF)

#$(SUBMF): gtview/Makefile
#	for path in $(SUBMF) ;\
#	do \
#		dir=`dirname $$path` ;\
#		sed s/gtview/$$dir/g gtview/Makefile > $$path ;\
#	done
