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