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