TOPDIR=..

include $(TOPDIR)/build/Makefile.inc


default: test coef_io


all: bin

bin: main/bin mw_scatt_coef/bin parallel/bin coef_io/bin other/bin emis_atlas/bin coef_io_789/bin mw_scatt/bin test/bin


lib: main/lib mw_scatt_coef/lib parallel/lib coef_io/lib other/lib emis_atlas/lib coef_io_789/lib mw_scatt/lib test/lib


intf: main/intf mw_scatt_coef/intf parallel/intf coef_io/intf other/intf emis_atlas/intf coef_io_789/intf mw_scatt/intf test/intf


dir: main/dir mw_scatt_coef/dir parallel/dir coef_io/dir other/dir emis_atlas/dir coef_io_789/dir mw_scatt/dir test/dir



test: test/bin

test/bin: test/lib
	cd test && make bin

test/lib: test/intf other/lib parallel/lib coef_io/lib main/lib
	cd test && make lib

test/intf: test/dir
	cd test && make intf

test/dir:
	cd test && make dir

test/clean:
	cd test && make clean

mw_scatt_coef: mw_scatt_coef/bin

mw_scatt_coef/bin: mw_scatt_coef/lib
	cd mw_scatt_coef && make bin

mw_scatt_coef/lib: mw_scatt_coef/intf main/lib
	cd mw_scatt_coef && make lib

mw_scatt_coef/intf: mw_scatt_coef/dir
	cd mw_scatt_coef && make intf

mw_scatt_coef/dir:
	cd mw_scatt_coef && make dir

mw_scatt_coef/clean:
	cd mw_scatt_coef && make clean

emis_atlas: emis_atlas/bin

emis_atlas/bin: emis_atlas/lib
	cd emis_atlas && make bin

emis_atlas/lib: emis_atlas/intf coef_io/lib main/lib
	cd emis_atlas && make lib

emis_atlas/intf: emis_atlas/dir
	cd emis_atlas && make intf

emis_atlas/dir:
	cd emis_atlas && make dir

emis_atlas/clean:
	cd emis_atlas && make clean

parallel: parallel/bin

parallel/bin: parallel/lib
	cd parallel && make bin

parallel/lib: parallel/intf main/lib
	cd parallel && make lib

parallel/intf: parallel/dir
	cd parallel && make intf

parallel/dir:
	cd parallel && make dir

parallel/clean:
	cd parallel && make clean

coef_io: coef_io/bin

coef_io/bin: coef_io/lib
	cd coef_io && make bin

coef_io/lib: coef_io/intf main/lib
	cd coef_io && make lib

coef_io/intf: coef_io/dir
	cd coef_io && make intf

coef_io/dir:
	cd coef_io && make dir

coef_io/clean:
	cd coef_io && make clean

main: main/bin

main/bin: main/lib
	cd main && make bin

main/lib: main/intf 
	cd main && make lib

main/intf: main/dir
	cd main && make intf

main/dir:
	cd main && make dir

main/clean:
	cd main && make clean

other: other/bin

other/bin: other/lib
	cd other && make bin

other/lib: other/intf main/lib
	cd other && make lib

other/intf: other/dir
	cd other && make intf

other/dir:
	cd other && make dir

other/clean:
	cd other && make clean

coef_io_789: coef_io_789/bin

coef_io_789/bin: coef_io_789/lib
	cd coef_io_789 && make bin

coef_io_789/lib: coef_io_789/intf coef_io/lib main/lib
	cd coef_io_789 && make lib

coef_io_789/intf: coef_io_789/dir
	cd coef_io_789 && make intf

coef_io_789/dir:
	cd coef_io_789 && make dir

coef_io_789/clean:
	cd coef_io_789 && make clean

mw_scatt: mw_scatt/bin

mw_scatt/bin: mw_scatt/lib
	cd mw_scatt && make bin

mw_scatt/lib: mw_scatt/intf coef_io/lib main/lib
	cd mw_scatt && make lib

mw_scatt/intf: mw_scatt/dir
	cd mw_scatt && make intf

mw_scatt/dir:
	cd mw_scatt && make dir

mw_scatt/clean:
	cd mw_scatt && make clean

clean:
	\rm -f $(OBJDIR)/*$(EXT_OBJ) $(LIBDIR)/*$(EXT_LIB) $(MODDIR)/*$(EXT_MOD) $(BINDIR)/*$(EXT_EXE) $(INCDIR)/*
	\rm -rf $(TMPDIR)/*

dist:
	cd .. ; tar cf - readme.txt docs src build data emis_data rtcoef_rttov10 rttov_test --exclude src/lbl --exclude "docs/*lbl*" --exclude "docs/rttov-compile.*" --exclude "docs/*.odt" --exclude "docs/*.doc" --exclude rttov_test/rttov_remote.pl --exclude "rttov_test/*_dev*" --exclude "rttov_test/*.tar.gz" --exclude "rttov_test/profile-datasets/*.pl" --exclude "rttov_test/profile-datasets/*.sh" --exclude "rtcoef_rttov10/rttov*pred*/*airs*" --exclude "rtcoef_rttov10/rttov*pred*/*iasi*" --exclude "rtcoef_rttov10/rttov*pred*/*cris*" --exclude "rtcoef_rttov10/cldaer/*.dat" --exclude "rtcoef_rttov10/mietable/*.dat" --exclude "rtcoef_rttov10/pc/*.dat" --exclude "emis_data/*" | gzip > rttov_dist.tgz

distdev:
	cd .. ; tar cf - readme.txt docs src build data emis_data rtcoef_rttov10 rttov_test --exclude "docs/*.odt" --exclude "docs/*.doc" --exclude "rttov_test/*.tar.gz" --exclude "rtcoef_rttov10/rttov*pred*/*airs*" --exclude "rtcoef_rttov10/rttov*pred*/*iasi*" --exclude "rtcoef_rttov10/rttov*pred*/*cris*" --exclude "rtcoef_rttov10/cldaer/*.dat" --exclude "rtcoef_rttov10/mietable/*.dat" --exclude "rtcoef_rttov10/pc/*.dat" --exclude "emis_data/*" | gzip > rttov_dist_dev.tgz

distlbl:
	cd .. ; tar cf - docs/*lbl* src/lbl rttov_lbl-data --exclude rttov_lbl-data/scripts_pascal --exclude rttov_lbl-data/rttov_lbl_instrument.kcarta --exclude rttov_lbl-data/instrument-data.kcarta | gzip > rttov_dist_lbl.tgz
