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