source: LMDZ5/trunk/makelmdz @ 2238

Last change on this file since 2238 was 2238, checked in by Ehouarn Millour, 9 years ago

Update of "makelmdz" and "create_make_gcm" scripts so that only required directories are scanned when building the makefile.
EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:executable set to *
File size: 20.4 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5#
6########################################################################
7# for debug, uncomment line below
8#set -xv
9########################################################################
10# options par defaut pour la commande make
11########################################################################
12dim="96x72x19"
13physique=lmd
14code=gcm
15filtre=filtrez
16grille=reg
17couple=false
18veget=false
19chimie=false
20parallel=none
21paramem="par"
22compil_mod=prod
23io=ioipsl
24LIBPREFIX=""
25fcm_path=none
26cosp=false
27sisvat=false
28rrtm=false
29full=""
30
31# guess a default 'arch'
32arch="local" # start with assuming we're on a local machine with local arch file
33## try to recognise machine and infer arch from it
34machine=`hostname`
35if [[ "${machine:0:3}" == "ada" ]]
36then
37  arch="X64_ADA"
38fi
39if [[ "${machine:0:7}" == "platine" ]]
40then
41  arch="IA64_PLATINE"
42fi
43if [[ "${machine:0:6}" == "titane" ]]
44then
45  arch="X64_TITANE"
46fi
47if [[ "${machine:0:8}" == "mercure1" ]]
48then
49  arch="SX8_MERCURE"
50fi
51if [[ "${machine:0:8}" == "mercure2" ]]
52then
53  arch="SX9_MERCURE"
54fi
55
56LMDGCM=`pwd -P`
57LIBFGCM=$LMDGCM/libf
58LIBOGCM=$LMDGCM/libo
59if [[ ! -d $LIBOGCM ]]
60then
61  # create the directory
62  mkdir $LIBOGCM
63  if [[ ! $? ]]
64  then
65  echo "Failed to create directory $LIBOGCM"
66  exit
67  fi
68fi
69COSP_PATH=$LMDGCM/.void_dir
70
71
72
73localdir=`pwd -P`
74########################################################################
75#  Quelques initialisations de variables du shell.
76########################################################################
77
78CPP_KEY="" 
79INCLUDE='-I$(LIBF)/grid -I$(LIBF)/bibio -I$(LIBF)/filtrez -I. '
80LIB=""
81adjnt=""
82##COMPIL_FFLAGS="%PROD_FFLAGS"
83PARA_FFLAGS=""
84PARA_LD=""
85EXT_SRC=""
86#src_dirs: directories containing source files
87src_dirs="grid bibio" 
88########################################################################
89# lecture des options
90########################################################################
91
92while (($# > 0))
93  do
94  case $1 in
95      "-h") cat <<fin
96Usage :
97makelmdz [options] -arch nom_arch exec
98[-h]                       : brief help
99[-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
100[-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
101[-prod / -dev / -debug]    : compilation mode production (default) / developement / debug
102[-c false/MPI1/MPI2]       : coupling with ocean model : MPI1/MPI2/false (default: false)
103[-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false)
104          false       : no vegetation model
105          orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version)
106          orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
107          true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
108[-chimie INCA/false]       : with INCA chemistry model or without (default: false)
109[-cosp true/false]    : compile with/without cosp package (default: false)
110[-sisvat true/false]  : compile with/without sisvat package (default: false)
111[-rrtm true/false]    : compile with/without rrtm package (default: false)
112[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
113[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
114[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
115[-include INCLUDES]        : extra include path to add
116[-cpp CPP_KEY]             : additional preprocessing definitions
117[-adjnt]                   : adjoint model, not operational ...
118[-mem]                     : reduced memory dynamics (if in parallel mode)
119[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
120[-full]                    : Full (re)compilation (from scratch)
121[-link LINKS]              : additional links with other libraries
122[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
123[-ext_src path]            : path to an additional set of routines to compile with the model
124 -arch nom_arch            : target architecture
125 exec                      : executable to build
126fin
127          exit;;
128      "-d")
129          dim=$2 ; shift ; shift ;;
130     
131      "-p")
132          physique="$2" ;  shift ; shift ;;
133
134      "-g")
135          grille="$2" ; shift ; shift ;;
136
137      "-c")
138          couple="$2" ; shift ; shift ;;
139
140      "-prod")
141          compil_mod="prod" ; shift ;;
142
143      "-dev")
144          compil_mod="dev" ; shift ;;
145
146      "-debug")
147          compil_mod="debug" ; shift ;;
148
149      "-io")
150          io="$2" ; shift ; shift ;;
151
152      "-v")
153          veget="$2" ; shift ; shift ;;
154
155      "-chimie")
156          chimie="$2" ; shift ; shift ;;
157
158      "-parallel")
159          parallel="$2" ; shift ; shift ;;
160     
161      "-include")
162          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
163
164      "-cpp")
165          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
166
167      "-cosp")
168          cosp="$2" ; shift ; shift ;;
169     
170      "-sisvat")
171          sisvat="$2" ; shift ; shift ;;
172     
173      "-rrtm")
174          rrtm="$2" ; shift ; shift ;;
175     
176      "-mem")
177          paramem="mem" ; shift ;;
178
179      "-filtre")
180          filtre=$2 ; shift ; shift ;;
181
182      "-full")
183      full="full" ; shift ;;
184
185      "-link")
186          LIB="$LIB $2" ; shift ; shift ;;
187
188      "-fcm_path")
189          fcm_path=$2 ; shift ; shift ;;
190
191      "-ext_src")
192          EXT_SRC=$2 ; src_dirs="$src_dirs $EXT_SRC" ; shift ; shift ;;
193
194      "-arch")
195          arch=$2 ; shift ; shift ;;
196
197      *)
198          code="$1" ; shift ;;
199  esac
200done
201
202###############################################################
203# lecture des chemins propres \`a l'architecture de la machine #
204###############################################################
205rm -f .void_file
206echo > .void_file
207rm -rf .void_dir
208mkdir .void_dir
209rm -f arch.path
210if [[ -r arch/arch-${arch}.path ]]
211then
212  ln -s arch/arch-${arch}.path ./arch.path
213  source arch.path
214else
215  echo "Error: missing arch/arch-${arch}.path file !"
216  exit
217fi
218rm -f arch.fcm
219if [[ -r arch/arch-${arch}.fcm ]]
220then
221  ln -s arch/arch-${arch}.fcm arch.fcm
222else
223  echo "Error: missing arch/arch-${arch}.fcm file !"
224  exit
225fi
226########################################################################
227# Definition des clefs CPP, des chemins des includes et modules
228#  et des libraries
229########################################################################
230
231# basic compile flags from arch.fcm file
232archfileline=$( grep -i '^%BASE_FFLAGS' arch.fcm )
233COMPIL_FFLAGS=$( echo ${archfileline##%BASE_FFLAGS} )
234
235# other compile flags, depending on compilation mode
236if [[ "$compil_mod" == "prod" ]]
237then
238## read COMPIL_FFLAGS from arch.fcm file
239  archfileline=$( grep -i '^%PROD_FFLAGS' arch.fcm )
240  archfileopt=$( echo ${archfileline##%PROD_FFLAGS} )
241  COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}"
242elif [[ "$compil_mod" == "dev" ]]
243then
244## read %DEV_FFLAGS from arch.fcm file
245  archfileline=$( grep -i '^%DEV_FFLAGS' arch.fcm )
246  archfileopt=$( echo ${archfileline##%DEV_FFLAGS} )
247  COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}"
248elif [[ "$compil_mod" == "debug" ]]
249then
250## read %DEBUG_FFLAGS from arch.fcm file
251  archfileline=$( grep -i '^%DEBUG_FFLAGS' arch.fcm )
252  archfileopt=$( echo ${archfileline##%DEBUG_FFLAGS} )
253  COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}"
254fi
255
256# add CPP_KEY defined in arch.fcm file
257archfileline=$( grep -i '^%FPP_DEF' arch.fcm )
258archfileopt=$( echo ${archfileline##%FPP_DEF} )
259CPP_KEY="$CPP_KEY ${archfileopt}"
260
261# get compiler name from arch.fcm file
262archfileline=$( grep -i '^%COMPILER' arch.fcm )
263fcompiler=$( echo ${archfileline##%COMPILER} )
264
265# get linker name from arch.fcm file
266archfileline=$( grep -i '^%LINK' arch.fcm )
267linker=$( echo ${archfileline##%LINK} )
268
269# get ar command from arch.fcm file
270archfileline=$( grep -i '^%AR' arch.fcm )
271arcommand=$( echo ${archfileline##%AR} )
272
273# get make utility from arch.fcm file
274archfileline=$( grep -i '^%MAKE' arch.fcm )
275makecommand=$( echo ${archfileline##%MAKE} )
276
277# get basic libraries to link with arch.fcm file
278archfileline=$( grep -i '^%BASE_LD' arch.fcm )
279archfileopt=$( echo ${archfileline##%BASE_LD} )
280LIB="$LIB  ${archfileopt}"
281
282# add Include files defined in arch.fcm file for pre-processing
283archfileline=$( grep -i '^%FPP_FLAGS' arch.fcm )
284for inc in $archfileline ; do INCLUDE="$INCLUDE `echo $inc | grep '\-I'`" ; done
285
286if [[ "$physique" != "nophys" ]]
287then
288   #We'll use some physics
289   src_dirs="$src_dirs phy$physique"
290   CPP_KEY="$CPP_KEY CPP_PHYS"
291   if [[ "${physique:0:3}" == "lmd" ]]
292   then
293   #For lmd physics, default planet type is Earth
294   CPP_KEY="$CPP_KEY CPP_EARTH"
295   fi
296fi
297
298if [[ "$chimie" == "INCA" ]]
299then
300   CPP_KEY="$CPP_KEY INCA"
301   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
302   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
303   libchimie=" -L${INCA_LIBDIR} -lchimie"
304fi
305
306if [[ "$couple" != "false" ]]
307then
308   CPP_KEY="$CPP_KEY CPP_COUPLE"
309   INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
310   LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.${couple} -lmpp_io"
311fi
312
313if [[ "$parallel" == "none" ]]
314then
315  FLAG_PARA=''
316else
317  FLAG_PARA="$paramem"
318  if [[ $paramem == par ]]
319  then
320      echo "The version of the dynamics in dyn3dpar is no longer updated."
321      echo "You should use option \"-mem\"."
322      exit 1
323  fi
324fi
325
326if [[ "$parallel" == "mpi" ]]
327then
328   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
329  # MPI additional compilation options
330  archfileline=$( grep -i '^%MPI_FFLAGS' arch.fcm )
331  PARA_FFLAGS=$( echo ${archfileline##%MPI_FFLAGS} )
332  # MPI additional links
333  archfileline=$( grep -i '^%MPI_LD' arch.fcm )
334  PARA_LD=$( echo ${archfileline##%MPI_LD} )
335elif [[ "$parallel" == "omp" ]]
336then
337   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
338  # OMP additional compilation options
339  archfileline=$( grep -i '^%OMP_FFLAGS' arch.fcm )
340  PARA_FFLAGS=$( echo ${archfileline##%OMP_FFLAGS} )
341  # OMP additional links
342  archfileline=$( grep -i '^%OMP_LD' arch.fcm )
343  PARA_LD=$( echo ${archfileline##%OMP_LD} )
344elif [[ "$parallel" == "mpi_omp" ]]
345then
346   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
347  # MPI additional compilation options
348  archfileline=$( grep -i '^%MPI_FFLAGS' arch.fcm )
349  PARA_FFLAGS=$( echo ${archfileline##%MPI_FFLAGS} )
350  # OMP additional compilation options
351  archfileline=$( grep -i '^%OMP_FFLAGS' arch.fcm )
352  PARA_FFLAGS="${PARA_FFLAGS} "$( echo $archfileopt ${archfileline##%OMP_FFLAGS} )
353  # MPI additional links
354  archfileline=$( grep -i '^%MPI_LD' arch.fcm )
355  PARA_LD=$( echo ${archfileline##%MPI_LD} )
356  # OMP additional links
357  archfileline=$( grep -i '^%OMP_LD' arch.fcm )
358  PARA_LD="${PARA_LD} "$( echo $archfileopt ${archfileline##%OMP_LD} )
359fi
360
361if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
362   && "$compil_mod" == "debug" ]]
363then
364    echo "Usually, parallelization with OpenMP requires some optimization."
365    echo "We suggest switching to \"-dev\"."
366fi
367
368
369#==============================================================================
370if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
371then
372
373   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
374   CPP_KEY="$CPP_KEY CPP_VEGET"
375# temporary, for Orchidee versions 1.9.* (before openmp activation)
376   if [[ "$veget" == "orchidee1.9" ]] ; then
377      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
378   fi
379   if [[ "$veget" == "orchidee2.0" ]] ; then
380      orch_libs="sechiba parameters stomate parallel orglob orchidee"
381   else
382      orch_libs="sechiba parameters stomate parallel orglob"
383   fi
384   LIB="${LIB} -L${ORCH_LIBDIR}"
385   for lib in ${orch_libs} ; do
386      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
387         LIB="${LIB} -l${LIBPREFIX}$lib "
388      fi
389   done
390elif [[ "$veget" != "false" ]] ; then
391   echo "Option -v $veget does not exist"
392   echo "Use ./makelmdz -h for more information"
393   exit 
394fi
395
396#===============================================================================
397if [[ $io == ioipsl ]]
398then
399   CPP_KEY="$CPP_KEY CPP_IOIPSL"
400   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
401   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
402elif [[ $io == mix ]]
403then
404   # For now, xios implies also using ioipsl
405   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
406   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
407   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios"
408elif [[ $io == xios ]]
409then
410   # For now, xios implies also using ioipsl
411   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
412   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
413   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios"
414fi
415
416if [[ "$cosp" == "true" ]]
417then
418   CPP_KEY="$CPP_KEY CPP_COSP"
419   COSP_PATH="$LIBFGCM/cosp"
420   src_dirs="$src_dirs cosp"
421#   LIB="${LIB} -l${LIBPREFIX}cosp"
422   opt_dep="$opt_dep cosp"
423   lcosp="-l${LIBPREFIX}cosp"
424   INCLUDE="$INCLUDE"' -I$(LIBF)/cosp'
425fi
426
427if [[ "$sisvat" == "true" ]]
428then
429   CPP_KEY="$CPP_KEY CPP_SISVAT"
430   src_dirs="$src_dirs phy${physique}/sisvat"
431fi
432
433if [[ "$rrtm" == "true" ]]
434then
435   CPP_KEY="$CPP_KEY CPP_RRTM"
436   src_dirs="$src_dirs phy${physique}/rrtm"
437fi
438
439
440INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
441LIB="$LIB ${NETCDF_LIBDIR}"
442
443########################################################################
444# calcul du nombre de dimensions
445########################################################################
446
447
448dim_full=$dim
449dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
450set $dim
451dimc=$#
452echo calcul de la dimension
453echo dim $dim
454echo dimc $dimc
455
456########################################################################
457# Gestion des dimensions du modele.
458# on cree ou remplace le fichier des dimensions
459########################################################################
460
461cd $LIBFGCM/grid
462if [[ -f dimensions.h ]]
463then
464  echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
465  echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
466  echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
467  echo  vous pouvez continuer en repondant oui.
468  echo "Voulez-vous vraiment continuer?"
469  echo ""
470  echo "WARNING: you are probably already compiling the model somewhere else."
471  echo "Wait until the first compilation is finished before launching this one."
472  echo "If you are sure that you are not compiling elsewhere, just answer "
473  echo "yes (or 'oui') to the question below to proceed."
474  echo "Do you wish to continue?"
475  read reponse
476  if [[ $reponse == "oui" || $reponse == "yes" ]]
477  then
478    \rm -f $LIBFGCM/grid/dimensions.h
479  else
480    exit
481  fi
482fi
483
484cd $LIBFGCM/grid/dimension
485./makdim $dim
486if (($? != 0))
487then
488    exit 1
489fi
490
491cat $LIBFGCM/grid/dimensions.h
492cd $LMDGCM
493
494########################################################################
495# Differentes dynamiques (3d, 2d, 1d)
496########################################################################
497
498if (( $dimc == 3 )) ; then
499   src_dirs="$src_dirs $filtre dyn3d_common dyn3d${FLAG_PARA}"
500   cd $LIBFGCM/grid
501   \rm fxyprim.h
502   cp -p fxy_${grille}.h fxyprim.h
503   filtre="FILTRE=$filtre"
504   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} -I$(LIBF)/dyn3d_common '
505elif (( $dimc == 2 )) ; then
506   filtre="FILTRE= L_FILTRE= "
507   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d'
508elif (( $dimc == 1 )) ; then
509   src_dirs="$src_dirs dyn3d dyn3d_common filtrez"
510   CPP_KEY="$CPP_KEY CPP_1D"
511   filtre="L_DYN= DYN= FILTRE= L_FILTRE= DIRMAIN=phy$physique "
512   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre
513else
514   echo Dimension dimc=$dimc pas prevu ; exit
515fi
516
517cd $LMDGCM
518
519########################################################################
520# library directory name:
521########################################################################
522
523nomlib=`echo ${arch}_${physique}_${dim_full}_${grille}_${compil_mod}_parall${parallel}_${CPP_KEY}_${FLAG_PARA} | sed -e 's/ //g' -e 's/-//g ' | sed -e 's/CPP_//g'`
524echo "Path to library: "$nomlib
525
526########################################################################
527#  Cleanup for a full recompilation, if requested
528########################################################################
529
530if [[ $full == "full" ]]
531then
532# remove makefile and librairies
533  echo "-full option: recompiling from scratch"
534  \rm -f makefile
535  \rm -rf "${LIBOGCM}/${nomlib}"
536fi
537
538########################################################################
539#  Avant de lancer le make, on recree le makefile si necessaire
540########################################################################
541########################################################################
542# c'est a dire dans 3 cas:
543# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
544#    derniere creation du makefile
545# 2. si le fichier contenant cette liste "liste_des_sources"
546#    n'existe pas.
547# 3. Si le makefile n'existe pas.
548########################################################################
549cd $LMDGCM
550
551find libf -name '*.[Fh]' -print | sort > tmp77
552#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print > tmp90
553find libf -name '*.F90' -print | sort > tmp90
554
555if [[ -r .makelmdz ]]
556then
557old_lmdz_configuration=$(cat .makelmdz )
558else
559old_lmdz_configuration=""
560fi
561lmdz_configuration="$src_dirs"
562if [[ "$lmdz_configuration" != "$old_lmdz_configuration" ]]
563then
564  configuration_change="true"
565else
566  configuration_change="false"
567fi
568
569if [[ $configuration_change == "true" || ! ( -r makefile ) || ! ( -r liste_des_sources_f90 ) || ! ( -r liste_des_sources_f77 ) || ` diff tmp77 liste_des_sources_f77 | wc -w ` -ne 0 || ` diff tmp90 liste_des_sources_f90 | wc -w ` -ne 0 ]]
570then
571  echo "les fichiers suivants ont ete crees ou detruits"
572  echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
573  diff liste_des_sources_f77 tmp77
574  diff liste_des_sources_f90 tmp90
575  \cp -f tmp77 liste_des_sources_f77
576  \cp -f tmp90 liste_des_sources_f90
577  echo "Recreating the makefile"
578  echo "src_dirs: $src_dirs"
579  ./create_make_gcm $src_dirs > tmp
580  \mv -f tmp makefile
581  echo "New makefile created"
582fi
583
584#Create a .makelmdz file containing main compilation option for later comparisons
585echo "$lmdz_configuration" > .makelmdz
586
587#################################################################
588# Preparation de l'execution de la comande make
589#################################################################
590
591source_code=${code}.F
592if [[ -r $LMDGCM/libf/dyn${dimc}d${FLAG_PARA}/${code}.F90 ]]
593then
594  source_code=${code}.F90
595elif [[ -r $LMDGCM/libf/phy$physique/${code}.F90 ]] ; then
596  source_code=${code}.F90
597fi
598
599if [[ ! -d "${LIBOGCM}/${nomlib}" ]]
600then
601  mkdir ${LIBOGCM}/${nomlib}
602  # check we indeed managed to create the directory
603  if [[ ! $? ]]
604  then
605    echo "Error: could not create directory ${LIBOGCM}/${nomlib}"
606    exit
607  fi
608fi
609
610# where module files are created
611mod_loc_dir=$localdir
612
613if [[ "$physique" != "nophys" ]]
614then
615  INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique"
616fi
617INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib}
618
619# ranlib utility (check it exists or else default to ls)
620if [[ `which ranlib > /dev/null 2>&1 ; echo $?` -eq 0 ]]
621then
622  ranlib="ranlib"
623else
624  ranlib="ls"
625fi
626
627# add CPP keys to COMPIL_FLAGS
628# (but first add -D before all CPP_KEY items)
629cpp_definitions=`echo $CPP_KEY | sed -e 's/[A-Za-z_=0-9]*/-D&/g'`
630# (but add a -WF,-D before all CPP_KEY items) => for xlf on Vargas
631if [[ "${fcompiler:0:3}" == "xlf" ]]
632then
633cpp_definitions=`echo $CPP_KEY | sed -e 's/[A-Za-z_=0-9]*/-WF,-D&/g'`
634fi
635COMPIL_FFLAGS="${COMPIL_FFLAGS} ${cpp_definitions}"
636
637#################################################################
638# Execution du make
639#################################################################
640echo $makecommand RANLIB=$ranlib -f $LMDGCM/makefile \
641OPTION_DEP="$opt_dep" OPTION_LINK="$LIB ${PARA_LD}" \
642OPTIM90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
643OPTIMTRU90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
644OPTIM="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
645INCLUDE="$INCLUDE" \
646$filtre \
647LIBO=${LIBOGCM}/${nomlib} \
648"PHYS=$physique" \
649DIM=$dimc \
650FLAG_PARA=$FLAG_PARA \
651L_ADJNT=$adjnt \
652L_COSP="$lcosp" \
653L_CHIMIE="$libchimie" \
654LOCAL_DIR="$localdir"  \
655F77="$fcompiler" \
656F90="$fcompiler" \
657OPLINK="$LIB" \
658LINK="$linker" \
659GCM="$LMDGCM" \
660MOD_LOC_DIR=$mod_loc_dir \
661MOD_SUFFIX="mod" \
662AR=$arcommand \
663SOURCE=$source_code \
664PROG=$code
665
666$makecommand RANLIB=$ranlib -f $LMDGCM/makefile \
667OPTION_DEP="$opt_dep" OPTION_LINK="$LIB ${PARA_LD}" \
668OPTIM90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
669OPTIMTRU90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
670OPTIM="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \
671INCLUDE="$INCLUDE" \
672$filtre \
673LIBO=${LIBOGCM}/${nomlib} \
674"PHYS=$physique" \
675DIM=$dimc \
676FLAG_PARA=$FLAG_PARA \
677L_ADJNT=$adjnt \
678L_COSP="$lcosp" \
679L_CHIMIE="$libchimie" \
680LOCAL_DIR="$localdir"  \
681F77="$fcompiler" \
682F90="$fcompiler" \
683OPLINK="$LIB" \
684LINK="$linker" \
685GCM="$LMDGCM" \
686MOD_LOC_DIR=$mod_loc_dir \
687MOD_SUFFIX="mod" \
688AR=$arcommand \
689SOURCE=$source_code \
690PROG=$code
691
692
693if [[ -r $LIBFGCM/grid/dimensions.h ]]
694then
695  # Cleanup: remove dimension.h file
696  \rm -f $LIBFGCM/grid/dimensions.h
697fi
Note: See TracBrowser for help on using the repository browser.