10 |
|
|
11 |
src_root = . |
src_root = . |
12 |
|
|
13 |
VPATH = ${src_root}:${src_root}/dyn3d:${src_root}/dyn3d/Vlsplt:${src_root}/filtrez:${src_root}/phylmd:${src_root}/bibio:${src_root}/phylmd/Mobidic:${src_root}/phylmd/Orography:${src_root}/phylmd/Radlwsw:${src_root}/IOIPSL:${src_root}/IOIPSL/Stringop:${src_root}/dyn3d/Read_reanalyse:${src_root}/phylmd/Thermcell:${src_root}/phylmd/CV3_routines:${src_root}/phylmd/Conflx:${src_root}/phylmd/CV_routines:${src_root}/phylmd/Interface_surf:${src_root}/dyn3d/Dissipation:${src_root}/IOIPSL/Histcom |
VPATH := ${src_root} $(addprefix ${src_root}/, $(shell cat ${src_root}/directories)) |
14 |
|
|
15 |
common_sources := $(shell cat ${src_root}/common_sources) |
common_sources := $(shell cat ${src_root}/common_sources) |
16 |
|
src_no_main_ce0l_only := $(shell cat ${src_root}/src_no_main_ce0l_only) |
17 |
|
src_no_main_gcm_only := $(shell cat ${src_root}/src_no_main_gcm_only) |
18 |
|
src_no_main = ${src_no_main_ce0l_only} ${src_no_main_gcm_only} ${common_sources} |
19 |
|
|
20 |
sources_ce0l := $(sort ${common_sources} $(shell cat ${src_root}/sources_ce0l_only)) |
# 2. Objects |
21 |
|
|
22 |
sources_gcm := $(sort ${common_sources} $(shell cat ${src_root}/sources_gcm_only)) |
obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_ce0l_only}))) |
23 |
|
|
24 |
sources := $(sort ${sources_ce0l} ${sources_gcm}) |
obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_gcm_only}))) |
25 |
|
|
26 |
# 2. Objects and executable files |
objects := $(addsuffix .o, $(basename ${src_no_main})) |
|
|
|
|
# Object files: |
|
|
obj_ce0l := $(addsuffix .o, $(basename ${sources_ce0l})) |
|
|
obj_gcm := $(addsuffix .o, $(basename ${sources_gcm})) |
|
|
objects := $(addsuffix .o, $(basename ${sources})) |
|
|
|
|
|
# Executable files: |
|
|
execut = ce0l gcm |
|
27 |
|
|
28 |
# 3. Compiler-dependent part |
# 3. Compiler-dependent part |
29 |
|
|
30 |
mode = debug |
mode = debug |
31 |
include ../Compilers/${FC}_${mode}.mk |
include Compilers/${FC}_${mode}.mk |
32 |
|
|
33 |
# 4. Rules |
# 4. Rules |
34 |
|
|
35 |
SHELL = bash |
SHELL = bash |
|
|
|
|
# Extend known suffixes: |
|
|
|
|
36 |
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
37 |
|
|
38 |
%.o: %.f90 |
%.o: %.f90 |
39 |
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
40 |
|
|
41 |
.PHONY: all clean clobber depend |
%: %.f90 |
42 |
|
$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
|
all: ${execut} trace |
|
|
|
|
|
${execut}: |
|
|
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
|
43 |
|
|
44 |
|
.DELETE_ON_ERROR: |
45 |
|
.PHONY: all clean clobber depend |
46 |
|
all: ce0l gcm trace |
47 |
ce0l: ${obj_ce0l} |
ce0l: ${obj_ce0l} |
48 |
gcm: ${obj_gcm} |
gcm: ${obj_gcm} |
49 |
|
|
50 |
depend ${src_root}/depend.mk: |
depend ${src_root}/depend.mk: |
51 |
makedepf90 -Wmissing -Wconfused -I${VPATH} -nosrc $(addprefix -u, netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${src_root}/depend.mk |
makedepf90 -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${src_no_main} >${src_root}/depend.mk |
52 |
|
|
53 |
TAGS: ${sources} |
${src_root}/TAGS: ${src_no_main} ce0l.f90 gcm.f90 |
54 |
ctags -e --language-force=fortran $^ |
ctags -e --language-force=fortran -f $@ $^ |
55 |
|
|
56 |
clean: |
clean: |
57 |
rm -f ${objects} |
rm -f ce0l gcm ${objects} trace |
|
rm -f ${execut} trace |
|
58 |
|
|
59 |
clobber: clean |
clobber: clean |
60 |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
63 |
${FC} ${version_flag} >$@ 2>&1 |
${FC} ${version_flag} >$@ 2>&1 |
64 |
echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@ |
echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@ |
65 |
|
|
66 |
# Dependencies among object files: |
ifneq ($(MAKECMDGOALS), clobber) |
67 |
include ${src_root}/depend.mk |
include ${src_root}/depend.mk |
68 |
|
endif |
69 |
|
|
|
# Other rules, optionally: |
|
70 |
-include grep.mk |
-include grep.mk |
71 |
-include nag_rules.mk |
-include nag_rules.mk |