2 |
|
|
3 |
# This makefile builds LMDZE. |
# This makefile builds LMDZE. |
4 |
|
|
|
# Suffixes are: |
|
|
# "f90" for free format, no preprocessing |
|
|
# "f" for fixed format, no preprocessing |
|
|
|
|
5 |
# 1. Source files |
# 1. Source files |
6 |
|
|
7 |
src_root = . |
makefile_dir = . |
|
|
|
|
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 |
|
|
|
|
|
common_sources := $(shell cat ${src_root}/common_sources) |
|
|
|
|
|
sources_ce0l := $(sort ${common_sources} $(shell cat ${src_root}/sources_ce0l_only)) |
|
8 |
|
|
9 |
sources_gcm := $(sort ${common_sources} $(shell cat ${src_root}/sources_gcm_only)) |
VPATH := ${makefile_dir}/.. $(addprefix ${makefile_dir}/../, $(shell cat ${makefile_dir}/directories)) |
10 |
|
|
11 |
sources := $(sort ${sources_ce0l} ${sources_gcm}) |
common_sources := $(shell cat ${makefile_dir}/common_sources) |
12 |
|
src_ce0l_only := $(shell cat ${makefile_dir}/src_ce0l_only) |
13 |
|
src_gcm_only := $(shell cat ${makefile_dir}/src_gcm_only) |
14 |
|
sources = ${src_ce0l_only} ${src_gcm_only} ${common_sources} |
15 |
|
|
16 |
# 2. Objects and executable files |
# 2. Objects and executable files |
17 |
|
|
18 |
# Object files: |
obj_ce0l := $(sort ${common_sources:.f=.o} ${src_ce0l_only:.f=.o}) |
19 |
obj_ce0l := $(addsuffix .o, $(basename ${sources_ce0l})) |
obj_gcm := $(sort ${common_sources:.f=.o} ${src_gcm_only:.f=.o}) |
20 |
obj_gcm := $(addsuffix .o, $(basename ${sources_gcm})) |
objects := $(sources:.f=.o) |
|
objects := $(addsuffix .o, $(basename ${sources})) |
|
|
|
|
|
# Executable files: |
|
21 |
execut = ce0l gcm |
execut = ce0l gcm |
22 |
|
|
23 |
# 3. Compiler-dependent part |
# 3. Compiler-dependent part |
24 |
|
|
25 |
mode = debug |
mode = debug |
26 |
include ../Compilers/${FC}_${mode}.mk |
include Compiler_options/${FC}_${mode}.mk |
27 |
|
|
28 |
# 4. Rules |
# 4. Rules |
29 |
|
|
30 |
SHELL = bash |
SHELL = bash |
31 |
|
.DELETE_ON_ERROR: |
|
# Extend known suffixes: |
|
|
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
|
|
%.o: %.f90 |
|
|
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
|
|
|
|
32 |
.PHONY: all clean clobber depend |
.PHONY: all clean clobber depend |
33 |
|
all: ${execut} log |
|
all: ${execut} trace |
|
34 |
|
|
35 |
${execut}: |
${execut}: |
36 |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
38 |
ce0l: ${obj_ce0l} |
ce0l: ${obj_ce0l} |
39 |
gcm: ${obj_gcm} |
gcm: ${obj_gcm} |
40 |
|
|
41 |
depend ${src_root}/depend.mk: |
depend ${makefile_dir}/depend.mk: |
42 |
makedepf90 -Wmissing -Wconfused -I${VPATH} -nosrc $(addprefix -u, netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${src_root}/depend.mk |
makedepf90 -free -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${makefile_dir}/depend.mk |
43 |
|
|
44 |
TAGS: ${sources} |
TAGS: ${sources} |
45 |
ctags -e --language-force=fortran $^ |
ctags -e --language-force=fortran $^ |
46 |
|
|
47 |
clean: |
clean: |
48 |
rm -f ${objects} |
rm -f ${execut} ${objects} log |
|
rm -f ${execut} trace |
|
49 |
|
|
50 |
clobber: clean |
clobber: clean |
51 |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
rm -f *.mod ${makefile_dir}/depend.mk TAGS |
52 |
|
|
53 |
trace: |
log: |
54 |
${FC} ${version_flag} >$@ 2>&1 |
hostname >$@ |
55 |
|
${FC} ${version_flag} >>$@ 2>&1 |
56 |
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}" >>$@ |
57 |
|
|
58 |
# Dependencies among object files: |
ifeq ($(findstring $(MAKECMDGOALS), clobber depend),) |
59 |
include ${src_root}/depend.mk |
include ${makefile_dir}/depend.mk |
60 |
|
endif |
61 |
|
|
|
# Other rules, optionnally: |
|
62 |
-include grep.mk |
-include grep.mk |
63 |
-include nag_rules.mk |
-include nag_rules.mk |