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