source: LMDZ5/trunk/makelmdz @ 2233

Last change on this file since 2233 was 2202, checked in by lguez, 10 years ago

Added tests in the compilation scripts: iim should be a multiple of 8 and dyn3dpar should not be used.

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