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:${src_root}/IOIPSL/Flincom |
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 |
sources_ce0l := ${common_sources} $(shell cat ${src_root}/sources_ce0l_only) |
src_ce0l_only := $(shell cat ${src_root}/src_ce0l_only) |
17 |
sources_gcm := ${common_sources} $(shell cat ${src_root}/sources_gcm_only) |
src_gcm_only := $(shell cat ${src_root}/src_gcm_only) |
18 |
|
sources = ${src_ce0l_only} ${src_gcm_only} ${common_sources} |
|
sources := $(sort ${sources_ce0l} ${sources_gcm}) |
|
|
# (sort so that each filename appears only once) |
|
19 |
|
|
20 |
# 2. Objects and executable files |
# 2. Objects and executable files |
21 |
|
|
22 |
# Object files: |
obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_ce0l_only}))) |
|
obj_ce0l := $(addsuffix .o, $(sort $(basename ${sources_ce0l}))) |
|
|
obj_gcm := $(addsuffix .o, $(sort $(basename ${sources_gcm}))) |
|
|
objects := $(addsuffix .o, $(basename ${sources})) |
|
23 |
|
|
24 |
# Executable files: |
obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_gcm_only}))) |
25 |
|
|
26 |
|
objects := $(addsuffix .o, $(basename ${sources})) |
27 |
execut = ce0l gcm |
execut = ce0l gcm |
28 |
|
|
29 |
# 3. Compiler-dependent part |
# 3. Compiler-dependent part |
30 |
|
|
31 |
mode = debug |
mode = debug |
32 |
include ../Compilers/${FC}_${mode}.mk |
include Compilers/${FC}_${mode}.mk |
33 |
|
|
34 |
# 4. Rules |
# 4. Rules |
35 |
|
|
36 |
SHELL = bash |
SHELL = bash |
|
|
|
|
# Extend known suffixes: |
|
37 |
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
38 |
|
|
39 |
%.o: %.f90 |
%.o: %.f90 |
40 |
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
41 |
|
|
42 |
|
.DELETE_ON_ERROR: |
43 |
.PHONY: all clean clobber depend |
.PHONY: all clean clobber depend |
44 |
|
all: ${execut} log |
|
all: ${execut} trace |
|
45 |
|
|
46 |
${execut}: |
${execut}: |
47 |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
50 |
gcm: ${obj_gcm} |
gcm: ${obj_gcm} |
51 |
|
|
52 |
depend ${src_root}/depend.mk: |
depend ${src_root}/depend.mk: |
53 |
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) ${sources} >${src_root}/depend.mk |
54 |
|
|
55 |
${src_root}/TAGS: ${sources} |
${src_root}/TAGS: ${sources} |
56 |
ctags -e --language-force=fortran -f $@ $^ |
ctags -e --language-force=fortran -f $@ $^ |
57 |
|
|
58 |
clean: |
clean: |
59 |
rm -f ${objects} |
rm -f ${execut} ${objects} log |
|
rm -f ${execut} trace |
|
60 |
|
|
61 |
clobber: clean |
clobber: clean |
62 |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
63 |
|
|
64 |
trace: |
log: |
65 |
${FC} ${version_flag} >$@ 2>&1 |
hostname >$@ |
66 |
|
${FC} ${version_flag} >>$@ 2>&1 |
67 |
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}" >>$@ |
68 |
|
|
69 |
# Dependencies among object files: |
ifneq ($(MAKECMDGOALS), clobber) |
70 |
include ${src_root}/depend.mk |
include ${src_root}/depend.mk |
71 |
|
endif |
72 |
|
|
|
# Other rules, optionnally: |
|
73 |
-include grep.mk |
-include grep.mk |
74 |
-include nag_rules.mk |
-include nag_rules.mk |