[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 | ######################################################################## |
---|
| 12 | dim="96x72x19" |
---|
| 13 | physique=lmd |
---|
| 14 | code=gcm |
---|
| 15 | filtre=filtrez |
---|
| 16 | grille=reg |
---|
| 17 | couple=false |
---|
| 18 | veget=false |
---|
[4567] | 19 | inlandsis=false |
---|
| 20 | rrtm=false |
---|
| 21 | rad="oldrad" |
---|
| 22 | dust=false |
---|
| 23 | strataer=false |
---|
[1463] | 24 | chimie=false |
---|
| 25 | parallel=none |
---|
[3997] | 26 | paramem="mem" |
---|
[1463] | 27 | compil_mod=prod |
---|
| 28 | io=ioipsl |
---|
| 29 | LIBPREFIX="" |
---|
| 30 | fcm_path=none |
---|
| 31 | cosp=false |
---|
[3359] | 32 | cosp2=false |
---|
[3491] | 33 | cospv2=false |
---|
[4567] | 34 | |
---|
[2112] | 35 | full="" |
---|
[1463] | 36 | |
---|
[2743] | 37 | arch_defined="FALSE" |
---|
| 38 | arch_path="arch" |
---|
| 39 | arch_default_path="arch" |
---|
| 40 | |
---|
[1463] | 41 | # guess a default 'arch' |
---|
[1690] | 42 | arch="local" # start with assuming we're on a local machine with local arch file |
---|
[2746] | 43 | arch_defined="TRUE" # and thus also set arch_defined to true |
---|
[1463] | 44 | ## try to recognise machine and infer arch from it |
---|
| 45 | machine=`hostname` |
---|
[3574] | 46 | if [[ "${machine:0:4}" == "jean" ]] |
---|
[1463] | 47 | then |
---|
[3574] | 48 | arch="X64_JEANZAY" |
---|
[1463] | 49 | fi |
---|
| 50 | if [[ "${machine:0:7}" == "platine" ]] |
---|
| 51 | then |
---|
| 52 | arch="IA64_PLATINE" |
---|
| 53 | fi |
---|
| 54 | if [[ "${machine:0:6}" == "titane" ]] |
---|
| 55 | then |
---|
| 56 | arch="X64_TITANE" |
---|
| 57 | fi |
---|
| 58 | if [[ "${machine:0:8}" == "mercure1" ]] |
---|
| 59 | then |
---|
| 60 | arch="SX8_MERCURE" |
---|
| 61 | fi |
---|
| 62 | if [[ "${machine:0:8}" == "mercure2" ]] |
---|
| 63 | then |
---|
| 64 | arch="SX9_MERCURE" |
---|
| 65 | fi |
---|
| 66 | |
---|
| 67 | LMDGCM=`pwd -P` |
---|
| 68 | LIBFGCM=$LMDGCM/libf |
---|
| 69 | LIBOGCM=$LMDGCM/libo |
---|
| 70 | if [[ ! -d $LIBOGCM ]] |
---|
| 71 | then |
---|
| 72 | # create the directory |
---|
| 73 | mkdir $LIBOGCM |
---|
| 74 | if [[ ! $? ]] |
---|
| 75 | then |
---|
| 76 | echo "Failed to create directory $LIBOGCM" |
---|
| 77 | exit |
---|
| 78 | fi |
---|
| 79 | fi |
---|
[3232] | 80 | #COSP_PATH=$LMDGCM/.void_dir |
---|
[1463] | 81 | |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | localdir=`pwd -P` |
---|
| 85 | ######################################################################## |
---|
| 86 | # Quelques initialisations de variables du shell. |
---|
| 87 | ######################################################################## |
---|
| 88 | |
---|
[3835] | 89 | CPP_KEY="IN_LMDZ" |
---|
[2239] | 90 | INCLUDE='-I$(LIBF)/grid -I$(LIBF)/misc -I$(LIBF)/filtrez -I. ' |
---|
[1463] | 91 | LIB="" |
---|
| 92 | adjnt="" |
---|
| 93 | ##COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
| 94 | PARA_FFLAGS="" |
---|
| 95 | PARA_LD="" |
---|
| 96 | EXT_SRC="" |
---|
[2238] | 97 | #src_dirs: directories containing source files |
---|
[2239] | 98 | src_dirs="grid misc" |
---|
[1463] | 99 | ######################################################################## |
---|
| 100 | # lecture des options |
---|
| 101 | ######################################################################## |
---|
| 102 | |
---|
| 103 | while (($# > 0)) |
---|
| 104 | do |
---|
| 105 | case $1 in |
---|
| 106 | "-h") cat <<fin |
---|
| 107 | Usage : |
---|
[1772] | 108 | makelmdz [options] -arch nom_arch exec |
---|
| 109 | [-h] : brief help |
---|
| 110 | [-d [[IMx]JMx]LM] : IM, JM, LM are the dimensions in x, y, z (default: $dim) |
---|
| 111 | [-p PHYS] : set of physical parametrizations (in libf/phyPHYS), (default: lmd) |
---|
| 112 | [-prod / -dev / -debug] : compilation mode production (default) / developement / debug |
---|
[4567] | 113 | [-c false/MPI1/OMCT] : coupling with ocean model : MPI1/OMCT/false (default: false) |
---|
[4283] | 114 | [-v false/orchideetrunk/orchidee2.1/orchidee2.0/orchidee1.9] : version of the vegetation model to include (default: false) |
---|
[1772] | 115 | false : no vegetation model |
---|
[4283] | 116 | orchideetrunk : compile using ORCHIDEE trunk from revision 7757 or higher |
---|
| 117 | orchidee2.1 : compile using ORCHIDEE 2.1 until 4.1 included or until revision 7757 on the trunk |
---|
[4567] | 118 | orchidee2.0 : compile using ORCHIDEE 2.0 |
---|
[1772] | 119 | orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
---|
| 120 | true : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6 |
---|
| 121 | [-chimie INCA/false] : with INCA chemistry model or without (default: false) |
---|
[2238] | 122 | [-cosp true/false] : compile with/without cosp package (default: false) |
---|
[3359] | 123 | [-cosp2 true/false] : compile with/without cosp2 package (default: false) |
---|
[3491] | 124 | [-cospv2 true/false] : compile with/without cospv2 package (default: false) |
---|
[3793] | 125 | [-inlandsis true/false] : compile with/without inlandsis package (default: false) |
---|
[2238] | 126 | [-rrtm true/false] : compile with/without rrtm package (default: false) |
---|
[4408] | 127 | [-rad oldrad/rrtm/ecrad] : compile with oldrad/rrtm/ecrad radiatif code (default: oldrad) |
---|
[4567] | 128 | [-dust true/false] : compile with/without the dust package by Boucher and co (default: false) |
---|
| 129 | [-strataer true/false] : compile with/without the strat aer package by Boucher and co (default: false) |
---|
[1772] | 130 | [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp |
---|
| 131 | [-g GRI] : grid configuration in dyn3d/GRI_xy.h (default: reg, inclues a zoom) |
---|
[2097] | 132 | [-io ioipsl/mix/xios] : Input/Output library (default: ioipsl) |
---|
[1772] | 133 | [-include INCLUDES] : extra include path to add |
---|
| 134 | [-cpp CPP_KEY] : additional preprocessing definitions |
---|
| 135 | [-adjnt] : adjoint model, not operational ... |
---|
[3997] | 136 | [-mem] : reduced memory dynamics (obsolete flag; always on in parallel mode) |
---|
[1772] | 137 | [-filtre NOMFILTRE] : use filtre from libf/NOMFILTRE (default: filtrez) |
---|
| 138 | [-link LINKS] : additional links with other libraries |
---|
[4567] | 139 | [-full] : full recompiling |
---|
[1772] | 140 | [-fcm_path path] : path to the fcm tool (default: tools/fcm/bin) |
---|
| 141 | [-ext_src path] : path to an additional set of routines to compile with the model |
---|
[2743] | 142 | [-arch_path path] : path to architecture files (default: $arch_default_path) |
---|
[1772] | 143 | -arch nom_arch : target architecture |
---|
| 144 | exec : executable to build |
---|
[1463] | 145 | fin |
---|
| 146 | exit;; |
---|
| 147 | "-d") |
---|
| 148 | dim=$2 ; shift ; shift ;; |
---|
| 149 | |
---|
| 150 | "-p") |
---|
| 151 | physique="$2" ; shift ; shift ;; |
---|
| 152 | |
---|
| 153 | "-g") |
---|
| 154 | grille="$2" ; shift ; shift ;; |
---|
| 155 | |
---|
| 156 | "-c") |
---|
| 157 | couple="$2" ; shift ; shift ;; |
---|
| 158 | |
---|
| 159 | "-prod") |
---|
| 160 | compil_mod="prod" ; shift ;; |
---|
| 161 | |
---|
| 162 | "-dev") |
---|
| 163 | compil_mod="dev" ; shift ;; |
---|
| 164 | |
---|
| 165 | "-debug") |
---|
| 166 | compil_mod="debug" ; shift ;; |
---|
| 167 | |
---|
| 168 | "-io") |
---|
| 169 | io="$2" ; shift ; shift ;; |
---|
| 170 | |
---|
| 171 | "-v") |
---|
| 172 | veget="$2" ; shift ; shift ;; |
---|
| 173 | |
---|
[4567] | 174 | "-inlandsis") |
---|
| 175 | inlandsis="$2" ; shift ; shift ;; |
---|
| 176 | |
---|
| 177 | "-rrtm") |
---|
| 178 | rrtm="$2" ; if [ "$2" = "false" ] ; then rad="oldrad" ; else rad="rrtm" ; fi ; shift ; shift ;; |
---|
| 179 | |
---|
| 180 | "-rad") |
---|
| 181 | rad="$2" ; shift ; shift ;; |
---|
| 182 | |
---|
| 183 | "-dust") |
---|
| 184 | dust="$2" ; shift ; shift ;; |
---|
| 185 | |
---|
| 186 | "-strataer") |
---|
| 187 | strataer="$2" ; shift ; shift ;; |
---|
| 188 | |
---|
[1463] | 189 | "-chimie") |
---|
| 190 | chimie="$2" ; shift ; shift ;; |
---|
| 191 | |
---|
| 192 | "-parallel") |
---|
| 193 | parallel="$2" ; shift ; shift ;; |
---|
| 194 | |
---|
| 195 | "-include") |
---|
| 196 | INCLUDE="$INCLUDE -I$2" ; shift ; shift ;; |
---|
| 197 | |
---|
| 198 | "-cpp") |
---|
| 199 | CPP_KEY="$CPP_KEY $2" ; shift ; shift ;; |
---|
| 200 | |
---|
| 201 | "-cosp") |
---|
| 202 | cosp="$2" ; shift ; shift ;; |
---|
[3359] | 203 | |
---|
| 204 | "-cosp2") |
---|
| 205 | cosp2="$2" ; shift ; shift ;; |
---|
[3491] | 206 | |
---|
[4567] | 207 | "-cospv2") |
---|
[3491] | 208 | cospv2="$2" ; shift ; shift ;; |
---|
[1690] | 209 | |
---|
| 210 | "-mem") |
---|
[3997] | 211 | echo "option -mem is obsolete (now always on in parallel)" |
---|
[1690] | 212 | paramem="mem" ; shift ;; |
---|
[1463] | 213 | |
---|
| 214 | "-filtre") |
---|
| 215 | filtre=$2 ; shift ; shift ;; |
---|
| 216 | |
---|
| 217 | "-link") |
---|
| 218 | LIB="$LIB $2" ; shift ; shift ;; |
---|
| 219 | |
---|
| 220 | "-fcm_path") |
---|
| 221 | fcm_path=$2 ; shift ; shift ;; |
---|
| 222 | |
---|
| 223 | "-ext_src") |
---|
[2238] | 224 | EXT_SRC=$2 ; src_dirs="$src_dirs $EXT_SRC" ; shift ; shift ;; |
---|
[1463] | 225 | |
---|
[4567] | 226 | "-full") |
---|
| 227 | full="full" ; shift ;; |
---|
| 228 | |
---|
[1463] | 229 | "-arch") |
---|
[2743] | 230 | arch=$2 ; arch_defined="TRUE" ; shift ; shift ;; |
---|
[1463] | 231 | |
---|
[2743] | 232 | "-arch_path") |
---|
| 233 | arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;; |
---|
| 234 | |
---|
[1463] | 235 | *) |
---|
| 236 | code="$1" ; shift ;; |
---|
| 237 | esac |
---|
| 238 | done |
---|
| 239 | |
---|
| 240 | ############################################################### |
---|
[2098] | 241 | # lecture des chemins propres \`a l'architecture de la machine # |
---|
[1463] | 242 | ############################################################### |
---|
| 243 | rm -f .void_file |
---|
| 244 | echo > .void_file |
---|
| 245 | rm -rf .void_dir |
---|
| 246 | mkdir .void_dir |
---|
[2743] | 247 | |
---|
| 248 | if [[ "$arch_defined" == "TRUE" ]] |
---|
[1463] | 249 | then |
---|
[2743] | 250 | rm -f arch.path |
---|
| 251 | rm -f arch.fcm |
---|
| 252 | rm -f arch.env |
---|
| 253 | |
---|
| 254 | if test -f $arch_path/arch-${arch}.path |
---|
| 255 | then |
---|
| 256 | ln -s $arch_path/arch-${arch}.path arch.path |
---|
| 257 | elif test -f $arch_default_path/arch-${arch}.path |
---|
| 258 | then |
---|
| 259 | ln -s $arch_default_path/arch-${arch}.path arch.path |
---|
| 260 | fi |
---|
| 261 | |
---|
| 262 | if test -f $arch_path/arch-${arch}.fcm |
---|
| 263 | then |
---|
| 264 | ln -s $arch_path/arch-${arch}.fcm arch.fcm |
---|
| 265 | elif test -f $arch_default_path/arch-${arch}.fcm |
---|
| 266 | then |
---|
| 267 | ln -s $arch_default_path/arch-${arch}.fcm arch.fcm |
---|
| 268 | fi |
---|
| 269 | |
---|
| 270 | if test -f $arch_path/arch-${arch}.env |
---|
| 271 | then |
---|
| 272 | ln -s $arch_path/arch-${arch}.env arch.env |
---|
| 273 | elif test -f $arch_default_path/arch-${arch}.env |
---|
| 274 | then |
---|
| 275 | ln -s $arch_default_path/arch-${arch}.env arch.env |
---|
| 276 | else |
---|
| 277 | ln -s .void_file arch.env |
---|
| 278 | fi |
---|
| 279 | # source architecture PATH and ENV files |
---|
| 280 | source arch.env |
---|
[1463] | 281 | source arch.path |
---|
| 282 | else |
---|
[2743] | 283 | echo "You must define a target architecture" |
---|
| 284 | exit 1 |
---|
[1463] | 285 | fi |
---|
[2743] | 286 | |
---|
[1463] | 287 | ######################################################################## |
---|
| 288 | # Definition des clefs CPP, des chemins des includes et modules |
---|
| 289 | # et des libraries |
---|
| 290 | ######################################################################## |
---|
| 291 | |
---|
| 292 | # basic compile flags from arch.fcm file |
---|
| 293 | archfileline=$( grep -i '^%BASE_FFLAGS' arch.fcm ) |
---|
| 294 | COMPIL_FFLAGS=$( echo ${archfileline##%BASE_FFLAGS} ) |
---|
| 295 | |
---|
| 296 | # other compile flags, depending on compilation mode |
---|
| 297 | if [[ "$compil_mod" == "prod" ]] |
---|
| 298 | then |
---|
| 299 | ## read COMPIL_FFLAGS from arch.fcm file |
---|
| 300 | archfileline=$( grep -i '^%PROD_FFLAGS' arch.fcm ) |
---|
| 301 | archfileopt=$( echo ${archfileline##%PROD_FFLAGS} ) |
---|
| 302 | COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}" |
---|
| 303 | elif [[ "$compil_mod" == "dev" ]] |
---|
| 304 | then |
---|
| 305 | ## read %DEV_FFLAGS from arch.fcm file |
---|
| 306 | archfileline=$( grep -i '^%DEV_FFLAGS' arch.fcm ) |
---|
| 307 | archfileopt=$( echo ${archfileline##%DEV_FFLAGS} ) |
---|
| 308 | COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}" |
---|
| 309 | elif [[ "$compil_mod" == "debug" ]] |
---|
| 310 | then |
---|
| 311 | ## read %DEBUG_FFLAGS from arch.fcm file |
---|
| 312 | archfileline=$( grep -i '^%DEBUG_FFLAGS' arch.fcm ) |
---|
| 313 | archfileopt=$( echo ${archfileline##%DEBUG_FFLAGS} ) |
---|
| 314 | COMPIL_FFLAGS="${COMPIL_FFLAGS} ${archfileopt}" |
---|
| 315 | fi |
---|
| 316 | |
---|
| 317 | # add CPP_KEY defined in arch.fcm file |
---|
| 318 | archfileline=$( grep -i '^%FPP_DEF' arch.fcm ) |
---|
| 319 | archfileopt=$( echo ${archfileline##%FPP_DEF} ) |
---|
| 320 | CPP_KEY="$CPP_KEY ${archfileopt}" |
---|
| 321 | |
---|
| 322 | # get compiler name from arch.fcm file |
---|
| 323 | archfileline=$( grep -i '^%COMPILER' arch.fcm ) |
---|
| 324 | fcompiler=$( echo ${archfileline##%COMPILER} ) |
---|
| 325 | |
---|
| 326 | # get linker name from arch.fcm file |
---|
| 327 | archfileline=$( grep -i '^%LINK' arch.fcm ) |
---|
| 328 | linker=$( echo ${archfileline##%LINK} ) |
---|
| 329 | |
---|
| 330 | # get ar command from arch.fcm file |
---|
[3045] | 331 | archfileline=$( grep -i '^%AR ' arch.fcm ) |
---|
[1463] | 332 | arcommand=$( echo ${archfileline##%AR} ) |
---|
| 333 | |
---|
[3045] | 334 | # get ar command options from arch.fcm file |
---|
| 335 | archfileline=$( grep -i '^%ARFLAGS' arch.fcm ) |
---|
[3051] | 336 | arflags=$( echo ${archfileline##%ARFLAGS} ) |
---|
[3045] | 337 | |
---|
[1463] | 338 | # get make utility from arch.fcm file |
---|
| 339 | archfileline=$( grep -i '^%MAKE' arch.fcm ) |
---|
| 340 | makecommand=$( echo ${archfileline##%MAKE} ) |
---|
| 341 | |
---|
| 342 | # get basic libraries to link with arch.fcm file |
---|
| 343 | archfileline=$( grep -i '^%BASE_LD' arch.fcm ) |
---|
| 344 | archfileopt=$( echo ${archfileline##%BASE_LD} ) |
---|
| 345 | LIB="$LIB ${archfileopt}" |
---|
| 346 | |
---|
[1873] | 347 | # add Include files defined in arch.fcm file for pre-processing |
---|
| 348 | archfileline=$( grep -i '^%FPP_FLAGS' arch.fcm ) |
---|
| 349 | for inc in $archfileline ; do INCLUDE="$INCLUDE `echo $inc | grep '\-I'`" ; done |
---|
| 350 | |
---|
[2250] | 351 | phys_root=$physique |
---|
| 352 | if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi |
---|
| 353 | if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi |
---|
| 354 | if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi |
---|
| 355 | if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi |
---|
| 356 | if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi |
---|
| 357 | if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi |
---|
| 358 | |
---|
[1463] | 359 | if [[ "$physique" != "nophys" ]] |
---|
| 360 | then |
---|
[1690] | 361 | #We'll use some physics |
---|
[2326] | 362 | src_dirs="$src_dirs phy_common phy$physique" |
---|
[2239] | 363 | LIBPHY='$(LIBO)/libphy'"$physique"'.a' |
---|
[2326] | 364 | LIBPHY_COMMON='$(LIBO)/libphy_common.a' |
---|
| 365 | lib_phy='-lphy'"$physique"' -lphy_common' |
---|
[1690] | 366 | CPP_KEY="$CPP_KEY CPP_PHYS" |
---|
[4567] | 367 | if [[ "${phys_root}" == "lmd" ]] |
---|
| 368 | then |
---|
| 369 | #For lmd physics, default planet type is Earth |
---|
| 370 | CPP_KEY="$CPP_KEY CPP_EARTH" |
---|
[1690] | 371 | fi |
---|
[1463] | 372 | fi |
---|
| 373 | |
---|
| 374 | if [[ "$chimie" == "INCA" ]] |
---|
| 375 | then |
---|
| 376 | CPP_KEY="$CPP_KEY INCA" |
---|
[4426] | 377 | INCLUDE="$INCLUDE ${INCA_INCDIR}" |
---|
| 378 | LIB="$LIB ${INCA_LIBDIR} ${INCA_LIB}" |
---|
| 379 | libchimie=" ${INCA_LIBDIR} ${INCA_LIB}" |
---|
[1463] | 380 | fi |
---|
| 381 | |
---|
| 382 | if [[ "$couple" != "false" ]] |
---|
| 383 | then |
---|
| 384 | CPP_KEY="$CPP_KEY CPP_COUPLE" |
---|
[4426] | 385 | INCLUDE="$INCLUDE ${OASIS_INCDIR}" |
---|
| 386 | LIB="$LIB ${OASIS_LIBDIR} ${OASIS_LIB}" |
---|
[1463] | 387 | fi |
---|
| 388 | |
---|
| 389 | if [[ "$parallel" == "none" ]] |
---|
| 390 | then |
---|
| 391 | FLAG_PARA='' |
---|
| 392 | else |
---|
[1810] | 393 | FLAG_PARA="$paramem" |
---|
[2202] | 394 | if [[ $paramem == par ]] |
---|
| 395 | then |
---|
| 396 | echo "The version of the dynamics in dyn3dpar is no longer updated." |
---|
| 397 | echo "You should use option \"-mem\"." |
---|
| 398 | exit 1 |
---|
[2238] | 399 | fi |
---|
[1463] | 400 | fi |
---|
| 401 | |
---|
| 402 | if [[ "$parallel" == "mpi" ]] |
---|
| 403 | then |
---|
| 404 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" |
---|
| 405 | # MPI additional compilation options |
---|
| 406 | archfileline=$( grep -i '^%MPI_FFLAGS' arch.fcm ) |
---|
| 407 | PARA_FFLAGS=$( echo ${archfileline##%MPI_FFLAGS} ) |
---|
| 408 | # MPI additional links |
---|
| 409 | archfileline=$( grep -i '^%MPI_LD' arch.fcm ) |
---|
| 410 | PARA_LD=$( echo ${archfileline##%MPI_LD} ) |
---|
| 411 | elif [[ "$parallel" == "omp" ]] |
---|
| 412 | then |
---|
| 413 | CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" |
---|
| 414 | # OMP additional compilation options |
---|
| 415 | archfileline=$( grep -i '^%OMP_FFLAGS' arch.fcm ) |
---|
| 416 | PARA_FFLAGS=$( echo ${archfileline##%OMP_FFLAGS} ) |
---|
| 417 | # OMP additional links |
---|
| 418 | archfileline=$( grep -i '^%OMP_LD' arch.fcm ) |
---|
| 419 | PARA_LD=$( echo ${archfileline##%OMP_LD} ) |
---|
| 420 | elif [[ "$parallel" == "mpi_omp" ]] |
---|
| 421 | then |
---|
| 422 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" |
---|
| 423 | # MPI additional compilation options |
---|
| 424 | archfileline=$( grep -i '^%MPI_FFLAGS' arch.fcm ) |
---|
| 425 | PARA_FFLAGS=$( echo ${archfileline##%MPI_FFLAGS} ) |
---|
| 426 | # OMP additional compilation options |
---|
| 427 | archfileline=$( grep -i '^%OMP_FFLAGS' arch.fcm ) |
---|
| 428 | PARA_FFLAGS="${PARA_FFLAGS} "$( echo $archfileopt ${archfileline##%OMP_FFLAGS} ) |
---|
| 429 | # MPI additional links |
---|
| 430 | archfileline=$( grep -i '^%MPI_LD' arch.fcm ) |
---|
| 431 | PARA_LD=$( echo ${archfileline##%MPI_LD} ) |
---|
| 432 | # OMP additional links |
---|
| 433 | archfileline=$( grep -i '^%OMP_LD' arch.fcm ) |
---|
| 434 | PARA_LD="${PARA_LD} "$( echo $archfileopt ${archfileline##%OMP_LD} ) |
---|
| 435 | fi |
---|
| 436 | |
---|
| 437 | if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ |
---|
| 438 | && "$compil_mod" == "debug" ]] |
---|
| 439 | then |
---|
| 440 | echo "Usually, parallelization with OpenMP requires some optimization." |
---|
| 441 | echo "We suggest switching to \"-dev\"." |
---|
| 442 | fi |
---|
| 443 | |
---|
[1810] | 444 | |
---|
| 445 | #============================================================================== |
---|
[4283] | 446 | if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" -o "$veget" = "orchideetrunk" ] |
---|
[1463] | 447 | then |
---|
[1810] | 448 | |
---|
[4426] | 449 | INCLUDE="${INCLUDE} ${ORCH_INCDIR}" |
---|
[1772] | 450 | CPP_KEY="$CPP_KEY CPP_VEGET" |
---|
[1810] | 451 | # temporary, for Orchidee versions 1.9.* (before openmp activation) |
---|
| 452 | if [[ "$veget" == "orchidee1.9" ]] ; then |
---|
| 453 | CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" |
---|
| 454 | fi |
---|
| 455 | if [[ "$veget" == "orchidee2.0" ]] ; then |
---|
[4426] | 456 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee" |
---|
[3435] | 457 | CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT" |
---|
| 458 | elif [[ "$veget" == "orchidee2.1" ]] ; then |
---|
[4283] | 459 | CPP_KEY="$CPP_KEY ORCHIDEE_NOLIC" |
---|
[4426] | 460 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee" |
---|
[4283] | 461 | elif [[ "$veget" == "orchideetrunk" ]] ; then |
---|
[4426] | 462 | orch_libs="-lorchidee" |
---|
[1810] | 463 | else |
---|
[4426] | 464 | orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob" |
---|
[1810] | 465 | fi |
---|
[4426] | 466 | LIB="${LIB} ${ORCH_LIBDIR} ${orch_libs}" |
---|
| 467 | # for lib in ${orch_libs} ; do |
---|
| 468 | # if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then |
---|
| 469 | # LIB="${LIB} -l${LIBPREFIX}$lib " |
---|
| 470 | # fi |
---|
| 471 | # done |
---|
[1810] | 472 | elif [[ "$veget" != "false" ]] ; then |
---|
[1772] | 473 | echo "Option -v $veget does not exist" |
---|
| 474 | echo "Use ./makelmdz -h for more information" |
---|
| 475 | exit |
---|
[1463] | 476 | fi |
---|
| 477 | |
---|
[4567] | 478 | if [[ "$inlandsis" == "true" ]] |
---|
| 479 | then |
---|
| 480 | CPP_KEY="$CPP_KEY CPP_INLANDSIS" |
---|
| 481 | src_dirs="$src_dirs phy${physique}/inlandsis" |
---|
| 482 | fi |
---|
| 483 | |
---|
| 484 | |
---|
| 485 | if [[ "$rad" == "rrtm" ]] |
---|
| 486 | then |
---|
| 487 | CPP_KEY="$CPP_KEY CPP_RRTM" |
---|
| 488 | src_dirs="$src_dirs phy${physique}/rrtm" |
---|
| 489 | fi |
---|
| 490 | if [[ "$rad" == "ecrad" ]] |
---|
| 491 | then |
---|
| 492 | CPP_KEY="$CPP_KEY CPP_ECRAD" |
---|
| 493 | src_dirs="$src_dirs phy${physique}/ecrad" |
---|
| 494 | fi |
---|
| 495 | |
---|
| 496 | if [[ "$dust" == "true" ]] |
---|
| 497 | then |
---|
| 498 | CPP_KEY="$CPP_KEY CPP_Dust" |
---|
| 499 | src_dirs="$src_dirs phy${physique}/Dust" |
---|
| 500 | fi |
---|
| 501 | |
---|
| 502 | if [[ "$strataer" == "true" ]] |
---|
| 503 | then |
---|
| 504 | CPP_KEY="$CPP_KEY CPP_StratAer" |
---|
| 505 | src_dirs="$src_dirs phy${physique}/StratAer" |
---|
| 506 | fi |
---|
| 507 | |
---|
[1810] | 508 | #=============================================================================== |
---|
[4489] | 509 | INCLUDE="$INCLUDE ${NETCDF95_INCDIR}" |
---|
| 510 | LIB="$LIB ${NETCDF95_LIBDIR} -l${LIBPREFIX}netcdf95" |
---|
| 511 | |
---|
[1463] | 512 | if [[ $io == ioipsl ]] |
---|
| 513 | then |
---|
| 514 | CPP_KEY="$CPP_KEY CPP_IOIPSL" |
---|
[4426] | 515 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR}" |
---|
| 516 | LIB="$LIB ${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" |
---|
[2097] | 517 | elif [[ $io == mix ]] |
---|
[1897] | 518 | then |
---|
| 519 | # For now, xios implies also using ioipsl |
---|
| 520 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" |
---|
[4426] | 521 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" |
---|
| 522 | LIB="$LIB ${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl ${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++" |
---|
[2097] | 523 | elif [[ $io == xios ]] |
---|
| 524 | then |
---|
| 525 | # For now, xios implies also using ioipsl |
---|
| 526 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT" |
---|
[4426] | 527 | INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" |
---|
| 528 | LIB="$LIB ${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl ${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++" |
---|
[1463] | 529 | fi |
---|
| 530 | |
---|
| 531 | if [[ "$cosp" == "true" ]] |
---|
| 532 | then |
---|
| 533 | CPP_KEY="$CPP_KEY CPP_COSP" |
---|
[3232] | 534 | # COSP_PATH="$LIBFGCM/phylmd/cosp" |
---|
| 535 | src_dirs="$src_dirs phy${physique}/cosp" |
---|
[1463] | 536 | # LIB="${LIB} -l${LIBPREFIX}cosp" |
---|
[3232] | 537 | # opt_dep="$opt_dep cosp" |
---|
| 538 | # lcosp="-l${LIBPREFIX}cosp" |
---|
| 539 | INCLUDE="$INCLUDE"' -I$(LIBF)/'phy${physique}'/cosp' |
---|
[1463] | 540 | fi |
---|
| 541 | |
---|
[3359] | 542 | if [[ "$cosp2" == "true" ]] |
---|
| 543 | then |
---|
| 544 | CPP_KEY="$CPP_KEY CPP_COSP2" |
---|
| 545 | src_dirs="$src_dirs phy${physique}/cosp2" |
---|
| 546 | INCLUDE="$INCLUDE"' -I$(LIBF)/'phy${physique}'/cosp2' |
---|
| 547 | fi |
---|
| 548 | |
---|
[3491] | 549 | if [[ "$cospv2" == "true" ]] |
---|
| 550 | then |
---|
| 551 | CPP_KEY="$CPP_KEY CPP_COSPV2" |
---|
| 552 | src_dirs="$src_dirs phy${physique}/cospv2" |
---|
| 553 | INCLUDE="$INCLUDE"' -I$(LIBF)/'phy${physique}'/cospv2' |
---|
| 554 | fi |
---|
[3359] | 555 | |
---|
[3491] | 556 | |
---|
[3793] | 557 | |
---|
[3835] | 558 | #add new ocean skin modelisation to source dir by default |
---|
[2690] | 559 | |
---|
[3835] | 560 | src_dirs="$src_dirs phy${physique}/Ocean_skin" |
---|
| 561 | |
---|
| 562 | |
---|
[1551] | 563 | INCLUDE="$INCLUDE ${NETCDF_INCDIR}" |
---|
[4426] | 564 | LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}" |
---|
[1463] | 565 | |
---|
| 566 | ######################################################################## |
---|
| 567 | # calcul du nombre de dimensions |
---|
| 568 | ######################################################################## |
---|
| 569 | |
---|
| 570 | |
---|
| 571 | dim_full=$dim |
---|
| 572 | dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
| 573 | set $dim |
---|
| 574 | dimc=$# |
---|
| 575 | echo calcul de la dimension |
---|
| 576 | echo dim $dim |
---|
| 577 | echo dimc $dimc |
---|
| 578 | |
---|
| 579 | ######################################################################## |
---|
| 580 | # Gestion des dimensions du modele. |
---|
| 581 | # on cree ou remplace le fichier des dimensions |
---|
| 582 | ######################################################################## |
---|
| 583 | |
---|
[1695] | 584 | cd $LIBFGCM/grid |
---|
| 585 | if [[ -f dimensions.h ]] |
---|
| 586 | then |
---|
| 587 | echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs' |
---|
| 588 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
---|
| 589 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
---|
| 590 | echo vous pouvez continuer en repondant oui. |
---|
| 591 | echo "Voulez-vous vraiment continuer?" |
---|
[1755] | 592 | echo "" |
---|
| 593 | echo "WARNING: you are probably already compiling the model somewhere else." |
---|
| 594 | echo "Wait until the first compilation is finished before launching this one." |
---|
| 595 | echo "If you are sure that you are not compiling elsewhere, just answer " |
---|
| 596 | echo "yes (or 'oui') to the question below to proceed." |
---|
| 597 | echo "Do you wish to continue?" |
---|
[1695] | 598 | read reponse |
---|
[1755] | 599 | if [[ $reponse == "oui" || $reponse == "yes" ]] |
---|
[1695] | 600 | then |
---|
[1696] | 601 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
[1695] | 602 | else |
---|
| 603 | exit |
---|
| 604 | fi |
---|
| 605 | fi |
---|
| 606 | |
---|
[1463] | 607 | cd $LIBFGCM/grid/dimension |
---|
| 608 | ./makdim $dim |
---|
[2202] | 609 | if (($? != 0)) |
---|
| 610 | then |
---|
| 611 | exit 1 |
---|
| 612 | fi |
---|
| 613 | |
---|
[1463] | 614 | cat $LIBFGCM/grid/dimensions.h |
---|
| 615 | cd $LMDGCM |
---|
| 616 | |
---|
| 617 | ######################################################################## |
---|
| 618 | # Differentes dynamiques (3d, 2d, 1d) |
---|
| 619 | ######################################################################## |
---|
| 620 | |
---|
[1810] | 621 | if (( $dimc == 3 )) ; then |
---|
[2238] | 622 | src_dirs="$src_dirs $filtre dyn3d_common dyn3d${FLAG_PARA}" |
---|
[2239] | 623 | if [[ $physique != "nophys" ]] ; then |
---|
[2417] | 624 | src_dirs="$src_dirs dynphy_lonlat dynphy_lonlat/phy${phys_root}" |
---|
| 625 | libdyn_phy="-ldynphy_lonlat" |
---|
| 626 | LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a' |
---|
| 627 | INCLUDE="$INCLUDE "'-I$(LIBF)/dynphy_lonlat' |
---|
| 628 | INCLUDE="$INCLUDE "'-I$(LIBF)/dynphy_lonlat/'"phy${phys_root}" |
---|
[2239] | 629 | fi |
---|
[1810] | 630 | cd $LIBFGCM/grid |
---|
| 631 | \rm fxyprim.h |
---|
| 632 | cp -p fxy_${grille}.h fxyprim.h |
---|
[1463] | 633 | filtre="FILTRE=$filtre" |
---|
[2016] | 634 | INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} -I$(LIBF)/dyn3d_common ' |
---|
[1810] | 635 | elif (( $dimc == 2 )) ; then |
---|
[2239] | 636 | src_dirs="$src_dirs dyn2d" |
---|
[1810] | 637 | filtre="FILTRE= L_FILTRE= " |
---|
| 638 | INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d' |
---|
| 639 | elif (( $dimc == 1 )) ; then |
---|
[2239] | 640 | #src_dirs="$src_dirs dyn3d dyn3d_common filtrez" |
---|
| 641 | src_dirs="$src_dirs phy${physique}/dyn1d" |
---|
[2023] | 642 | CPP_KEY="$CPP_KEY CPP_1D" |
---|
[2239] | 643 | filtre="L_DYN= DYN= FILTRE= L_FILTRE= " |
---|
| 644 | #INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre |
---|
| 645 | INCLUDE="$INCLUDE "' -I$(LIBF)/phy'"$physique"'/dyn1d' |
---|
[1463] | 646 | else |
---|
[1810] | 647 | echo Dimension dimc=$dimc pas prevu ; exit |
---|
[1463] | 648 | fi |
---|
| 649 | |
---|
| 650 | cd $LMDGCM |
---|
| 651 | |
---|
[2112] | 652 | ######################################################################## |
---|
| 653 | # library directory name: |
---|
| 654 | ######################################################################## |
---|
[1463] | 655 | |
---|
[4186] | 656 | nomlib=`echo ${arch}_${physique}_${rad}_${dim_full}_${grille}_${compil_mod}_parall${parallel}_${CPP_KEY}_${FLAG_PARA} | sed -e 's/ //g' -e 's/-//g ' | sed -e 's/CPP_//g'` |
---|
[2112] | 657 | echo "Path to library: "$nomlib |
---|
| 658 | |
---|
[1463] | 659 | ######################################################################## |
---|
[2112] | 660 | # Cleanup for a full recompilation, if requested |
---|
| 661 | ######################################################################## |
---|
| 662 | |
---|
| 663 | if [[ $full == "full" ]] |
---|
| 664 | then |
---|
| 665 | # remove makefile and librairies |
---|
| 666 | echo "-full option: recompiling from scratch" |
---|
| 667 | \rm -f makefile |
---|
| 668 | \rm -rf "${LIBOGCM}/${nomlib}" |
---|
| 669 | fi |
---|
| 670 | |
---|
| 671 | ######################################################################## |
---|
[1463] | 672 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
| 673 | ######################################################################## |
---|
| 674 | ######################################################################## |
---|
| 675 | # c'est a dire dans 3 cas: |
---|
| 676 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
| 677 | # derniere creation du makefile |
---|
| 678 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
| 679 | # n'existe pas. |
---|
| 680 | # 3. Si le makefile n'existe pas. |
---|
| 681 | ######################################################################## |
---|
| 682 | cd $LMDGCM |
---|
[1810] | 683 | |
---|
[1463] | 684 | |
---|
[2238] | 685 | if [[ -r .makelmdz ]] |
---|
[1463] | 686 | then |
---|
[2238] | 687 | old_lmdz_configuration=$(cat .makelmdz ) |
---|
| 688 | else |
---|
| 689 | old_lmdz_configuration="" |
---|
| 690 | fi |
---|
| 691 | lmdz_configuration="$src_dirs" |
---|
| 692 | if [[ "$lmdz_configuration" != "$old_lmdz_configuration" ]] |
---|
| 693 | then |
---|
| 694 | configuration_change="true" |
---|
| 695 | else |
---|
| 696 | configuration_change="false" |
---|
| 697 | fi |
---|
| 698 | |
---|
[2250] | 699 | mkdir -p make_dir |
---|
| 700 | suf_make=`echo $src_dirs | sed -e 's/\//_/g' -e 's/ /_/g'` |
---|
| 701 | echo suf_make $suf_make |
---|
| 702 | |
---|
[4085] | 703 | ######################################################################## |
---|
| 704 | # (re)Creation du makefile |
---|
| 705 | ######################################################################## |
---|
| 706 | |
---|
| 707 | echo "Controle de la necessite de recreer le makefile" |
---|
[2250] | 708 | \rm tmp77 tmp90 |
---|
| 709 | for dir in $src_dirs ; do |
---|
[4085] | 710 | # On recupere la liste de tous les subroutine, use et include pour |
---|
| 711 | # vérifier que les dépendense n'ont pas changé et reconstuire le |
---|
| 712 | # makefile le cas échéant |
---|
| 713 | # On enleve tout apres ONLy et on met un "uniq" pour que ca ne recrée pas |
---|
| 714 | # le makefile si on se contente d'ajouter des lignes dans le ONLY |
---|
[4377] | 715 | exclude="replay automatic include" |
---|
[4085] | 716 | for str in subroutine "use " "include " ; do |
---|
[4377] | 717 | grep -i "$str" libf/$dir/*.[Fh] | sed -e "/$exclude/d" | cut -d\( -f1 | sed -e 's/[Oo][Nn][Ll][Yy].*.$//' | uniq >> tmp77 |
---|
| 718 | grep -i "$str" libf/$dir/*.F90 | sed -e "/$exclude/d" | cut -d\( -f1 | sed -e 's/[Oo][Nn][Ll][Yy].*.$//' | uniq >> tmp90 |
---|
[4085] | 719 | done |
---|
[2250] | 720 | done |
---|
| 721 | |
---|
| 722 | liste77=make_dir/liste_des_sources_f77_$suf_make |
---|
| 723 | liste90=make_dir/liste_des_sources_f90_$suf_make |
---|
| 724 | makefile=make_dir/makefile_$suf_make |
---|
| 725 | |
---|
[2269] | 726 | if [[ $configuration_change == "true" || ! ( -r $makefile ) || ! ( -r $liste90 ) || ! ( -r $liste77 ) || ` diff tmp77 $liste77 | wc -w ` -ne 0 || ` diff tmp90 $liste90 | wc -w ` -ne 0 ]] |
---|
[2238] | 727 | then |
---|
[1463] | 728 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
| 729 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
[2250] | 730 | diff $liste77 tmp77 |
---|
| 731 | diff $liste90 tmp90 |
---|
| 732 | \cp -f tmp77 $liste77 |
---|
| 733 | \cp -f tmp90 $liste90 |
---|
[2238] | 734 | echo "Recreating the makefile" |
---|
| 735 | echo "src_dirs: $src_dirs" |
---|
| 736 | ./create_make_gcm $src_dirs > tmp |
---|
[2250] | 737 | \mv -f tmp $makefile |
---|
[2238] | 738 | echo "New makefile created" |
---|
[4085] | 739 | else |
---|
| 740 | echo Pas besoin de recreer le makefile |
---|
[1463] | 741 | fi |
---|
| 742 | |
---|
[4085] | 743 | |
---|
[2250] | 744 | ln -sf $makefile makefile |
---|
[2238] | 745 | echo "$lmdz_configuration" > .makelmdz |
---|
| 746 | |
---|
[1463] | 747 | ################################################################# |
---|
| 748 | # Preparation de l'execution de la comande make |
---|
| 749 | ################################################################# |
---|
| 750 | |
---|
| 751 | source_code=${code}.F |
---|
[2239] | 752 | dirmain=dyn${dimc}d${FLAG_PARA} |
---|
[1463] | 753 | if [[ -r $LMDGCM/libf/dyn${dimc}d${FLAG_PARA}/${code}.F90 ]] |
---|
| 754 | then |
---|
| 755 | source_code=${code}.F90 |
---|
[2016] | 756 | elif [[ -r $LMDGCM/libf/phy$physique/${code}.F90 ]] ; then |
---|
[2239] | 757 | dirmain=phy$physique |
---|
[2016] | 758 | source_code=${code}.F90 |
---|
[2417] | 759 | elif [[ -r $LMDGCM/libf/dynphy_lonlat/phy$phys_root/${code}.F90 ]] ; then |
---|
| 760 | dirmain="dynphy_lonlat/phy${phys_root}" |
---|
[2239] | 761 | source_code=${code}.F90 |
---|
| 762 | elif [[ -r $LMDGCM/libf/phy$physique/dyn1d/${code}.F90 ]] ; then |
---|
| 763 | dirmain=phy$physique/dyn1d |
---|
| 764 | source_code=${code}.F90 |
---|
[1463] | 765 | fi |
---|
| 766 | |
---|
| 767 | if [[ ! -d "${LIBOGCM}/${nomlib}" ]] |
---|
| 768 | then |
---|
| 769 | mkdir ${LIBOGCM}/${nomlib} |
---|
| 770 | # check we indeed managed to create the directory |
---|
| 771 | if [[ ! $? ]] |
---|
| 772 | then |
---|
| 773 | echo "Error: could not create directory ${LIBOGCM}/${nomlib}" |
---|
| 774 | exit |
---|
| 775 | fi |
---|
| 776 | fi |
---|
| 777 | |
---|
| 778 | # where module files are created |
---|
| 779 | mod_loc_dir=$localdir |
---|
| 780 | |
---|
| 781 | if [[ "$physique" != "nophys" ]] |
---|
| 782 | then |
---|
| 783 | INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique" |
---|
| 784 | fi |
---|
[1810] | 785 | INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib} |
---|
[1463] | 786 | |
---|
| 787 | # ranlib utility (check it exists or else default to ls) |
---|
| 788 | if [[ `which ranlib > /dev/null 2>&1 ; echo $?` -eq 0 ]] |
---|
| 789 | then |
---|
| 790 | ranlib="ranlib" |
---|
| 791 | else |
---|
| 792 | ranlib="ls" |
---|
| 793 | fi |
---|
| 794 | |
---|
| 795 | # add CPP keys to COMPIL_FLAGS |
---|
| 796 | # (but first add -D before all CPP_KEY items) |
---|
| 797 | cpp_definitions=`echo $CPP_KEY | sed -e 's/[A-Za-z_=0-9]*/-D&/g'` |
---|
| 798 | # (but add a -WF,-D before all CPP_KEY items) => for xlf on Vargas |
---|
| 799 | if [[ "${fcompiler:0:3}" == "xlf" ]] |
---|
| 800 | then |
---|
| 801 | cpp_definitions=`echo $CPP_KEY | sed -e 's/[A-Za-z_=0-9]*/-WF,-D&/g'` |
---|
| 802 | fi |
---|
| 803 | COMPIL_FFLAGS="${COMPIL_FFLAGS} ${cpp_definitions}" |
---|
| 804 | |
---|
| 805 | ################################################################# |
---|
| 806 | # Execution du make |
---|
| 807 | ################################################################# |
---|
[4567] | 808 | set -v |
---|
[1463] | 809 | $makecommand RANLIB=$ranlib -f $LMDGCM/makefile \ |
---|
| 810 | OPTION_DEP="$opt_dep" OPTION_LINK="$LIB ${PARA_LD}" \ |
---|
| 811 | OPTIM90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \ |
---|
| 812 | OPTIMTRU90="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \ |
---|
| 813 | OPTIM="${COMPIL_FFLAGS} ${PARA_FFLAGS}" \ |
---|
| 814 | INCLUDE="$INCLUDE" \ |
---|
| 815 | $filtre \ |
---|
| 816 | LIBO=${LIBOGCM}/${nomlib} \ |
---|
| 817 | "PHYS=$physique" \ |
---|
[2239] | 818 | LIBPHY=${LIBPHY} \ |
---|
[2326] | 819 | LIBPHY_COMMON=${LIBPHY_COMMON} \ |
---|
[2239] | 820 | LIBDYN_PHYS=${LIBDYN_PHYS} \ |
---|
[1463] | 821 | DIM=$dimc \ |
---|
| 822 | FLAG_PARA=$FLAG_PARA \ |
---|
[2239] | 823 | L_PHY="$lib_phy" \ |
---|
| 824 | L_DYN_PHY="$libdyn_phy" \ |
---|
[1810] | 825 | L_ADJNT=$adjnt \ |
---|
[1463] | 826 | L_COSP="$lcosp" \ |
---|
[3359] | 827 | L_COSP2="$lcosp2" \ |
---|
[3491] | 828 | L_COSPV2="$lcospv2" \ |
---|
[1463] | 829 | L_CHIMIE="$libchimie" \ |
---|
| 830 | LOCAL_DIR="$localdir" \ |
---|
| 831 | F77="$fcompiler" \ |
---|
| 832 | F90="$fcompiler" \ |
---|
| 833 | OPLINK="$LIB" \ |
---|
| 834 | LINK="$linker" \ |
---|
| 835 | GCM="$LMDGCM" \ |
---|
| 836 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
| 837 | MOD_SUFFIX="mod" \ |
---|
| 838 | AR=$arcommand \ |
---|
[3051] | 839 | ARFLAGS="$arflags" \ |
---|
[2239] | 840 | DIRMAIN=$dirmain \ |
---|
[1463] | 841 | SOURCE=$source_code \ |
---|
| 842 | PROG=$code |
---|
| 843 | |
---|
[4567] | 844 | set +v |
---|
[1810] | 845 | |
---|
[1696] | 846 | if [[ -r $LIBFGCM/grid/dimensions.h ]] |
---|
[1463] | 847 | then |
---|
| 848 | # Cleanup: remove dimension.h file |
---|
[1696] | 849 | \rm -f $LIBFGCM/grid/dimensions.h |
---|
[1463] | 850 | fi |
---|