/[lmdze]/trunk/GNUmakefile
ViewVC logotype

Diff of /trunk/GNUmakefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 76 by guez, Fri Nov 15 18:45:49 2013 UTC revision 326 by guez, Mon Jun 10 00:29:10 2019 UTC
# Line 2  Line 2 
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 = .
8    
9  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_ce0l := $(shell cat ${makefile_dir}/src_ce0l)
10    src_gcm := $(shell cat ${makefile_dir}/src_gcm)
11    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    src_test_inifilr := $(shell cat ${makefile_dir}/src_test_inifilr)
15    src_test_orbite = test_orbite.f orbite.f YOMCST.f unit_nml_m.f
16    
17    sources := $(sort ${src_ce0l} ${src_gcm} ${src_test_ozonecm} ${src_test_inter_barxy} ${src_test_fxhyp} ${src_test_inifilr} ${src_test_orbite})
18    
19    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    
24  common_sources := $(shell cat ${src_root}/common_sources)  VPATH := ${makefile_dir}
25    
26  sources_ce0l := $(sort ${common_sources} $(shell cat ${src_root}/sources_ce0l_only))  # 2. Compiler-dependent part
27    
28  sources_gcm := $(sort ${common_sources} $(shell cat ${src_root}/sources_gcm_only))  mode = debug
29    
30  sources := $(sort ${sources_ce0l} ${sources_gcm})  comma:= ,
31    empty:=
32    space:= $(empty) $(empty)
33    CPPFLAGS = $(addprefix -D, $(subst ${comma},${space},${cpp_macros}))
34    
35  # 2. Objects and executable files  inc_dir_list = ${HOME}/build/Libraries_debug/modules /usr/include
36    
37  # Object files:  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
 obj_ce0l := $(addsuffix .o, $(basename ${sources_ce0l}))  
 obj_gcm := $(addsuffix .o, $(basename ${sources_gcm}))  
 objects := $(addsuffix .o, $(basename ${sources}))  
38    
39  # Executable files:  # Include flags:
40  execut = ce0l gcm  FFLAGS := $(addprefix -I, ${inc_dir_list})
41    
42  # 3. Compiler-dependent part  # Fortran language options:
43    FFLAGS += -ffree-form -std=f2003
44    
45  mode = debug  # Error and warning options:
46  include ../Compilers/${FC}_${mode}.mk  FFLAGS += -fmax-errors=1 -pedantic -Wall -Wcharacter-truncation -Wunused-parameter -Wno-conversion -Wno-integer-division
47    
48  # 4. Rules  # Debugging options:
49    FFLAGS += -fbacktrace -g -ffpe-trap=invalid,zero,overflow
50    
51  SHELL = bash  # Code generation options:
52    FFLAGS += -fcheck=bounds,do,mem,pointer,recursion -fpic -finit-real=nan
53    
54  # Extend known suffixes:  # Optimization options:
55    FFLAGS += -O0
56    
57  COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c  LDLIBS = $(addprefix -L, ${lib_dir_list}) $(addprefix -l, ${lib_list})
58    version_flag = --version
59    
60  %.o: %.f90  # 3. General rules
         $(COMPILE.f90) $(OUTPUT_OPTION) $<  
61    
62  .PHONY: all clean clobber depend  SHELL = bash
   
 all: ${execut} trace  
   
 ${execut}:  
         $(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@  
63    
64  ce0l: ${obj_ce0l}  %: %.o
65  gcm: ${obj_gcm}          @echo "Linking $@..."
66            $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
67    
68    %.o: %.f
69            @echo "Building $@..."
70            $(COMPILE.f) $(OUTPUT_OPTION) $<
71    
72    %: %.f
73            @echo "Compiling and linking $@..."
74            $(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@
75    
76  depend ${src_root}/depend.mk:  LINK.o = $(FC) $(LDFLAGS) $(TARGET_ARCH)
77          makedepf90 -Wmissing -Wconfused -I${VPATH} -nosrc $(addprefix -u, netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${src_root}/depend.mk  .DELETE_ON_ERROR:
78    .PHONY: all clean clobber depend
79    all: log
80    
81  TAGS: ${sources}  TAGS: ${sources}
82          ctags -e --language-force=fortran $^          ctags -e --language-force=fortran $^
83    
84  clean:  log:
85          rm -f ${objects}          hostname >$@
86          rm -f ${execut} trace          ${FC} ${version_flag} >>$@ 2>&1
87            @echo -e "\nFC = ${FC}\n\nCPPFLAGS = ${CPPFLAGS}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}\n\nldflags_lib_dyn = ${ldflags_lib_dyn}" >>$@
88    
89  clobber: clean  clobber: clean
90          rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS          rm -f *.mod ${makefile_dir}/depend.mk TAGS
91    
92    VPATH += $(addprefix ${makefile_dir}/, $(shell cat ${makefile_dir}/directories))
93    cpp_macros = CPP_IIM=16,CPP_JJM=12,CPP_LLM=11
94    lib_list = numer_rec_95 jumble nr_util netcdf95 netcdff
95    
96    # 4. Objects and executable files
97    
98    obj_ce0l := $(addsuffix .o, $(basename ${src_ce0l}))
99    obj_gcm := $(addsuffix .o, $(basename ${src_gcm}))
100    obj_test_ozonecm := $(addsuffix .o, $(basename ${src_test_ozonecm}))
101    obj_test_inter_barxy := $(addsuffix .o, $(basename ${src_test_inter_barxy}))
102    obj_test_fxhyp := $(addsuffix .o, $(basename ${src_test_fxhyp}))
103    obj_test_inifilr := $(addsuffix .o, $(basename ${src_test_inifilr}))
104    obj_test_orbite := $(addsuffix .o, $(basename ${src_test_orbite}))
105    objects := $(addsuffix .o, $(basename ${sources}))
106    execut = ce0l gcm test_ozonecm test_inter_barxy test_fxhyp test_inifilr test_orbite
107    
108    # 5. Specific rules
109    
110  trace:  all: ${execut} log
111          ${FC} ${version_flag} >$@ 2>&1  ce0l: ${obj_ce0l}
112          echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@  gcm: ${obj_gcm}
113    test_ozonecm: ${obj_test_ozonecm}
114    test_inter_barxy: ${obj_test_inter_barxy}
115    test_fxhyp: ${obj_test_fxhyp}
116    test_inifilr: ${obj_test_inifilr}
117    test_orbite: ${obj_test_orbite}
118    
119    depend ${makefile_dir}/depend.mk:
120            makedepf90 -free -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${makefile_dir}/depend.mk
121    
122    clean:
123            rm -f ${execut} ${objects} log
124    
125  # Dependencies among object files:  ifeq ($(findstring $(MAKECMDGOALS), clobber depend),)
126  include ${src_root}/depend.mk  include ${makefile_dir}/depend.mk
127    endif
128    
 # Other rules, optionally:  
129  -include grep.mk  -include grep.mk
130  -include nag_rules.mk  -include nag_rules.mk

Legend:
Removed from v.76  
changed lines
  Added in v.326

  ViewVC Help
Powered by ViewVC 1.1.21