/[lmdze]/trunk/GNUmakefile
ViewVC logotype

Annotation of /trunk/GNUmakefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 329 - (hide annotations)
Thu Jun 13 17:29:13 2019 UTC (4 years, 11 months ago) by guez
File size: 3973 byte(s)
Add `CMakeLists.txt` files.
1 guez 69 # This is a makefile for GNU make.
2 guez 3
3 guez 61 # This makefile builds LMDZE.
4    
5 guez 62 # 1. Source files
6    
7 guez 313 makefile_dir = .
8 guez 3
9 guez 123 src_ce0l := $(shell cat ${makefile_dir}/src_ce0l)
10     src_gcm := $(shell cat ${makefile_dir}/src_gcm)
11 guez 131 src_test_ozonecm := $(shell cat ${makefile_dir}/src_test_ozonecm)
12     src_test_inter_barxy := $(shell cat ${makefile_dir}/src_test_inter_barxy)
13     src_test_fxhyp := $(shell cat ${makefile_dir}/src_test_fxhyp)
14 guez 167 src_test_inifilr := $(shell cat ${makefile_dir}/src_test_inifilr)
15 guez 328 src_test_orbite = test_orbite.f90 orbite.f90 YOMCST.f90 unit_nml_m.f90
16 guez 3
17 guez 318 sources := $(sort ${src_ce0l} ${src_gcm} ${src_test_ozonecm} ${src_test_inter_barxy} ${src_test_fxhyp} ${src_test_inifilr} ${src_test_orbite})
18 guez 123
19 guez 326 netcdf95_dir = ${HOME}/build/Libraries_debug/NetCDF95
20     nr_util_dir = ${HOME}/build/Libraries_debug/NR_util
21     numer_rec_95_dir = ${HOME}/build/Libraries_debug/Numer_Rec_95
22     jumble_dir = ${HOME}/build/Libraries_debug/Jumble
23 guez 322
24 guez 326 VPATH := ${makefile_dir}
25 guez 313
26 guez 326 # 2. Compiler-dependent part
27    
28     mode = debug
29    
30     comma:= ,
31     empty:=
32     space:= $(empty) $(empty)
33     CPPFLAGS = $(addprefix -D, $(subst ${comma},${space},${cpp_macros}))
34    
35     inc_dir_list = ${HOME}/build/Libraries_debug/modules /usr/include
36    
37     lib_dir_list = ${contour_531_dir} ${fortrangis_dir} ${geometry_dir} ${gpc_f_dir} ${jumble_dir} ${netcdf95_dir} ${nr_util_dir} ${numer_rec_95_dir} ${shapelib_03_dir} ${water_dir} ${HOME}/.local/lib
38    
39     # Include flags:
40     FFLAGS := $(addprefix -I, ${inc_dir_list})
41    
42     # Fortran language options:
43 guez 328 FFLAGS += -std=f2003
44 guez 326
45     # Error and warning options:
46     FFLAGS += -fmax-errors=1 -pedantic -Wall -Wcharacter-truncation -Wunused-parameter -Wno-conversion -Wno-integer-division
47    
48     # Debugging options:
49     FFLAGS += -fbacktrace -g -ffpe-trap=invalid,zero,overflow
50    
51     # Code generation options:
52     FFLAGS += -fcheck=bounds,do,mem,pointer,recursion -fpic -finit-real=nan
53    
54     # Optimization options:
55     FFLAGS += -O0
56    
57     LDLIBS = $(addprefix -L, ${lib_dir_list}) $(addprefix -l, ${lib_list})
58     version_flag = --version
59    
60     # 3. General rules
61    
62     SHELL = bash
63    
64     %: %.o
65     @echo "Linking $@..."
66     $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
67    
68 guez 328 %.o: %.f90
69 guez 326 @echo "Building $@..."
70     $(COMPILE.f) $(OUTPUT_OPTION) $<
71    
72     LINK.o = $(FC) $(LDFLAGS) $(TARGET_ARCH)
73     .DELETE_ON_ERROR:
74     .PHONY: all clean clobber depend
75     all: log
76    
77     TAGS: ${sources}
78     ctags -e --language-force=fortran $^
79    
80     log:
81     hostname >$@
82     ${FC} ${version_flag} >>$@ 2>&1
83     @echo -e "\nFC = ${FC}\n\nCPPFLAGS = ${CPPFLAGS}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}\n\nldflags_lib_dyn = ${ldflags_lib_dyn}" >>$@
84    
85     clobber: clean
86     rm -f *.mod ${makefile_dir}/depend.mk TAGS
87    
88 guez 313 VPATH += $(addprefix ${makefile_dir}/, $(shell cat ${makefile_dir}/directories))
89 guez 267 cpp_macros = CPP_IIM=16,CPP_JJM=12,CPP_LLM=11
90 guez 207 lib_list = numer_rec_95 jumble nr_util netcdf95 netcdff
91    
92 guez 326 # 4. Objects and executable files
93 guez 71
94 guez 266 obj_ce0l := $(addsuffix .o, $(basename ${src_ce0l}))
95     obj_gcm := $(addsuffix .o, $(basename ${src_gcm}))
96     obj_test_ozonecm := $(addsuffix .o, $(basename ${src_test_ozonecm}))
97     obj_test_inter_barxy := $(addsuffix .o, $(basename ${src_test_inter_barxy}))
98     obj_test_fxhyp := $(addsuffix .o, $(basename ${src_test_fxhyp}))
99     obj_test_inifilr := $(addsuffix .o, $(basename ${src_test_inifilr}))
100 guez 318 obj_test_orbite := $(addsuffix .o, $(basename ${src_test_orbite}))
101 guez 266 objects := $(addsuffix .o, $(basename ${sources}))
102 guez 318 execut = ce0l gcm test_ozonecm test_inter_barxy test_fxhyp test_inifilr test_orbite
103 guez 62
104 guez 326 # 5. Specific rules
105 guez 70
106 guez 79 all: ${execut} log
107 guez 70 ce0l: ${obj_ce0l}
108 guez 3 gcm: ${obj_gcm}
109 guez 123 test_ozonecm: ${obj_test_ozonecm}
110     test_inter_barxy: ${obj_test_inter_barxy}
111     test_fxhyp: ${obj_test_fxhyp}
112 guez 167 test_inifilr: ${obj_test_inifilr}
113 guez 318 test_orbite: ${obj_test_orbite}
114 guez 3
115 guez 97 depend ${makefile_dir}/depend.mk:
116 guez 328 makedepf90 -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${makefile_dir}/depend.mk
117 guez 61
118 guez 3 clean:
119 guez 79 rm -f ${execut} ${objects} log
120 guez 3
121 guez 90 ifeq ($(findstring $(MAKECMDGOALS), clobber depend),)
122 guez 97 include ${makefile_dir}/depend.mk
123 guez 78 endif
124 guez 3
125     -include grep.mk
126 guez 7 -include nag_rules.mk

  ViewVC Help
Powered by ViewVC 1.1.21