Makefile 1.63 KB
Newer Older
dumoda01's avatar
dumoda01 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
#$Id: Makefile,v 1.9 2005-08-16 14:38:37 kbk Exp $
#
# Master Makefile for making the GOTM executable.
#

include Rules.make

DOCSRC	= main.F90 gotm.F90

SUBDIRS	= util observations airsea meanflow turbulence output $(FEATURES)

CORE_LIBS	=	\
		-lairsea$(buildtype)		\
		-lmeanflow$(buildtype) 		\
		-lturbulence$(buildtype) 	\
		-lobservations$(buildtype)	\
		-loutput$(buildtype)		\
		-lutil$(buildtype)

ALL_LIBS	= $(FEATURE_LIBS) $(CORE_LIBS) $(EXTRA_LIBS)

EXEC		= gotm$(buildtype)_$(FORTRAN_COMPILER)

all: ../VERSION $(EXEC)

../VERSION: ../Makefile
	$(MAKE) -C ..

$(EXEC): makedirs subdirs features gotmlib 
	$(FC) -o $@ ./gotm/main.o $(LDFLAGS) -lgotm$(buildtype) $(ALL_LIBS)
	$(RM) ./gotm/main.o

makedirs:
	mkdir -p $(MODDIR) $(LIBDIR)

gotmlib:
	$(MAKE) -C gotm all

.PHONY: subdirs $(SUBDIRS)

subdirs: $(SUBDIRS)

install: $(EXEC) 
	$(MV) $(EXEC) $(BINDIR)

$(SUBDIRS):
	$(MAKE) -C $@

observations airsea meanflow turbulence output: util

features:
ifdef FEATURES
	set -e; for i in $(FEATURES); do $(MAKE) -C $$i; done
endif

doc:
ifdef SUBDIRS
	set -e; for i in gotm $(SUBDIRS); do $(MAKE) -C $$i $@; done
endif
ifdef FEATURES
	set -e; for i in $(FEATURES); do $(MAKE) -C $$i $@; done
endif

bkup: distclean
	tar -czvf ../../backups/bkup.`date +%y%m%d%H`_`cat ../VERSION`.tar.gz *

clean:

realclean: clean
	$(RM) *~
	$(RM) ../modules/$(FORTRAN_COMPILER)/*.{m,mod} 
	$(RM) ../lib/$(FORTRAN_COMPILER)/lib*$(buildtype).a
ifdef SUBDIRS
	set -e; for i in gotm $(SUBDIRS); do $(MAKE) -C $$i $@; done
endif
ifdef FEATURES
	set -e; for i in $(FEATURES); do $(MAKE) -C $$i $@; done
endif

distclean: realclean
	$(RM) gotm_debug_* gotm_prof_* gotm_prod_*