Philippe 07/03/2019: IO bugfix: io_set_mnhversion must be called by all the processes
[MNH-git_open_source-lfs.git] / src / Makefile.MESONH.mk
1 #MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
2 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
3 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 #MNH_LIC for details. version 1.
5 ##########################################################
6 #                                                        #
7 #           Initialisation of some variables             #
8 #                                                        #
9 ##########################################################
10 ifdef OBJDIR_PATH
11 OBJDIR_ROOT=${OBJDIR_PATH}/dir_obj
12 else
13 OBJDIR_ROOT=${PWD}/dir_obj
14 endif
15 LIB_OBJS_ROOT=lib
16 #
17 ARCH_XYZ=${ARCH}-R${MNH_REAL}I${MNH_INT}-${VERSION_XYZ}
18 ##########################################################
19 #                                                        #
20 #            Source DIRECTORY                            #
21 #                                                        #
22 ##########################################################
23
24 ##########################################################
25 #           Source MYSRC                                 #
26 ##########################################################
27 ifdef VER_USER
28 DIR_USER += ${VER_USER}
29 endif
30 ##########################################################
31 #           Source MNH                                   #
32 ##########################################################
33 ifdef VER_OASIS
34 CPPFLAGS       += -DCPLOASIS
35 endif
36 # PRE_BUG TEST !!!
37 #DIR_MNH += ARCH_SRC/bug_mnh
38 # PRE_BUG TEST !!!
39 #
40 DIR_MNH += MNH
41 INC_MNH += -I$(B)include
42 #CPPFLAGS_MNH =
43 #
44 ifdef DIR_MNH
45 DIR_MASTER += $(DIR_MNH)
46 CPPFLAGS   += $(CPPFLAGS_MNH)
47 INC        += $(INC_MNH)
48
49 #
50 # MNH integer 4/8
51 #
52 CPPFLAGS   += -DMNH_INT=$(MNH_INT)
53 #
54 # MNH real 4/8
55 #
56 CPPFLAGS   += -DMNH_REAL=$(MNH_REAL)
57 #
58 #  Len of HREC characters 
59 #
60 CPPFLAGS   += -DLEN_HREC=$(LEN_HREC)
61 #
62
63 OBJS_NOCB +=  spll_dxf.o spll_dxm.o spll_dyf.o spll_dym.o \
64         spll_dzf.o spll_dzm.o spll_mxf.o \
65         spll_mxm.o spll_myf.o spll_mym.o spll_mzf.o \
66         spll_mzm.o spll_mzf4.o spll_mzm4.o  \
67         spll_gx_m_m.o spll_gx_m_u.o spll_gy_m_m.o \
68         spll_gy_m_v.o spll_gz_m_m.o spll_gz_m_w.o \
69         spll_dzf_mf.o spll_dzm_mf.o spll_mzf_mf.o spll_mzm_mf.o \
70         spll_modi_gradient_m_d.o
71
72 $(OBJS_NOCB) : OPT = $(OPT_NOCB)
73
74 OBJS0 += spll_switch_sbg_lesn.o spll_mode_mppdb.o
75
76 $(OBJS0)     : OPT = $(OPT0) 
77
78 endif
79 ##########################################################
80 #           Source SURFEX                                #
81 ##########################################################
82 # PRE_BUG TEST !!!
83 #DIR_SURFEX += ARCH_SRC/bug_surfex
84 # PRE_BUG TEST !!!
85 #
86 DIR_SURFEX += ARCH_SRC/surfex
87 DIR_SURFEX += SURFEX
88 CPPFLAGS_SURFEX += -DMNH_PARALLEL -Din_surfex 
89 #
90 ifdef DIR_SURFEX
91 DIR_MASTER += $(DIR_SURFEX)
92 CPPFLAGS   += $(CPPFLAGS_SURFEX)
93 VER_SURFEX=SURFEX-4-8-0
94 #ARCH_XYZ    := $(ARCH_XYZ)-$(VER_MYSRC)
95
96 OBJS_NOCB +=  spll_mode_cover_301_573.o 
97
98 $(OBJS0): OPT = $(OPT0) 
99
100 endif
101 ##########################################################
102 #           Source SURCOUCHE                             #
103 ##########################################################
104 # PRE_BUG TEST !!!
105 #DIR_SURCOUCHE += ARCH_SRC/bug_surcouche
106 # PRE_BUG TEST !!!
107 #
108 DIR_SURCOUCHE += LIB/SURCOUCHE/src
109 #CPPFLAGS_SURCOUCHE = -DMNH_MPI_DOUBLE_PRECISION -DMNH_LINUX -DMNH_MPI_BSEND -DNAGf95
110 #
111 ifdef DIR_SURCOUCHE
112 DIR_MASTER   += $(DIR_SURCOUCHE)
113 CPPFLAGS     += $(CPPFLAGS_SURCOUCHE)
114 #VER_SURCOUCHE=
115 #ARCH_XYZ    := $(ARCH_XYZ)-$(VER_SURCOUCHE)
116 endif
117 ##########################################################
118 #           Source RAD                                   #
119 ##########################################################
120 # PRE_BUG TEST !!!
121 #DIR_RAD      += ARCH_SRC/bug_rad
122 # PRE_BUG TEST !!!
123 #
124 DIR_RAD      +=  LIB/RAD/ECMWF_RAD
125 #CPPFLAGS_RAD =
126 INC_RAD      = -I$(B)LIB/RAD/ECMWF_RAD
127 #
128 ifdef MNH_ECRAD
129 DIR_RAD      +=  LIB/RAD/ecrad-1.0.1_mnh
130 DIR_RAD      +=  LIB/RAD/ecrad-1.0.1
131 CPPFLAGS_RAD = -DMNH_ECRAD
132 INC_RAD      += -I$(B)LIB/RAD/ecrad-1.0.1/include
133 ARCH_XYZ    := $(ARCH_XYZ)-ECRAD
134 endif
135 #
136 #
137 ifdef DIR_RAD
138 DIR_MASTER  += $(DIR_RAD)
139 CPPFLAGS    += $(CPPFLAGS_RAD)
140 INC         += $(INC_RAD)
141
142 IGNORE_DEP_MASTER   += olwu.D olwv.D rad1Driv_MACLATMOSPH_60LEVELS_ICRCCM3.D tstrad.D tstrad_chansubset.D tstrad_rttov7.D \
143                        tstrad_sx6.D
144
145 OBJS0 += spll_orrtm_kgb1.o spll_orrtm_kgb14.o spll_orrtm_kgb3_a.o spll_orrtm_kgb4_b.o \
146         spll_orrtm_kgb5_c.o spll_orrtm_kgb10.o spll_orrtm_kgb15.o spll_orrtm_kgb3_b.o \
147         spll_orrtm_kgb4_c.o spll_orrtm_kgb6.o spll_orrtm_kgb11.o spll_orrtm_kgb16.o \
148         spll_orrtm_kgb3_c.o spll_orrtm_kgb5.o spll_orrtm_kgb7.o spll_orrtm_kgb12.o \
149         spll_orrtm_kgb2.o spll_orrtm_kgb4.o spll_orrtm_kgb5_a.o spll_orrtm_kgb8.o \
150         spll_orrtm_kgb13.o spll_orrtm_kgb3.o spll_orrtm_kgb4_a.o spll_orrtm_kgb5_b.o \
151         spll_orrtm_kgb9.o spll_read_xker_raccs.o spll_read_xker_rdryg.o spll_read_xker_sdryg.o \
152         spll_suecaebc.o  spll_suecaec.o  spll_suecaeor.o  spll_suecaesd.o \
153         spll_suecaess.o  spll_suecaesu.o spll_suecozc.o  spll_suecozo.o
154 ifdef MNH_ECRAD
155 OBJS0 += spll_rrtm_kgb1.o spll_rrtm_kgb14.o spll_rrtm_kgb3_a.o spll_rrtm_kgb4_b.o \
156         spll_rrtm_kgb5_c.o spll_rrtm_kgb10.o spll_rrtm_kgb15.o spll_rrtm_kgb3_b.o \
157         spll_rrtm_kgb4_c.o spll_rrtm_kgb6.o spll_rrtm_kgb11.o spll_rrtm_kgb16.o \
158         spll_rrtm_kgb3_c.o spll_rrtm_kgb5.o spll_rrtm_kgb7.o spll_rrtm_kgb12.o \
159         spll_rrtm_kgb2.o spll_rrtm_kgb4.o spll_rrtm_kgb5_a.o spll_rrtm_kgb8.o \
160         spll_rrtm_kgb13.o spll_rrtm_kgb3.o spll_rrtm_kgb4_a.o spll_rrtm_kgb5_b.o \
161         spll_rrtm_kgb9.o spll_read_xker_raccs.o spll_read_xker_rdryg.o spll_read_xker_sdryg.o \
162         spll_suecaebc.o  spll_suecaec.o  spll_suecaeor.o  spll_suecaesd.o \
163         spll_suecaess.o  spll_suecaesu.o spll_suecozc.o  spll_suecozo.o
164 IGNORE_DEP_MASTER   += rrtm_rrtm_140gp_mcica.D srtm_spcvrt_mcica.D srtm_srtm_224gp_mcica.D radiation_psrad.D \
165                        radiation_psrad_rrtm.D test_spartacus_math.D radiation_adding_ica_sw_test.D \
166                        radiation_adding_ica_sw_test2.D srtm_gas_optical_depth_test.D
167 endif
168
169 $(OBJS0): OPT = $(OPT0) 
170
171 endif
172 ##########################################################
173 #           Source RTTOV                                 #
174 ##########################################################
175 ifdef MNH_RTTOV
176 ifndef VER_RTTOV
177 VER_RTTOV      = 8.7
178 endif
179 ifeq "$(VER_RTTOV)" "8.7"
180 DIR_RTTOV      +=  LIB/RTTOV/src
181 CPPFLAGS_RTTOV = -DMNH_RTTOV
182 INC_RTTOV      = -I$(B)LIB/RTTOV/src
183 #
184 DIR_MASTER  += $(DIR_RTTOV)
185 CPPFLAGS    += $(CPPFLAGS_RTTOV)
186 INC         += $(INC_RTTOV)
187 CPPFLAGS    += $(CPPFLAGS_RTTOV)
188 CPPFLAGS_MNH += -DMNH_RTTOV_8=MNH_RTTOV_8
189 endif
190 ifeq "$(VER_RTTOV)" "11.3"
191 DIR_RTTOV=${SRC_MESONH}/src/LIB/RTTOV-${VER_RTTOV}
192 RTTOV_PATH=${DIR_RTTOV}
193 #
194 INC_RTTOV     ?= -I${RTTOV_PATH}/include -I${RTTOV_PATH}/mod
195 LIB_RTTOV     ?= -L${RTTOV_PATH}/lib -lrttov11_coef_io -lrttov11_mw_scatt -lrttov11_main
196 INC            += $(INC_RTTOV)
197 LIBS           += $(LIB_RTTOV)
198 VPATH         += $(RTTOV_PATH)/mod
199 CPPFLAGS    += $(CPPFLAGS_RTTOV)
200 CPPFLAGS_MNH += -DMNH_RTTOV_11=MNH_RTTOV_11
201 endif
202 endif
203 ##########################################################
204 #           Source MEGAN                                 #
205 ##########################################################
206 ifdef MNH_MEGAN
207 DIR_MEGAN      +=  LIB/MEGAN 
208 CPPFLAGS_MEGAN = -DMNH_MEGAN
209 #
210 DIR_MASTER  += $(DIR_MEGAN)
211 CPPFLAGS    += $(CPPFLAGS_MEGAN)
212 INC         += $(INC_MEGAN)
213 CPPFLAGS_MNH += -DMNH_MEGAN=${MNH_MEGAN}
214 endif
215 ##########################################################
216 #           Source NEWLFI                                #
217 ##########################################################
218 DIR_NEWLFI      += LIB/NEWLFI/src
219 #CPPFLAGS_NEWLFI = -DSWAPIO -DLINUX
220 INC_NEWLFI      = -I$(B)LIB/NEWLFI/src
221 #
222 ifdef DIR_NEWLFI
223 #
224 # Management/parametrisation of size of INTEGER ofr file > 16 GO & RECL for LFI
225 #
226 LFI_INT?=4
227 ifneq "$(findstring 8,$(LFI_INT))" ""
228 OBJS_I8=spll_NEWLFI_ALL.o
229 $(OBJS_I8) : OPT = $(OPT_BASE) $(OPT_PERF2) $(OPT_INT8)
230 endif
231 #
232 # Management/parametrisation of size of RECL for LFI I/O speedup 
233 #
234 LFI_RECL?=512
235 #
236 DIR_MASTER          += $(DIR_NEWLFI)
237 CPPFLAGS            += $(CPPFLAGS_NEWLFI)
238 OBJS_LISTE_MASTER   += fswap8buff.o
239 INC                 += $(INC_NEWLFI)
240 VPATH               += $(DIR_NEWLFI)
241 #VER_NEWLFI=
242 #ARCH_XYZ    := $(ARCH_XYZ)-$(VER_NEWLFI)
243 endif
244 ##########################################################
245 #           Source COMPRESS                              #
246 ##########################################################
247 ifdef MNH_COMPRESS
248 DIR_COMPRESS           = ../LIBTOOLS/lib/COMPRESS/src
249 INC_COMPRESS           = -I$(B)$(DIR_COMPRESS)
250 DIR_MASTER            += $(DIR_COMPRESS)
251 OBJS_LISTE_MASTER     += bitbuff.o nearestpow2.o
252 INC                   += $(INC_COMPRESS)
253 VPATH                 += $(DIR_COMPRESS)
254 CPPFLAGS_COMPRESS     ?= -DLITTLE_endian
255 CPPFLAGS              += $(CPPFLAGS_COMPRESS)
256 endif
257 ##########################################################
258 #           Source S4PY                                  #
259 ##########################################################
260 ifdef MNH_S4PY
261 DIR_S4PY               = LIB/s4py
262 INC_S4PY               = -I$(B)$(DIR_S4PY)
263 DIR_MASTER            += $(DIR_S4PY)
264 OBJS_LISTE_MASTER     += init_gfortran.o
265 INC                   += $(INC_S4PY)
266 VPATH                 += $(DIR_S4PY)
267 endif
268 ##########################################################
269 #           Source FOREFIRE                              #
270 ##########################################################
271 ifdef MNH_FOREFIRE
272 DIR_FOREFIRE          += LIB/FOREFIRE
273 INC_FOREFIRE           = -I$(B)$(DIR_FOREFIRE)
274 DIR_MASTER            += $(DIR_FOREFIRE)
275 OBJS_LISTE_MASTER     += C_ForeFire_Interface.o
276 INC                   += $(INC_FOREFIRE)
277 VPATH                 += $(DIR_FOREFIRE)
278 CPPFLAGS              += -DMNH_FOREFIRE
279 ARCH_XYZ    := $(ARCH_XYZ)-FF
280 endif
281 ##########################################################
282 #           Source TOOLS                                 #
283 ##########################################################
284 ifdef MNH_TOOLS
285 DIR_TOOLS  += ../LIBTOOLS/tools/lfi2cdf/src
286 INC_TOOLS  += -I$(B)$(DIR_TOOLS)
287 DIR_MASTER += $(DIR_TOOLS)
288 INC        += $(INC_TOOLS)
289 VPATH      += $(DIR_TOOLS)
290 endif
291 ##########################################################
292 #           Source MPIVIDE                               #
293 ##########################################################
294 #
295 ifndef VER_MPI
296 VER_MPI=MPIVIDE
297 endif
298 #VER_MPI=MPIVIDE,LAMMPI,LAMMPI-IB,MPICH-IB
299 #
300 #   MPIVIDE
301 #
302 ifeq "$(VER_MPI)" "MPIVIDE"
303 DIR_MPI               += LIB/MPIvide
304 INC_MPI                = -I$(B)$(DIR_MPI)
305 DIR_MASTER            += $(DIR_MPI)
306 OBJS_LISTE_MASTER     += mpivide.o
307 INC                   += $(INC_MPI)
308 mpivide.o  : CPPFLAGS += -DFUJI -DMNH_INT=$(MNH_INT) -DMNH_REAL=$(MNH_REAL) \
309                         -I$(DIR_MPI)/include
310 VPATH                 += $(DIR_MPI)
311 endif
312 #
313 #   LAMMPI
314 #
315 ifeq "$(VER_MPI)" "LAMMPI"
316 # Standard Lam mpi
317 #INC_MPI     = -I$(B)/opt/lam/include
318 #LIB_MPI     = -L/opt/lam/lib   -lmpi -llammpi++ -llammpio -llamf77mpi -lmpi -llam -lpthread -ldl
319 # default 64 bits SUSE 9 version
320 INC_MPI     = -I$(B)/usr/include
321 LIB_MPI     = -lmpi -llammpi++ -llammpio -llamf77mpi -lmpi -llam -lpthread -ldl -lutil 
322 INC            += $(INC_MPI)
323 LIBS           += $(LIB_MPI)
324 endif
325 #
326 #   LAMMPI-IB
327 #
328 ifeq "$(VER_MPI)" "LAMMPI-IB"
329 INC_MPI     = -I/home/sila/LAM-7.1.1/include
330 LIB_MPI     = -L/usr/local/ibgd/driver/infinihost/lib64 -L/home/sila/LAM-7.1.1/lib \
331 -llammpio -llamf77mpi -lmpi -llam -lutil -lmosal -lmpga -lmtl_common -lvapi -ldl  -lpthread
332 INC            += $(INC_MPI)
333 LIBS           += $(LIB_MPI)
334 endif
335 #
336 #   MPICH-IB
337 #
338 ifeq "$(VER_MPI)" "MPICH-IB"
339 INC_MPI     = -I/usr/local/ibgd/mpi/osu/f95/mvapich-0.9.5/include
340 LIB_MPI     = -L/usr/local/ibgd/driver/infinihost/lib64 \
341                  -L/usr/local/ibgd/mpi/osu/f95/mvapich-0.9.5/lib \
342                  -lmpich -lmtl_common -lvapi -lmosal -lmpga -lpthread
343 INC            += $(INC_MPI)
344 LIBS           += $(LIB_MPI)
345 endif
346 #
347 #   MPICH-2 CNRM
348 #
349 ifeq "$(VER_MPI)" "MPICH2"
350 INC_MPI     = -I/usr/include
351 LIB_MPI     = -lmpichf90 -lmpich 
352 INC            += $(INC_MPI)
353 LIBS           += $(LIB_MPI)
354 endif
355
356 #
357 #   OPENMPI 1.1 CNRM
358 #
359 ifeq "$(VER_MPI)" "OMPICNRM"
360 MPI_ROOT=/opt/openmpi
361 INC_MPI = -I${MPI_ROOT}/include  -I${MPI_ROOT}/include/openmpi/ompi -I${MPI_ROOT}/lib64
362 LIB_MPI     = -L${MPI_ROOT}/lib64 -lmpi -lopen-rte -lopen-pal -lutil -lnsl -ldl -Wl,--export-dynamic -lm -lutil -lnsl -ldl
363 INC            += $(INC_MPI)
364 LIBS           += $(LIB_MPI)
365 endif
366
367 #
368 #   OPENMPI 1.1 BPROC + OPENIB + IFORT
369 #
370 ifeq "$(VER_MPI)" "OMPIIFORT"
371 MPI_ROOT=/home/sila/DEV/OPEN-MPI-11-IFORT-BPROC-OPENIB
372 INC_MPI     = -I${MPI_ROOT}/include -I${MPI_ROOT}/include/openmpi/ompi -I${MPI_ROOT}/lib
373 LIB_MPI     = -L${MPI_ROOT}/lib -lmpi -lorte -lopal -lutil -lnsl -ldl -Wl,--export-dynamic -lm -lutil -lnsl -ldl
374 INC            += $(INC_MPI)
375 LIBS           += $(LIB_MPI)
376 endif
377
378 #
379 #   OPENMPI 1.1.4 IFORT BPROC
380 #
381 ifeq "$(VER_MPI)" "OMPI114IFORT"
382 MPI_ROOT=/home/sila/DEV/OPEN-MPI-114-IFORT-BPROC-OPENIB
383 INC_MPI     = -I${MPI_ROOT}/include -I${MPI_ROOT}/include/openmpi/ompi -I${MPI_ROOT}/lib
384 LIB_MPI     = -L${MPI_ROOT}/lib -lmpi -lorte -lopal -lutil -lnsl -ldl -Wl,--export-dynamic -lm -lutil -lnsl -ldl
385 INC            += $(INC_MPI)
386 LIBS           += $(LIB_MPI)
387 endif
388
389 #
390 #   OPENMPI 1.2.2 G95 BPROC
391 #
392 ifeq "$(VER_MPI)" "OMPI122G95"
393 MPI_ROOT=/home/sila/DEV/OPEN-MPI-122-G95-BPROC-OPENIB
394 INC_MPI     = -I${MPI_ROOT}/include -I${MPI_ROOT}/include/openmpi/ompi -I${MPI_ROOT}/lib
395 LIB_MPI     = -L${MPI_ROOT}/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -Wl,--export-dynamic -lm -lutil -lnsl -ldl
396 INC            += $(INC_MPI)
397 LIBS           += $(LIB_MPI)
398 endif
399 #
400 #   OPENMPI12X
401 #
402 ifeq "$(VER_MPI)" "OMPI12X"
403 INC_MPI     = -I${MPI_ROOT}/include -I${MPI_ROOT}/include/openmpi/ompi -I${MPI_ROOT}/lib
404 LIB_MPI     = -L${MPI_ROOT}/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -Wl,--export-dynamic -lm -lutil -lnsl -ldl
405 INC            += $(INC_MPI)
406 LIBS           += $(LIB_MPI)
407 endif
408 #
409 #   MPI for SGI-ICE 
410 #
411 ifeq "$(VER_MPI)" "MPIICE"
412 INC_MPI     = 
413 LIB_MPI     = -lmpi
414 INC            += $(INC_MPI)
415 LIBS           += $(LIB_MPI)
416 endif
417
418
419 ARCH_XYZ    := $(ARCH_XYZ)-$(VER_MPI)
420 ##########################################################
421 #           Librairie GRIBEX                             #
422 ##########################################################
423 #ifneq "$(ARCH)" "BG"
424 # Gribex bypass on BG for the moment
425 #DIR_GRIBEX     +=  LIB/GRIBEX
426 #endif
427 #
428 #ifdef DIR_GRIBEX
429 #LIB_GRIBEX     =  $(DIR_GRIBEX)_$(ARCH)/libgribexR64.a
430 #LIBS          +=    $(LIB_GRIBEX)
431 #R64_GRIBEX=R64
432 #endif
433 ##########################################################
434 #           Librairie GRIBAPI                            #
435 ##########################################################
436 #ifneq "$(ARCH)" "BG"
437 # Gribapi bypass on BG for the moment
438 DIR_GRIBAPI?=${SRC_MESONH}/src/LIB/grib_api-${VERSION_GRIBAPI}
439 GRIBAPI_PATH?=${OBJDIR_MASTER}/GRIBAPI-${VERSION_GRIBAPI}
440 #GRIBAPI_PATH?=${DIR_GRIBAPI}-${ARCH}${MNH_INT}
441 GRIBAPI_INC?=${GRIBAPI_PATH}/include/grib_api.mod
442 #endif
443 #
444 ifdef DIR_GRIBAPI
445 INC_GRIBAPI   ?= -I${GRIBAPI_PATH}/include
446 LIB_GRIBAPI   ?= -L${GRIBAPI_PATH}/lib -L${GRIBAPI_PATH}/lib64 -lgrib_api_f90 -lgrib_api
447 INC           += $(INC_GRIBAPI)
448 LIBS          += $(LIB_GRIBAPI)
449 VPATH         += $(GRIBAPI_PATH)/include
450 R64_GRIBAPI=R64
451 endif
452
453 ##########################################################
454 #           Librairie OASIS                              #
455 ##########################################################
456 #
457 ifeq "$(VER_OASIS)" "OASISAUTO"
458 OASIS_PATH ?= ${SRC_MESONH}/src/LIB/work_oasis3-mct
459 OASIS_KEY ?= ${OASIS_PATH}/build/lib/psmile.MPI1/mod_oasis.mod
460 # INC_OASIS     : includes all *o and *mod for each library
461 INC_OASIS      ?= -I${OASIS_PATH}/build/lib/psmile.MPI1 -I$(OASIS_PATH)/build/lib/mct -I$(OASIS_PATH)/build/lib/scrip
462 LIB_OASIS      ?= -L${OASIS_PATH}/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
463 INC            += $(INC_OASIS)
464 LIBS           += $(LIB_OASIS)
465 VPATH          += ${OASIS_PATH}/build/lib/psmile.MPI1
466 CPPFLAGS       += -DCPLOASIS
467
468 endif
469
470 ifeq "$(VER_OASIS)" "OASISBASHRC"
471 OASIS_PATH ?= ${OASISDIR}
472 OASIS_KEY ?= ${OASIS_PATH}/build/lib/psmile.MPI1/mod_oasis.mod
473 # INC_OASIS     : includes all *o and *mod for each library
474 INC_OASIS      ?= -I${OASIS_PATH}/build/lib/psmile.MPI1 -I$(OASIS_PATH)/build/lib/mct -I$(OASIS_PATH)/build/lib/scrip
475 LIB_OASIS      ?= -L${OASIS_PATH}/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
476 INC            += $(INC_OASIS)
477 LIBS           += $(LIB_OASIS)
478 VPATH          += ${OASIS_PATH}/build/lib/psmile.MPI1
479 CPPFLAGS       += -DCPLOASIS
480 endif
481
482 ##########################################################
483 #           Librairie NETCDF4                            #
484 ##########################################################
485 # NETCDF4 INPUT/OUTPUT in MesoNH 
486 ifdef MNH_IOCDF4
487 CPPFLAGS_MNH += -DMNH_IOCDF4=$(MNH_IOCDF4)
488 endif
489 #
490 # NetCDF  : AUTO install of netcdf-4.X.X on PC linux to avoid problem with compiler
491 #  
492 #
493 ifeq "$(VER_CDF)" "CDFAUTO"
494 DIR_CDFC?=${SRC_MESONH}/src/LIB/netcdf-${VERSION_CDFC}
495 DIR_CDFCXX?=${SRC_MESONH}/src/LIB/netcdf-cxx-${VERSION_CDFCXX}
496 DIR_CDFF?=${SRC_MESONH}/src/LIB/netcdf-fortran-${VERSION_CDFF}
497 CDF_PATH?=${SRC_MESONH}/src/LIB/netcdf-${ARCH}-R${MNH_REAL}I${MNH_INT}
498 CDF_MOD?=${CDF_PATH}/include/netcdf.mod
499 #
500 INC_NETCDF     ?= -I${CDF_PATH}/include
501 LIB_NETCDF     ?= -L${CDF_PATH}/lib -L${CDF_PATH}/lib64 -lnetcdff -lnetcdf  -lhdf5_hl -lhdf5 -lsz -laec -lz -ldl
502 #
503 INC            += $(INC_NETCDF)
504 LIBS           += $(LIB_NETCDF)
505 #
506 DIR_HDF?=${SRC_MESONH}/src/LIB/hdf5-${VERSION_HDF}
507 #
508 DIR_LIBAEC?=${SRC_MESONH}/src/LIB/libaec-${VERSION_LIBAEC}
509
510 endif
511 #
512 # NetCDF : CDF LaReunion Local
513 #
514 ifeq "$(VER_CDF)" "CDFBASHRC"
515 #
516 INC_NETCDF     ?= $(shell $(NETCDF_CONFIG) --fflags)
517 LIB_NETCDF     ?= $(shell $(NETCDF_CONFIG) --flibs)
518 #
519 INC            += $(INC_NETCDF)
520 LIBS           += $(LIB_NETCDF)
521 #
522 endif
523 #
524 # NetCDF in beaufix (bull meteo-france)
525 ifeq "$(VER_CDF)" "CDFBFIX"
526 CDF_PATH?=/opt/softs/libraries/ICC16.1.150/netcdf-4.4.0
527 INC_NETCDF     ?= -I${CDF_PATH}/include
528 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdf -lnetcdff
529 INC            += $(INC_NETCDF)
530 LIBS           += $(LIB_NETCDF)
531 endif
532 #
533 # NetCDF in BGQ
534 #
535 ifeq "$(VER_CDF)" "CDFBGQ"
536 CDF_PATH?=/bglocal/cn/pub/NetCDF/4.3.3.1/seq
537 INC_NETCDF     ?= -I${CDF_PATH}/include
538 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdff -lnetcdf_c++ -lnetcdf
539 INC            += $(INC_NETCDF)
540 LIBS           += $(LIB_NETCDF)
541 HDF5_PATH?=/bglocal/cn/pub/HDF5/1.8.14/seq/
542 LIB_HDF5       ?= -L${HDF5_PATH}/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm
543 LIBS           += $(LIB_HDF5)
544 LIBZ_PATH?=/bglocal/cn/pub/zlib/1.2.5
545 LIB_LIBZ       ?= -L${LIBZ_PATH}/lib -lz
546 LIBS           += $(LIB_LIBZ)
547
548 endif
549 #
550 # NetCDF in SGI ICE
551 #
552 ifeq "$(VER_CDF)" "CDFICE"
553 CDF_PATH?=/opt/software/SGI/netcdf/4.0
554 INC_NETCDF     ?= -I${CDF_PATH}/include
555 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdff  -lnetcdf -i_dynamic 
556 INC            += $(INC_NETCDF)
557 LIBS           += $(LIB_NETCDF)
558 endif
559 #
560 # NetCDF in NEC SX
561 #
562 ifeq "$(VER_CDF)" "CDFSX"
563 CDF_PATH?=/SXlocal/pub/netcdf/3.6.1
564 INC_NETCDF     ?= -I${CDF_PATH}/include
565 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdf_c++ -lnetcdf
566 INC            += $(INC_NETCDF)
567 LIBS           += $(LIB_NETCDF)
568 endif
569 #
570 ifeq "$(VER_CDF)" "CDFMFSX"
571 CDF_PATH?=/usr/local/SX/lib/NETCDF_size_t32
572 INC_NETCDF     ?= -I${CDF_PATH}/include
573 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdf
574 INC            += $(INC_NETCDF)
575 LIBS           += $(LIB_NETCDF)
576 endif
577 #
578 # NetCDF in prefix (bull meteo-france)
579 ifeq "$(VER_CDF)" "CDFBULL"
580 CDF_PATH?=/home_nfs/local/Icc13.0.1/netcdf-4.2.1.1
581 INC_NETCDF     ?= -I${CDF_PATH}/include
582 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdf -lnetcdff
583 INC            += $(INC_NETCDF)
584 LIBS           += $(LIB_NETCDF)
585 endif
586 #
587
588 # NetCDF in AIX S
589 #
590 ifeq "$(VER_CDF)" "CDFAIX"
591 CDF_PATH?=/usr/local/pub/NetCDF/3.6.2
592 INC_NETCDF     ?= -I${CDF_PATH}/include
593 LIB_NETCDF     ?= -L${CDF_PATH}/lib -lnetcdf_c++ -lnetcdf
594 INC            += $(INC_NETCDF)
595 LIBS           += $(LIB_NETCDF)
596 endif
597
598 #
599 # Linux with gfortran SUSE10.3
600 #
601 ifeq "$(VER_CDF)" "CDFGFOR"
602 INC_NETCDF     ?=  -I/usr/include
603 LIB_NETCDF     ?=  -lnetcdf -lnetcdff /usr/lib64/libgfortran.so.2
604 #LIB_NETCDF     ?=  -lnetcdf -lnetcdff 
605 INC            += $(INC_NETCDF)
606 LIBS           += $(LIB_NETCDF)
607 endif
608
609 #
610 # Linux with netcdf CTI 3.6.3
611 #
612 ifeq "$(VER_CDF)" "CDFCTI"
613 CDF_PATH?=/usr
614 INC_NETCDF     = -I${CDF_PATH}/include
615 LIB_NETCDF     = -L${CDF_PATH}/lib64 -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lsz -lz
616 INC            += $(INC_NETCDF)
617 LIBS           += $(LIB_NETCDF)
618 endif
619
620 #
621 # Linux with gfortran SUSE11.1
622 #
623 ifeq "$(VER_CDF)" "CDF3GFOR"
624 CDF_PATH       ?=/opt/netcdf3
625 INC_NETCDF     ?=  -I${CDF_PATH}/include
626 LIB_NETCDF     ?=  -L${CDF_PATH}/lib64  -lnetcdf_c++ -lnetcdf
627 INC            +=  $(INC_NETCDF)
628 LIBS           +=  $(LIB_NETCDF)
629 endif
630
631 # for oasis compilation <=> to find correctly netcdf
632 NETCDF_INCLUDE ?= ${CDF_PATH}/include
633 NETCDF_LIBRARY ?= $(LIB_NETCDF)
634 export NETCDF_INCLUDE NETCDF_LIBRARY F90 CC
635
636 ##########################################################
637 #           Number of NESTED MODEL                       #
638 ##########################################################
639 NSOURCE=8
640 ##########################################################
641 #                                                        #
642 # PROG_LIST : Main program liste to compile              #
643 #                                                        #
644 ##########################################################
645 #
646 #ifeq "$(ARCH)" "BGQ"
647 #PROG_LIST += MESONH PREP_IDEAL_CASE PREP_PGD
648 #else
649 PROG_LIST += MESONH  LATLON_TO_XY PREP_IDEAL_CASE PREP_REAL_CASE PREP_PGD \
650             PREP_NEST_PGD SPAWNING DIAG PREP_SURFEX ZOOM_PGD SPECTRE \
651             MNH2LPDM
652 ifdef MNH_TOOLS
653 PROG_LIST += LFI2CDF
654 endif
655 #endif
656 ##########################################################
657 #                                                        #
658 # LIB_OBJS : Librarie of all *.o                         #
659 #                                                        #
660 ##########################################################
661 #
662 ARCH_XYZ        := $(ARCH_XYZ)-$(OPTLEVEL)
663 OBJDIR_ROOT     := $(OBJDIR_ROOT)-$(ARCH_XYZ)
664 LIB_OBJS_ROOT   := $(LIB_OBJS_ROOT)-$(ARCH_XYZ)
665 #
666 ##########################################################
667 #                                                        #
668 # IGNORE_OBJS : some *.o to ignore                       #
669 #       ---> unused unsupported old routines             #
670 #                                                        #
671 ##########################################################
672 #
673 IGNORE_OBJS += spll_olwu.o spll_olwv.o spll_rad1driv.o spll_radlsw.o spll_suovlp.o \
674             spll_ch_init_model0d.o spll_ch_model0d.o spll_ch_svode_fcn.o spll_ch_svode_jac.o
675 IGNORE_DEP_MASTER += modules_diachro.D
676 IGNORE_DEP_MASTER += ch_svode.D ch_model0d.D  \
677           create_file.D def_var_netcdf.D get_dimlen_netcdf.D \
678           handle_err.D init_outfn_isban.D init_outfn_sean.D \
679           init_outfn_surf_atmn.D init_outfn_tebn.D init_outfn_watern.D \
680           ol_find_file.D ol_read_atm.D ol_time_interp_atm.D \
681           read_surf_ol.D write_surf_ol.D \
682 close_file_ol.D close_namelist_ol.D end_io_surf_oln.D \
683 init_io_surf_oln.D modd_io_surf_ol.D modd_ol_fileid.D \
684 open_file_ol.D open_namelist_ol.D read_surf_ol.D write_surf_ol.D offline.D
685
686 #
687 #
688 ##########################################################
689 #                                                        #
690 #  VPATH_EXCLUDE : Some sources directory to exclude     #
691 #                                                        #
692 ##########################################################
693 #
694 VPATH_EXCLUDE= %/CVS
695 #
696
697
698