1 |
# This is the makefile for LMDZE. For GNU Make 3.80. |
# This is a makefile for GNU make. |
2 |
|
|
3 |
# Suffixes are: |
# This makefile builds LMDZE. |
|
# "f90" for free format, no preprocessing |
|
|
# "f" for fixed format, no preprocessing |
|
4 |
|
|
5 |
# Extend known suffixes: |
# 1. Source files |
|
%.o: %.f90 |
|
|
$(COMPILE.f90) $(OUTPUT_OPTION) $< |
|
|
COMPILE.f90 = $(FC) $(F90FLAGS) -c |
|
6 |
|
|
7 |
# Directories: |
makefile_dir = . |
|
libf_dir = . |
|
8 |
|
|
9 |
VPATH = ${libf_dir}:${libf_dir}/dyn3d:${libf_dir}/dyn3d/Vlsplt:${libf_dir}/filtrez:${libf_dir}/phylmd:${libf_dir}/bibio:${libf_dir}/phylmd/Mobidic:${libf_dir}/phylmd/Orography:${libf_dir}/phylmd/Radlwsw:${libf_dir}/IOIPSL:${libf_dir}/IOIPSL/Stringop:${libf_dir}/dyn3d/Read_reanalyse |
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 |
# Compiler-dependent part: |
sources := $(sort ${src_ce0l} ${src_gcm} ${src_test_ozonecm} ${src_test_inter_barxy} ${src_test_fxhyp} ${src_test_inifilr} ${src_test_orbite}) |
|
-include compiler.mk |
|
18 |
|
|
19 |
# Source files: |
netcdf95_dir = ${HOME}/build/Libraries_debug/NetCDF95 |
20 |
sources_etat0_lim = acc.f dimens_m.f90 comvert.f90 comconst.f90 paramet_m.f90 bernoui.f caldyn0.f90 coefpoly.f comdissnew.f90 conf_dat2d.f90 conf_dat3d.f90 conf_gcm.f90 convflu.f convmas.f covcont.f dimphy.f90 diverg.f diverg_gam.f divergf.f divgrad.f divgrad2.f dynredem0.f90 dynredem1.f90 eigen_sort.f enercin.f indicesol.f90 etat0_lim.f90 etat0.f90 exner_hyb.f90 extrapol.f filtreg.f90 flumass.f fxhyp.f fxy.f90 fxyhyper.f90 fxysinus.f fyhyp.f geopot.f90 grid_change.f90 grad.f gradiv.f gradiv2.f grid_atob.f90 heavyside.f iniconst.f90 inidissip.f90 inifgn.f inifilr.f90 inigeom.f90 inter_barxy.f90 jacobi.f laplacien.f laplacien_gam.f laplacien_rot.f laplacien_rotgam.f limit.f90 massbar.f massbarxy.f massdair.f minmax.f90 nxgrad.f nxgrad_gam.f nxgraro2.f nxgrarot.f phyredem.f90 psextbar.f q_sat.f90 ran1.f rotat.f rotat_nfil.f rotatf.f sortvarc0.f90 tourpot.f vitvert.f logic.f90 comgeom.f90 serre.f90 dimsoil.f90 temps.f90 clesphys.f90 iniprint.f90 ener.f90 iniadvtrac.f90 startdyn.f90 regr1_step_av.f90 regr_lat_time_coefoz.f90 pressure_var.f90 regr1_lint.f90 start_init_phys_m.f90 start_init_orog_m.f90 grid_noro_m.f90 gr_int_dyn_m.f90 parafilt.f90 regr3_lint.f90 regr_pr_o3.f90 coefils.f90 new_unit.f90 scopy.f90 ssum.f90 histcom.f90 ioipslmpp.f90 errioipsl.f90 histcom_var.f90 mathelp.f90 calendar.f90 flincom.f90 find_str.f90 strlowercase.f90 flinget.f90 abort_gcm.f90 |
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 |
sources_gcm = dimens_m.f90 comvert.f90 comconst.f90 paramet_m.f90 PVtheta.f dimphy.f90 aaam_bud.f abort_gcm.f90 acc.f adaptdt.f addfi.f90 advect.f90 advn.f advtrac.f90 advx.f advxp.f advy.f advyp.f advz.f advzp.f aeropt.f ajsec.f albedo.f bernoui.f caladvtrac.f90 caldyn.f90 calfis.f90 calltherm.f indicesol.f90 clcdrag.f90 clift.f interface_surf.f90 clmain.f90 calbeta.f clqh.f clvent.f coefkz.f coefkz2.f clouds_gno.f cltrac.f cltracrn.f90 coefcdrag.f90 coefkzmin.f coefpoly.f comdissnew.f90 concvl.f90 condsurf.f conema3.f conema3_m.f90 conf_gcm.f90 getparam.f90 conf_guide.f conf_phys.f90 conflx.f convect3.f convflu.f convmas.f coordij.f covcont.f cv3_routines.f cv_driver.f cv_routines.f cvltr.f diagphy.f dissip.f90 diverg.f diverg_gam.f divergf.f divgrad.f divgrad2.f dteta1.f dudv1.f dudv2.f dump2d.f dynetat0.f90 dynredem0.f90 dynredem1.f90 eigen_sort.f enercin.f exner_hyb.f90 filtreg.f90 fisrtilp.f90 flumass.f fluxstokenc.f90 formcoord.f fxhyp.f fxy.f90 fxyhyper.f90 fxysinus.f fyhyp.f gcm.f90 geopot.f90 grid_change.f90 gr_fi_ecrit.f90 grad.f gradiv.f gradiv2.f groupe.f90 groupeun.f guide.f90 hbtm.f90 heavyside.f hgardfou.f90 iniconst.f90 inidissip.f90 inifgn.f inifilr.f90 inigeom.f90 inigrads.f90 initdynav.f90 initfluxsto.f90 inithist.f90 initial0.f initphysto.f90 initrrnpb.f integrd.f90 interpost.f interpre.f ismax.f ismin.f jacobi.f laplacien.f laplacien_gam.f laplacien_rot.f laplacien_rotgam.f leapfrog.f90 limx.f limy.f limz.f lnblnk.f massbar.f massbarxy.f massdair.f minmax.f90 newmicro.f nflxtr.f nuage.f nxgrad.f nxgrad_gam.f nxgraro2.f nxgrarot.f orbite.f90 ozonecm.f90 pentes_ini.f phyetat0.f90 phyredem.f90 physiq.f90 phystokenc.f90 phytrac.f90 ppm3d.f prather.f pres2lev.f printflag.f90 psextbar.f q_sat.f90 qminimum.f ran1.f read_reanalyse.f90 readsulfate.f rotat.f rotat_nfil.f rotatf.f screenc.f90 screenp.f90 soil.f sortvarc.f90 stdlevvar.f90 suphec.f90 tetalevel.f thermcell.f tlift.f90 tourabs.f tourpot.f transp.f transp_lay.f ustarhb.f vdif_kcay.f vitvert.f vlsplt.f90 vlx.f90 vly.f90 vlz.f90 vlspltqs.f wrgrads.f yamada.f yamada4.f zilch.f logic.f90 comgeom.f90 serre.f90 dimsoil.f90 temps.f90 clesphys.f90 iniprint.f90 com_io_dyn.f90 tracstoke.f90 ener.f90 iniadvtrac.f90 YOMCST.f90 comgeomphy.f90 ctherm.f90 writedynav.f bilan_dyn.f covnat.f gr_u_scal.f gr_v_scal.f academic.f90 oasis_m.f90 raddim.f90 radepsi.f90 radopt.f90 yoethf.f90 FCTTRE.f90 gradsdef.f90 comfisrtilp.f90 nuagecom.f90 regr_pr_comb_coefoz.f90 regr_pr_coefoz.f90 ini_histday.f90 ini_histhf3d.f90 ini_histrac.f90 ini_histhf.f90 ini_histins.f90 o3_chem.f90 conf_interface.f90 gath_cpl.f90 albsno_m.f90 parafilt.f90 YOECUMF.f90 YOEGWD.f90 raddimlw.f90 pressure_var.f90 regr1_step_av.f90 regr1_lint.f90 clesphys2.f90 qcheck.f90 radiornpb.f90 minmaxqfi.f90 press_coefoz.f90 drag_noro.f90 gwstress.f90 orodrag.f90 orosetup.f90 gwprofil.f90 lift_noro.f90 orolift.f90 sugwd.f90 lw.f sw.f lwc.f lwu.f lwvd.f swclr.f swtt.f lwb.f lwtt.f lwv.f lwvn.f sw1s.f swde.f swtt1.f lwbv.f lwttm.f lwvb.f radlwsw.f sw2s.f swr.f swu.f coefils.f90 new_unit.f90 scopy.f90 ssum.f90 histcom.f90 getincom.f90 histwrite.f90 calendar.f90 errioipsl.f90 histcom_var.f90 ioipslmpp.f90 mathelp.f90 cmpblank.f90 find_str.f90 nocomma.f90 find_sig.f90 gensig.f90 strlowercase.f90 gr_phy_write_3d.f90 mathop.f90 tau2alpha.f90 correctbid.f90 nat2gcm.f90 reanalyse2nat.f90 |
VPATH := ${makefile_dir} |
25 |
|
|
26 |
sources_test_inter_b = test_inter_barxy.f90 comconst.f90 conf_gcm.f90 iniconst.f90 inigeom.f90 iniprint.f90 logic.f90 clesphys2.f90 serre.f90 comdissnew.f90 comvert.f90 comgeom.f90 fxysinus.f fxy.f90 fxyhyper.f90 fyhyp.f fxhyp.f inter_barxy.f90 coefpoly.f heavyside.f minmax.f90 dimens_m.f90 paramet_m.f90 temps.f90 abort_gcm.f90 histcom.f90 histcom_var.f90 errioipsl.f90 ioipslmpp.f90 strlowercase.f90 find_str.f90 mathelp.f90 calendar.f90 |
# 2. Compiler-dependent part |
27 |
|
|
28 |
sources_test_disv = test_disvert.f90 comvert.f90 dimens_m.f90 comconst.f90 new_unit.f90 |
mode = debug |
29 |
|
|
30 |
sources := $(sort ${sources_etat0_lim} ${sources_gcm} ${sources_test_inter_b} ${sources_test_disv}) |
comma:= , |
31 |
# (sort so that each filename appears only once) |
empty:= |
32 |
|
space:= $(empty) $(empty) |
33 |
|
CPPFLAGS = $(addprefix -D, $(subst ${comma},${space},${cpp_macros})) |
34 |
|
|
35 |
# Object files: |
inc_dir_list = ${HOME}/build/Libraries_debug/modules /usr/include |
|
obj_etat0_lim := $(addsuffix .o, $(sort $(basename ${sources_etat0_lim}))) |
|
|
obj_gcm := $(addsuffix .o, $(sort $(basename ${sources_gcm}))) |
|
|
obj_test_inter_b := $(addsuffix .o, $(basename ${sources_test_inter_b})) |
|
|
obj_test_disv := $(sources_test_disv:.f90=.o) |
|
|
objects := $(addsuffix .o, $(basename ${sources})) |
|
36 |
|
|
37 |
# Executable 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 |
|
executables = etat0_lim gcm test_inter_barxy test_disvert |
|
38 |
|
|
39 |
# Rules: |
# Include flags: |
40 |
.PHONY: all |
FFLAGS := $(addprefix -I, ${inc_dir_list}) |
|
all: ${executables} |
|
|
|
|
|
etat0_lim: ${obj_etat0_lim} |
|
|
@echo "$(FC) $(LDFLAGS) \$$^ $(LDLIBS) -o $@" |
|
|
@$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
|
41 |
|
|
42 |
gcm: ${obj_gcm} |
# Fortran language options: |
43 |
@echo "$(FC) $(LDFLAGS) \$$^ $(LDLIBS) -o $@" |
FFLAGS += -ffree-form -std=f2003 |
|
@$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
|
44 |
|
|
45 |
test_inter_barxy: ${obj_test_inter_b} |
# Error and warning options: |
46 |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
FFLAGS += -fmax-errors=1 -pedantic -Wall -Wcharacter-truncation -Wunused-parameter -Wno-conversion -Wno-integer-division |
47 |
|
|
48 |
test_disvert: ${obj_test_disv} |
# Debugging options: |
49 |
$(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ |
FFLAGS += -fbacktrace -g -ffpe-trap=invalid,zero,overflow |
50 |
|
|
51 |
TAGS: ${sources} |
# Code generation options: |
52 |
etags -l fortran $^ |
FFLAGS += -fcheck=bounds,do,mem,pointer,recursion -fpic -finit-real=nan |
53 |
|
|
54 |
.PHONY: clean clobber |
# Optimization options: |
55 |
|
FFLAGS += -O0 |
56 |
|
|
57 |
clean: |
LDLIBS = $(addprefix -L, ${lib_dir_list}) $(addprefix -l, ${lib_list}) |
58 |
@echo "Removing object files." |
version_flag = --version |
59 |
@rm -f ${objects} |
|
60 |
rm -f ${executables} |
# 3. General rules |
61 |
|
|
62 |
|
SHELL = bash |
63 |
|
|
64 |
|
%: %.o |
65 |
|
@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 |
|
LINK.o = $(FC) $(LDFLAGS) $(TARGET_ARCH) |
77 |
|
.DELETE_ON_ERROR: |
78 |
|
.PHONY: all clean clobber depend |
79 |
|
all: log |
80 |
|
|
81 |
|
TAGS: ${sources} |
82 |
|
ctags -e --language-force=fortran $^ |
83 |
|
|
84 |
|
log: |
85 |
|
hostname >$@ |
86 |
|
${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 ${libf_dir}/depend.mk 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 |
.PHONY: depend |
# 5. Specific rules |
109 |
depend ${libf_dir}/depend.mk: |
|
110 |
makedepf90 -Wmissing -Wconfused -I ${VPATH} -u netcdf -u numer_rec -u netcdf95 -u nr_util -nosrc ${sources} >${libf_dir}/depend.mk |
all: ${execut} log |
111 |
|
ce0l: ${obj_ce0l} |
112 |
|
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 between object files and include files: |
ifeq ($(findstring $(MAKECMDGOALS), clobber depend),) |
126 |
include ${libf_dir}/depend.mk |
include ${makefile_dir}/depend.mk |
127 |
|
endif |
128 |
|
|
|
# Other rules, optionnally: |
|
129 |
-include grep.mk |
-include grep.mk |
130 |
-include nag_rules.mk |
-include nag_rules.mk |