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