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 |
78 |
VPATH := ${src_root} $(addprefix ${src_root}/, $(shell cat ${src_root}/directories)) |
14 |
guez |
3 |
|
15 |
guez |
70 |
common_sources := $(shell cat ${src_root}/common_sources) |
16 |
guez |
78 |
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 |
guez |
3 |
|
20 |
guez |
78 |
# 2. Objects |
21 |
guez |
71 |
|
22 |
guez |
78 |
obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_ce0l_only}))) |
23 |
guez |
71 |
|
24 |
guez |
78 |
obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_gcm_only}))) |
25 |
guez |
3 |
|
26 |
guez |
78 |
objects := $(addsuffix .o, $(basename ${src_no_main})) |
27 |
guez |
62 |
|
28 |
guez |
69 |
# 3. Compiler-dependent part |
29 |
guez |
70 |
|
30 |
guez |
69 |
mode = debug |
31 |
guez |
78 |
include Compilers/${FC}_${mode}.mk |
32 |
guez |
3 |
|
33 |
guez |
62 |
# 4. Rules |
34 |
|
|
|
35 |
guez |
69 |
SHELL = bash |
36 |
guez |
61 |
COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c |
37 |
guez |
73 |
|
38 |
guez |
61 |
%.o: %.f90 |
39 |
|
|
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
40 |
|
|
|
41 |
guez |
78 |
%: %.f90 |
42 |
|
|
$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
43 |
|
|
|
44 |
|
|
.DELETE_ON_ERROR: |
45 |
guez |
69 |
.PHONY: all clean clobber depend |
46 |
guez |
78 |
all: ce0l gcm trace |
47 |
guez |
70 |
ce0l: ${obj_ce0l} |
48 |
guez |
3 |
gcm: ${obj_gcm} |
49 |
|
|
|
50 |
guez |
61 |
depend ${src_root}/depend.mk: |
51 |
guez |
78 |
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 |
guez |
61 |
|
53 |
guez |
78 |
${src_root}/TAGS: ${src_no_main} ce0l.f90 gcm.f90 |
54 |
|
|
ctags -e --language-force=fortran -f $@ $^ |
55 |
guez |
3 |
|
56 |
|
|
clean: |
57 |
guez |
78 |
rm -f ce0l gcm ${objects} trace |
58 |
guez |
3 |
|
59 |
|
|
clobber: clean |
60 |
guez |
62 |
rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS |
61 |
guez |
3 |
|
62 |
guez |
62 |
trace: |
63 |
guez |
69 |
${FC} ${version_flag} >$@ 2>&1 |
64 |
|
|
echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@ |
65 |
guez |
62 |
|
66 |
guez |
78 |
ifneq ($(MAKECMDGOALS), clobber) |
67 |
guez |
61 |
include ${src_root}/depend.mk |
68 |
guez |
78 |
endif |
69 |
guez |
3 |
|
70 |
|
|
-include grep.mk |
71 |
guez |
7 |
-include nag_rules.mk |