| 1 | #!/bin/csh |
|---|
| 2 | # |
|---|
| 3 | # $Header$ |
|---|
| 4 | # |
|---|
| 5 | #set verbose echo |
|---|
| 6 | ######################################################################## |
|---|
| 7 | # options par defaut pour la commande make |
|---|
| 8 | ######################################################################## |
|---|
| 9 | set dim="96x71x19" |
|---|
| 10 | set physique=lmd |
|---|
| 11 | set phys="PHYS=$physique" |
|---|
| 12 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. ' |
|---|
| 13 | set ntrac = 4 |
|---|
| 14 | set filtre=filtrez |
|---|
| 15 | set grille=reg |
|---|
| 16 | set couple=false |
|---|
| 17 | set veget=true |
|---|
| 18 | set chimie=false |
|---|
| 19 | set psmile=false |
|---|
| 20 | set parallel=false |
|---|
| 21 | set OPT_STACK='-Wf,-init stack=nan' |
|---|
| 22 | set OPT_STACK=' ' |
|---|
| 23 | set OPTIMI='-C debug -eC ' |
|---|
| 24 | set OPTIMI=' -ftrace ' |
|---|
| 25 | set OPT_LINUX='-O3' |
|---|
| 26 | set io=ioipsl |
|---|
| 27 | |
|---|
| 28 | set FC_LINUX=g95 |
|---|
| 29 | |
|---|
| 30 | ######################################################################## |
|---|
| 31 | # path a changer contenant les sources et les objets du modele |
|---|
| 32 | ######################################################################## |
|---|
| 33 | |
|---|
| 34 | ###### VERSION LMDZ.4 |
|---|
| 35 | #set LMDGCM=/workdir/p86cozic/INCA_dev/LMDZ4 |
|---|
| 36 | #setenv LIBOGCM $LMDGCM/libo |
|---|
| 37 | #set LMDGCM="`pwd`" |
|---|
| 38 | #setenv LIBOGCM $LMDGCM/libo |
|---|
| 39 | # |
|---|
| 40 | #setenv IOIPSLDIR /u/fairhead/modipsl_g95/lib |
|---|
| 41 | #setenv MODIPSLDIR /u/fairhead/modipsl_g95/lib |
|---|
| 42 | #setenv NCDFINC "/u/fairhead/netcdf-3.6.0-p1/linux-g95/include/" |
|---|
| 43 | #setenv NCDFLIB "/u/fairhead/netcdf-3.6.0-p1/linux-g95/lib/" |
|---|
| 44 | |
|---|
| 45 | setenv localdir "`pwd`" |
|---|
| 46 | set MODIPSL=0 |
|---|
| 47 | echo $localdir | grep modipsl >& /dev/null |
|---|
| 48 | if ( ! $status ) then |
|---|
| 49 | set MODIPSL=1 |
|---|
| 50 | setenv LMDGCM $localdir |
|---|
| 51 | cd ../.. |
|---|
| 52 | setenv LIBOGCM "`pwd`/lib" |
|---|
| 53 | setenv IOIPSLDIR $LIBOGCM |
|---|
| 54 | setenv MODIPSLDIR $LIBOGCM |
|---|
| 55 | cd $localdir |
|---|
| 56 | if ( `hostname` == rhodes ) then |
|---|
| 57 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
|---|
| 58 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
|---|
| 59 | else |
|---|
| 60 | if ( `hostname` == nymphea0 ) then |
|---|
| 61 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
|---|
| 62 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
|---|
| 63 | else if ( `hostname` == mercure ) then |
|---|
| 64 | set NCDFINC=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
|---|
| 65 | set NCDFLIB=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
|---|
| 66 | else |
|---|
| 67 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
|---|
| 68 | endif |
|---|
| 69 | endif |
|---|
| 70 | else |
|---|
| 71 | if ( ! $?LMDGCM ) then |
|---|
| 72 | echo You must initialize the variable LMDGCM in your environnement |
|---|
| 73 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
|---|
| 74 | exit |
|---|
| 75 | endif |
|---|
| 76 | if ( ! $?LIBOGCM ) then |
|---|
| 77 | set LIBOGCM=$LMDGCM/libo |
|---|
| 78 | endif |
|---|
| 79 | if ( ! $?IOIPSLDIR ) then |
|---|
| 80 | echo You must initialize the variable IOIPSLDIR in your environnement |
|---|
| 81 | echo for instance: "setenv IOIPSLDIR /usr/myself/ioipsl" in .cshrc |
|---|
| 82 | exit |
|---|
| 83 | else |
|---|
| 84 | setenv MODIPSLDIR $IOIPSLDIR |
|---|
| 85 | endif |
|---|
| 86 | if ( ! $?NCDFLIB ) then |
|---|
| 87 | echo You must initialize the variable NCDFLIB in your environnement |
|---|
| 88 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
|---|
| 89 | exit |
|---|
| 90 | endif |
|---|
| 91 | if ( ! $?NCDFINC ) then |
|---|
| 92 | echo You must initialize the variable NCDFINC in your environnement |
|---|
| 93 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
|---|
| 94 | exit |
|---|
| 95 | endif |
|---|
| 96 | endif |
|---|
| 97 | set model=$LMDGCM |
|---|
| 98 | set libo=$LIBOGCM |
|---|
| 99 | |
|---|
| 100 | ######################################################################## |
|---|
| 101 | # Les differentes platformes reconnues |
|---|
| 102 | ######################################################################## |
|---|
| 103 | |
|---|
| 104 | set HP=0 |
|---|
| 105 | set IBM=0 |
|---|
| 106 | set SUN=0 |
|---|
| 107 | set VPP=0 |
|---|
| 108 | set CRAY=0 |
|---|
| 109 | set DEC=0 |
|---|
| 110 | set LINUX=0 |
|---|
| 111 | set NEC=0 |
|---|
| 112 | set XNEC=0 |
|---|
| 113 | set X6NEC=0 |
|---|
| 114 | if ( `uname` == HP-UX ) then |
|---|
| 115 | set machine=HP |
|---|
| 116 | set HP=1 |
|---|
| 117 | else if (`uname` == UNIX_System_V ) then |
|---|
| 118 | set machine=VPP |
|---|
| 119 | set VPP=1 |
|---|
| 120 | else if (`uname` == SunOS ) then |
|---|
| 121 | set machine=SUN |
|---|
| 122 | set SUN=1 |
|---|
| 123 | else if ( `uname` == AIX ) then |
|---|
| 124 | set machine=IBM |
|---|
| 125 | set IBM=1 |
|---|
| 126 | else if ( `uname` == OSF1 ) then |
|---|
| 127 | set machine=ALPHA |
|---|
| 128 | set DEC=1 |
|---|
| 129 | else if ( `uname` == Linux && `hostname` != mercure ) then |
|---|
| 130 | set machine=LINUX |
|---|
| 131 | set LINUX=1 |
|---|
| 132 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
|---|
| 133 | set machine=CRAY |
|---|
| 134 | set CRAY=1 |
|---|
| 135 | else if ( `uname` == SUPER-UX ) then |
|---|
| 136 | set machine=NEC |
|---|
| 137 | set NEC=1 |
|---|
| 138 | else if ( `hostname` == rhodes) then |
|---|
| 139 | set machine=XNEC |
|---|
| 140 | set XNEC=1 |
|---|
| 141 | else if ( `hostname` == mercure) then |
|---|
| 142 | set machine=X6NEC |
|---|
| 143 | set X6NEC=1 |
|---|
| 144 | else |
|---|
| 145 | echo Vous travaillez sur une machine non prevue par le reglement |
|---|
| 146 | exit |
|---|
| 147 | endif |
|---|
| 148 | |
|---|
| 149 | if ( ! -d $libo ) then |
|---|
| 150 | mkdir $libo |
|---|
| 151 | endif |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | if $VPP then |
|---|
| 155 | set netcdf=netcdf_v |
|---|
| 156 | else |
|---|
| 157 | set netcdf=netcdf |
|---|
| 158 | endif |
|---|
| 159 | ######################################################################## |
|---|
| 160 | # Quelques initialisations de variables du shell. |
|---|
| 161 | ######################################################################## |
|---|
| 162 | |
|---|
| 163 | set dyn= |
|---|
| 164 | set opt_link="" |
|---|
| 165 | set adjnt="" |
|---|
| 166 | set opt_dep="" |
|---|
| 167 | set libchimie="" |
|---|
| 168 | |
|---|
| 169 | set optim="" |
|---|
| 170 | set optimbis="" |
|---|
| 171 | set optim90="" |
|---|
| 172 | set oplink="" |
|---|
| 173 | |
|---|
| 174 | ######################################################################## |
|---|
| 175 | # Optimisations par defaut suivant les machines |
|---|
| 176 | ######################################################################## |
|---|
| 177 | |
|---|
| 178 | echo "Optimisations par defaut suivant les machines" |
|---|
| 179 | set libf=$model/libf |
|---|
| 180 | #setenv localdir "LOCAL_DIR=`pwd`" |
|---|
| 181 | #setenv localdir "`pwd`" |
|---|
| 182 | cd $model |
|---|
| 183 | ############# |
|---|
| 184 | if $CRAY then |
|---|
| 185 | ############# |
|---|
| 186 | # set optim="-Wf'-ei' -dp -Wf'-a static'" |
|---|
| 187 | set optimbis=" -DCRAY " |
|---|
| 188 | set optim90="-Wp'-P' -DCRAY -p$IOIPSLDIR "'-p$(LIBO) -eiv ' |
|---|
| 189 | set optim="$optim90" |
|---|
| 190 | set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -lioipsl -L$NCDFLIB -lnetcdf " |
|---|
| 191 | set mod_loc_dir=" " |
|---|
| 192 | set mod_suffix=" " |
|---|
| 193 | ################# |
|---|
| 194 | else if $SUN then |
|---|
| 195 | ################# |
|---|
| 196 | set optim=" -fast " |
|---|
| 197 | set optimbis=" " |
|---|
| 198 | set optim90=" -fast -fixed " |
|---|
| 199 | set optimtru90=" -fast -free " |
|---|
| 200 | set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -lioipsl -L$NCDFLIB -lnetcdf " |
|---|
| 201 | set mod_loc_dir=$localdir |
|---|
| 202 | set mod_suffix=mod |
|---|
| 203 | ################# |
|---|
| 204 | else if $HP then |
|---|
| 205 | ################# |
|---|
| 206 | set optim=" +U77 -O +E1 " |
|---|
| 207 | set optimbis=" " |
|---|
| 208 | ################# |
|---|
| 209 | else if $IBM then |
|---|
| 210 | ################# |
|---|
| 211 | set optim=" -O3 -qtune=pwr2 -qarch=pwr2" |
|---|
| 212 | set optimbis=" " |
|---|
| 213 | ################# |
|---|
| 214 | else if $VPP then |
|---|
| 215 | ################# |
|---|
| 216 | # set optim="-Dasuxm -On, -g -Ad -Potilax -Eciplume -Si" |
|---|
| 217 | # set optimbis=" -Wv,-m3 -Wp,-DVPP -Z $LMDGCM/listage" |
|---|
| 218 | set optimbis=" -Wp,-DNC_DOUBLE -Ad -Z $LMDGCM/listage -X9" |
|---|
| 219 | set optim90="$optim $optimbis -X9 -w" |
|---|
| 220 | set mod_loc_dir=$MODIPSLDIR |
|---|
| 221 | set mod_suffix=mod |
|---|
| 222 | ################# |
|---|
| 223 | else if $DEC then |
|---|
| 224 | ################# |
|---|
| 225 | set optim=" " |
|---|
| 226 | set optimbis=" " |
|---|
| 227 | ################# |
|---|
| 228 | else if $LINUX then |
|---|
| 229 | ################# |
|---|
| 230 | if ( $FC_LINUX == "pgf90" ) then |
|---|
| 231 | set optim="-fast " |
|---|
| 232 | set optim90=" -fast " |
|---|
| 233 | # set optimtru90=" -fast -c -Mfree -module $MODIPSLDIR " |
|---|
| 234 | set optimtru90=" -fast -c -Mfree " |
|---|
| 235 | else if ( $FC_LINUX == 'g95' ) then |
|---|
| 236 | set optim=" $OPT_LINUX -fno-second-underscore -ffixed-form -fstatic " |
|---|
| 237 | set optim90=" $OPT_LINUX -fno-second-underscore -ffixed-form -fstatic " |
|---|
| 238 | set optimtru90=" $OPT_LINUX -fno-second-underscore -ffree-form -fstatic " |
|---|
| 239 | else |
|---|
| 240 | echo 'compilateur linux non reconnu' |
|---|
| 241 | exit |
|---|
| 242 | endif |
|---|
| 243 | set mod_loc_dir=$MODIPSLDIR |
|---|
| 244 | set mod_suffix=mod |
|---|
| 245 | ################# |
|---|
| 246 | else if $NEC then |
|---|
| 247 | ################# |
|---|
| 248 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
|---|
| 249 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
|---|
| 250 | set optim="$optim90" |
|---|
| 251 | set optimbis=" " |
|---|
| 252 | set opt_link=" -C hopt -float0 -ew -P static -L$MODIPSLDIR -lioipsl $NCDFLIB -lnetcdf_i8r8_v " |
|---|
| 253 | set mod_loc_dir="." |
|---|
| 254 | set mod_suffix="mod" |
|---|
| 255 | ################# |
|---|
| 256 | else if $XNEC then |
|---|
| 257 | ################# |
|---|
| 258 | set optdbl='-dw -Wf\"-A dbl4\"' |
|---|
| 259 | set optim90=' -clear -float0 -f3 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
|---|
| 260 | set optimtru90=' -clear -f4 -float0 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"' |
|---|
| 261 | set optim="$optim90" |
|---|
| 262 | set optimbis=" " |
|---|
| 263 | set mod_suffix="mod" |
|---|
| 264 | set mod_loc_dir="./" |
|---|
| 265 | ################# |
|---|
| 266 | else if $X6NEC then |
|---|
| 267 | ################# |
|---|
| 268 | set optdbl='-dw -Wf\"-A dbl4\"' |
|---|
| 269 | set optim90=' -clear -float0 -f3 -size_t64 -P stack -Wf "-init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
|---|
| 270 | set optimtru90=' -clear -f4 -float0 -size_t64 -P stack -Wf "-init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"' |
|---|
| 271 | set optim="$optim90" |
|---|
| 272 | set optimbis=" " |
|---|
| 273 | set mod_suffix="mod" |
|---|
| 274 | set mod_loc_dir="./" |
|---|
| 275 | else |
|---|
| 276 | set optim="" |
|---|
| 277 | set optimbis=" " |
|---|
| 278 | endif |
|---|
| 279 | |
|---|
| 280 | set nomlib=$machine |
|---|
| 281 | |
|---|
| 282 | ######################################################################## |
|---|
| 283 | # lecture des options de mymake |
|---|
| 284 | ######################################################################## |
|---|
| 285 | |
|---|
| 286 | top: |
|---|
| 287 | if ($#argv > 0) then |
|---|
| 288 | switch ($1:q) |
|---|
| 289 | |
|---|
| 290 | case -h: |
|---|
| 291 | |
|---|
| 292 | ######################################################################## |
|---|
| 293 | # Manuel en ligne |
|---|
| 294 | ######################################################################## |
|---|
| 295 | more <<eod |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | makegcm [Options] prog |
|---|
| 299 | |
|---|
| 300 | |
|---|
| 301 | |
|---|
| 302 | |
|---|
| 303 | Par default, la commande makegcm: |
|---|
| 304 | --------------------------------- |
|---|
| 305 | |
|---|
| 306 | 1. compile une serie de sous programmes se trouvant dans des sous-repertoires |
|---|
| 307 | de $LMDGCM/libf. |
|---|
| 308 | Les sous programmes sont ensuite stokes sur dans des librairies FORTRAN |
|---|
| 309 | sur $LIBOGCM. |
|---|
| 310 | |
|---|
| 311 | 2. Ensuite, makegcm compile le programme prog.f se trouvant par default sur |
|---|
| 312 | $LMDGCM/libf/dyn3d et effectue le lien avec l ensemble des librairies. |
|---|
| 313 | |
|---|
| 314 | La variable '$LMDGCM' doit etre initialisee dans votre .cshrc ou en dur |
|---|
| 315 | dans la comande makegcm. |
|---|
| 316 | |
|---|
| 317 | La commande makegcm est faite pour permettre de gerer en parallele des |
|---|
| 318 | versions differentes du modele, compilees avec des options de compilation |
|---|
| 319 | et des dimensions differentes sans avoir a chaque fois a recompiler tout |
|---|
| 320 | le modele. |
|---|
| 321 | |
|---|
| 322 | Les librairies FORTRAN sont stoquees sur le directory $LIBOGCM. |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | OPTIONS: |
|---|
| 326 | -------- |
|---|
| 327 | |
|---|
| 328 | Les options suivantes peuvent etre definies soit par defaut en editant le |
|---|
| 329 | "script" makegcm, soit en interactif: |
|---|
| 330 | |
|---|
| 331 | -d imxjmxlm ou im, jm, et lm sont resp. le nombre de longitudes, latitudes |
|---|
| 332 | et couches verticales. |
|---|
| 333 | |
|---|
| 334 | -t ntrac selectionne le nombre de traceur advectes par la dynamique. |
|---|
| 335 | Dans les versions courantes du modele terrestre on a par exemple |
|---|
| 336 | ntrac=2 pour l'eau vapeur et liquide |
|---|
| 337 | |
|---|
| 338 | L'effet des options -d et -t est d'ecraser le fichier |
|---|
| 339 | $LMDGCM/libf/grid/dimensions.h |
|---|
| 340 | qui contient sous forme de 4 PARAMETER FORTRAN les 3 dimensions |
|---|
| 341 | de la grille horizontale im, jm, lm plus le nombre de traceurs |
|---|
| 342 | advectes passivement par la dynamique ntrac, par un nouveu fichier |
|---|
| 343 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
|---|
| 344 | Si ce fichier n'existe pas encore, il est cree par le script |
|---|
| 345 | $LMDGCM/libf/grid/dimension/makdim |
|---|
| 346 | |
|---|
| 347 | -p PHYS pour selectionner le jeu de parametrisations physiques avec |
|---|
| 348 | lequel on veut compiler le modele. |
|---|
| 349 | Le modele sera alors compile en prenant les sources des |
|---|
| 350 | parametrisations physiques dans le repertoire: |
|---|
| 351 | $LMDGCM/libf/phyPHYS |
|---|
| 352 | |
|---|
| 353 | -c false|true |
|---|
| 354 | pour selectionner le mode force (par defaut) ou couple |
|---|
| 355 | |
|---|
| 356 | -io ioipsl|noioipsl |
|---|
| 357 | pour selectionner le logiciel IO : IOIPSL par defaut |
|---|
| 358 | |
|---|
| 359 | -psmile false|true |
|---|
| 360 | pour selectionner le mode psmile ou non (par defaut) |
|---|
| 361 | |
|---|
| 362 | -parallel false|true |
|---|
| 363 | pour selectionner le mode parallele ou non (false par defaut) |
|---|
| 364 | |
|---|
| 365 | -v true|false |
|---|
| 366 | pour selectionner la vegetation (par defaut) ou non |
|---|
| 367 | |
|---|
| 368 | -chimie CH4|CH4_AER|NMHC|NMHC_AER|AER|GES|false |
|---|
| 369 | pour selectionner ou non la chimie (par defaut sans) |
|---|
| 370 | |
|---|
| 371 | -g grille selectionne le type de grille qu'on veut utiliser. |
|---|
| 372 | L'effet de cette option est d'ecraser le fichier |
|---|
| 373 | $LMDGCM/libf/grid/fxyprim.h |
|---|
| 374 | avec le fichier |
|---|
| 375 | $LMDGCM/libf/grid/fxy_grille.h |
|---|
| 376 | grille peut prendre les valeurs: |
|---|
| 377 | 1. reg pour la grille reguliere |
|---|
| 378 | 2. sin pour avoir des points equidistants en sinus de la latitude |
|---|
| 379 | 3. new pour pouvoir zoomer sur une partie du globe |
|---|
| 380 | |
|---|
| 381 | -O "optimisation fortran" ou les optimisations fortran sont les options de la |
|---|
| 382 | commande f77 |
|---|
| 383 | |
|---|
| 384 | -include path |
|---|
| 385 | Dans le cas ou on a dans des sous programmes des fichiers |
|---|
| 386 | #include (cpp) qui se trouve sur des repertoires non references |
|---|
| 387 | par defaut |
|---|
| 388 | |
|---|
| 389 | -adjnt Pour compiler la l'adjoint du code dynamique |
|---|
| 390 | |
|---|
| 391 | -filtre filtre |
|---|
| 392 | Pour choisir le filtre en longitude dans les regions polaires. |
|---|
| 393 | "filtre" correspond au nom d'un repertoire se trouvant sur |
|---|
| 394 | $LMDGCM/libf. Le filtre standard du modele est "filtrez" qui peut |
|---|
| 395 | etre utilise aussi bien pour une grille reguliere que pour une |
|---|
| 396 | grille zoomee en longitude. |
|---|
| 397 | |
|---|
| 398 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
|---|
| 399 | Pour rajouter un lien avec les librairies FORTRAN |
|---|
| 400 | libfile1.a, libfile2.a ... se trouvant respectivement sur les |
|---|
| 401 | repertoires dir1, dir2 ... |
|---|
| 402 | Si dirn est un repertoire dont le chemin est automatique (comme |
|---|
| 403 | par exemple /usr/lib ...) il n'est pas besoin de specifier -Ldirn. |
|---|
| 404 | |
|---|
| 405 | Auteur: Frederic Hourdin (hourdin@lmd.jussieu.fr) |
|---|
| 406 | eod |
|---|
| 407 | exit |
|---|
| 408 | |
|---|
| 409 | ######################################################################## |
|---|
| 410 | # Lecture des differentes options |
|---|
| 411 | ######################################################################## |
|---|
| 412 | |
|---|
| 413 | case -d: |
|---|
| 414 | set dim=$2 ; shift ; shift ; goto top |
|---|
| 415 | |
|---|
| 416 | case -O: |
|---|
| 417 | set optim="$2" ; shift ; shift ; goto top |
|---|
| 418 | |
|---|
| 419 | case -p |
|---|
| 420 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
|---|
| 421 | |
|---|
| 422 | case -g |
|---|
| 423 | set grille="$2" ; shift ; shift ; goto top |
|---|
| 424 | |
|---|
| 425 | case -c |
|---|
| 426 | set couple="$2" ; shift ; shift ; goto top |
|---|
| 427 | |
|---|
| 428 | case -io |
|---|
| 429 | set io="$2" ; shift ; shift ; goto top |
|---|
| 430 | |
|---|
| 431 | case -v |
|---|
| 432 | set veget="$2" ; shift ; shift ; goto top |
|---|
| 433 | |
|---|
| 434 | case -psmile |
|---|
| 435 | set psmile="$2" |
|---|
| 436 | if ( "$psmile" == 'true' ) then |
|---|
| 437 | set couple='true' |
|---|
| 438 | endif |
|---|
| 439 | shift ; shift ; goto top |
|---|
| 440 | |
|---|
| 441 | case -chimie |
|---|
| 442 | set chimie="$2" ; shift ; shift ; goto top |
|---|
| 443 | |
|---|
| 444 | case -parallel |
|---|
| 445 | set parallel="$2" ; shift ; shift ; goto top |
|---|
| 446 | |
|---|
| 447 | case -t |
|---|
| 448 | set ntrac=$2 ; shift ; shift ; goto top |
|---|
| 449 | |
|---|
| 450 | case -include |
|---|
| 451 | set include="$include -I$2" ; shift ; shift ; goto top |
|---|
| 452 | |
|---|
| 453 | case -adjnt |
|---|
| 454 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
|---|
| 455 | set optim="$optim -Dadj" ; shift ; goto top |
|---|
| 456 | |
|---|
| 457 | case -filtre |
|---|
| 458 | set filtre=$2 ; shift ; shift ; goto top |
|---|
| 459 | |
|---|
| 460 | case -link |
|---|
| 461 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
|---|
| 462 | |
|---|
| 463 | case -debug |
|---|
| 464 | if $HP then |
|---|
| 465 | set optim=" -g " |
|---|
| 466 | else if $SUN then |
|---|
| 467 | setenv PARALLEL 2 |
|---|
| 468 | # Il faut rajouter l'option -dalign a -g pour pouvoir editer les liens |
|---|
| 469 | # avec des programmes compiles avec -fast |
|---|
| 470 | set optim=" -g -dalign " |
|---|
| 471 | set optim90=" -fixed -g " |
|---|
| 472 | set optimtru90=" -free -g -C -dalign " |
|---|
| 473 | else if $CRAY then |
|---|
| 474 | set optim="$optim"" -g " |
|---|
| 475 | set optim90="$optim90"" -G1 " |
|---|
| 476 | else if $LINUX then |
|---|
| 477 | if ( $FC_LINUX == "pgf90" ) then |
|---|
| 478 | set optim="$optim"" -g -C -Mbounds " |
|---|
| 479 | set optim90="$optim90"" -g -C -Mbounds " |
|---|
| 480 | set optimtru90="$optimtru90"" -g -C -Mbounds " |
|---|
| 481 | else if ( $FC_LINUX == 'g95' ) then |
|---|
| 482 | set optim="$optim"" -g -fbounds-check " |
|---|
| 483 | set optim90="$optim90"" -g -fbounds-check " |
|---|
| 484 | set optimtru90="$optimtru90"" -g -fbounds-check " |
|---|
| 485 | else |
|---|
| 486 | echo 'compilateur linux non reconnu' |
|---|
| 487 | exit |
|---|
| 488 | endif |
|---|
| 489 | else |
|---|
| 490 | echo pas d option debug predefinie pour cette machine |
|---|
| 491 | exit |
|---|
| 492 | endif |
|---|
| 493 | shift ; goto top |
|---|
| 494 | |
|---|
| 495 | default |
|---|
| 496 | set code="$1" ; shift ; goto top |
|---|
| 497 | |
|---|
| 498 | endsw |
|---|
| 499 | endif |
|---|
| 500 | |
|---|
| 501 | ######################################################################## |
|---|
| 502 | # Definition des clefs CPP |
|---|
| 503 | ######################################################################## |
|---|
| 504 | |
|---|
| 505 | if ( $io == ioipsl ) then |
|---|
| 506 | set optim="$optim -DCPP_IOIPSL" |
|---|
| 507 | set optim90="$optim" |
|---|
| 508 | set optimtru90="$optimtru90 -DCPP_IOIPSL" |
|---|
| 509 | endif |
|---|
| 510 | |
|---|
| 511 | if ( "$physique" == 'nophys' ) then |
|---|
| 512 | set phys="L_PHY= LIBPHY=" |
|---|
| 513 | else |
|---|
| 514 | set optim="$optim -DCPP_PHYS" |
|---|
| 515 | set optim90="$optim" |
|---|
| 516 | set optimtru90="$optimtru90 -DCPP_PHYS" |
|---|
| 517 | endif |
|---|
| 518 | |
|---|
| 519 | set link_veget=" " |
|---|
| 520 | if ( "$veget" == 'true' ) then |
|---|
| 521 | set optim="$optim -DCPP_VEGET" |
|---|
| 522 | set optim90="$optim" |
|---|
| 523 | set optimtru90="$optimtru90 -DCPP_VEGET" |
|---|
| 524 | set link_veget=" -lsechiba -lparameters -lstomate" |
|---|
| 525 | if ( $XNEC ) then |
|---|
| 526 | set link_veget=" -lsxsechiba -lsxparameters -lsxstomate" |
|---|
| 527 | endif |
|---|
| 528 | endif |
|---|
| 529 | |
|---|
| 530 | if ( "$chimie" == 'CH4' ) then |
|---|
| 531 | set optim="$optim -DINCA -DINCA_CH4 " |
|---|
| 532 | set optim90="$optim" |
|---|
| 533 | else if ( "$chimie" == 'CH4_AER' ) then |
|---|
| 534 | set optim="$optim -DINCA -DINCA_CH4 -DINCA_AER" |
|---|
| 535 | set optim90="$optim" |
|---|
| 536 | else if ( "$chimie" == 'NMHC' ) then |
|---|
| 537 | set optim="$optim -DINCA -DINCA_NMHC " |
|---|
| 538 | set optim90="$optim" |
|---|
| 539 | else if ( "$chimie" == 'NMHC_AER' ) then |
|---|
| 540 | set optim="$optim -DINCA -DINCA_NMHC -DINCA_AER" |
|---|
| 541 | set optim90="$optim" |
|---|
| 542 | else if ( "$chimie" == 'AER' ) then |
|---|
| 543 | set optim="$optim -DINCA -DINCA_AER" |
|---|
| 544 | set optim90="$optim" |
|---|
| 545 | else if ("$chimie" == 'GES' ) then |
|---|
| 546 | set optim="$optim -DINCA" |
|---|
| 547 | set optim90="$optim" |
|---|
| 548 | endif |
|---|
| 549 | if ( "$chimie" == 'CH4' || "$chimie" == 'CH4_AER' || "$chimie" == 'NMHC' || "$chimie" == 'NMHC_AER' || "$chimie" == 'AER' || "$chimie" == 'GES' ) then |
|---|
| 550 | set opt_dep="$opt_dep chimie" |
|---|
| 551 | set libchimie="-lchimie" |
|---|
| 552 | if ( $XNEC || $X6NEC ) then |
|---|
| 553 | set libchimie="-lsxchimie" |
|---|
| 554 | endif |
|---|
| 555 | endif |
|---|
| 556 | |
|---|
| 557 | if ( "$couple" == 'true' ) then |
|---|
| 558 | set optim="$optim -DCPP_COUPLE" |
|---|
| 559 | set optim90="$optim90 -DCPP_COUPLE" |
|---|
| 560 | set optimtru90="$optimtru90 -DCPP_COUPLE" |
|---|
| 561 | endif |
|---|
| 562 | |
|---|
| 563 | if ( "$psmile" == 'true' ) then |
|---|
| 564 | set optim="$optim -DCPP_PSMILE" |
|---|
| 565 | set optim90="$optim90 -DCPP_PSMILE" |
|---|
| 566 | set optimtru90="$optimtru90 -DCPP_PSMILE" |
|---|
| 567 | endif |
|---|
| 568 | |
|---|
| 569 | if ( "$parallel" == 'true' ) then |
|---|
| 570 | set optim="$optim -DCPP_PARALLEL" |
|---|
| 571 | set optim90="$optim90 -DCPP_PARALLEL" |
|---|
| 572 | set optimtru90="$optimtru90 -DCPP_PARALLEL" |
|---|
| 573 | endif |
|---|
| 574 | |
|---|
| 575 | ######################################################################## |
|---|
| 576 | # cas special sans physique |
|---|
| 577 | ######################################################################## |
|---|
| 578 | if ( "$physique" == 'nophys' ) then |
|---|
| 579 | set phys="L_PHY= LIBPHY=" |
|---|
| 580 | endif |
|---|
| 581 | |
|---|
| 582 | ######################################################################## |
|---|
| 583 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
|---|
| 584 | # suivant la physique |
|---|
| 585 | ######################################################################## |
|---|
| 586 | |
|---|
| 587 | if ( $ntrac == 0 ) then |
|---|
| 588 | if ( "$physique" == 'nophys' ) then |
|---|
| 589 | set ntrac=1 |
|---|
| 590 | else if ( "$physique" == 'lmd' ) then |
|---|
| 591 | set ntrac=2 |
|---|
| 592 | else if ( "$physique" == 'lmd_test_li' ) then |
|---|
| 593 | set ntrac=2 |
|---|
| 594 | else if ( "$physique" == 'ec' ) then |
|---|
| 595 | set ntrac=1 |
|---|
| 596 | else |
|---|
| 597 | set ntrac = 1 |
|---|
| 598 | endif |
|---|
| 599 | endif |
|---|
| 600 | |
|---|
| 601 | ######################################################################## |
|---|
| 602 | #subtilites sur le nom de la librairie |
|---|
| 603 | ######################################################################## |
|---|
| 604 | |
|---|
| 605 | \rm -f tmp ; touch tmp |
|---|
| 606 | \rm -f tmp90 ; touch tmp90 |
|---|
| 607 | foreach i ( $optim ) |
|---|
| 608 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' >> tmp |
|---|
| 609 | end |
|---|
| 610 | set suf= |
|---|
| 611 | foreach i ( `sort tmp | uniq ` ) |
|---|
| 612 | set suf=$suf$i |
|---|
| 613 | end |
|---|
| 614 | if ( ! $IBM ) then |
|---|
| 615 | set nomlib="$nomlib$suf" |
|---|
| 616 | endif |
|---|
| 617 | if ( $DEC ) then |
|---|
| 618 | set nomlib=DEC |
|---|
| 619 | endif |
|---|
| 620 | if ( $IBM ) then |
|---|
| 621 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
|---|
| 622 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
|---|
| 623 | else if ( $SUN ) then |
|---|
| 624 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
|---|
| 625 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
|---|
| 626 | else |
|---|
| 627 | set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
|---|
| 628 | set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
|---|
| 629 | endif |
|---|
| 630 | set nomlib=${nomlib}${physique}_${dim_}_t${ntrac}_$grille |
|---|
| 631 | ## M-A-F nomlib trop long sur CRAY pour ar |
|---|
| 632 | if ( $CRAY ) then |
|---|
| 633 | set nomlib=F90_${dim_}_t${ntrac} |
|---|
| 634 | endif |
|---|
| 635 | if ( $NEC || $XNEC || $X6NEC) then |
|---|
| 636 | set nomlib=F90_${dim_}_t${ntrac} |
|---|
| 637 | endif |
|---|
| 638 | echo calcul de la dimension |
|---|
| 639 | set dimc=`echo $dim | wc -w` |
|---|
| 640 | |
|---|
| 641 | if ( "$dimc" == "2" ) then |
|---|
| 642 | set include="$include "'-I$(LIBF)/dyn2d ' |
|---|
| 643 | set dimh=$dim |
|---|
| 644 | else |
|---|
| 645 | set include="$include "'-I$(LIBF)/dyn3d ' |
|---|
| 646 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
|---|
| 647 | endif |
|---|
| 648 | echo $dimc |
|---|
| 649 | |
|---|
| 650 | ######################################################################## |
|---|
| 651 | # path pour les #include |
|---|
| 652 | ######################################################################## |
|---|
| 653 | |
|---|
| 654 | if ( $XNEC ) then |
|---|
| 655 | set include="$include -I$NCDFINC -I$IOIPSLDIR" |
|---|
| 656 | else |
|---|
| 657 | set include="$include -I$NCDFINC -I$IOIPSLDIR" |
|---|
| 658 | endif |
|---|
| 659 | echo $include |
|---|
| 660 | |
|---|
| 661 | ######################################################################## |
|---|
| 662 | # Gestion des dimensions du modele. |
|---|
| 663 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
|---|
| 664 | ######################################################################## |
|---|
| 665 | |
|---|
| 666 | cd $libf/grid |
|---|
| 667 | if ( -f dimensions.h ) then |
|---|
| 668 | echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs' |
|---|
| 669 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
|---|
| 670 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
|---|
| 671 | echo vous pouvez continuer en repondant oui. |
|---|
| 672 | echo "Voulez-vous vraiment continuer?" |
|---|
| 673 | if ( $< == "oui" ) then |
|---|
| 674 | \rm -f $libf/grid/dimensions.h |
|---|
| 675 | else |
|---|
| 676 | exit |
|---|
| 677 | endif |
|---|
| 678 | endif |
|---|
| 679 | |
|---|
| 680 | cd dimension |
|---|
| 681 | ./makdim $ntrac $dim |
|---|
| 682 | cat $libf/grid/dimensions.h |
|---|
| 683 | |
|---|
| 684 | cd $LMDGCM |
|---|
| 685 | set libo=$libo/$nomlib |
|---|
| 686 | if ( ! -d $libo ) then |
|---|
| 687 | mkdir $libo |
|---|
| 688 | cd $model |
|---|
| 689 | endif |
|---|
| 690 | |
|---|
| 691 | ######################################################################## |
|---|
| 692 | # Differentes dynamiques (3d, 2d, 1d) |
|---|
| 693 | ######################################################################## |
|---|
| 694 | |
|---|
| 695 | set dimension=`echo $dim | wc -w` |
|---|
| 696 | echo dimension $dimension |
|---|
| 697 | if ( $dimension == 1 ) then |
|---|
| 698 | echo pas de dynamique |
|---|
| 699 | set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
|---|
| 700 | endif |
|---|
| 701 | endif |
|---|
| 702 | cd $model |
|---|
| 703 | if ( $dimension == 3 ) then |
|---|
| 704 | cd libf/grid |
|---|
| 705 | \rm fxyprim.h |
|---|
| 706 | cp -p fxy_${grille}.h fxyprim.h |
|---|
| 707 | endif |
|---|
| 708 | |
|---|
| 709 | ###################################################################### |
|---|
| 710 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
|---|
| 711 | ###################################################################### |
|---|
| 712 | |
|---|
| 713 | if ( -f $libf/phy$physique/raddim.h ) then |
|---|
| 714 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
|---|
| 715 | \rm -f $libf/phy$physique/raddim.h |
|---|
| 716 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
|---|
| 717 | echo $libf/phy$physique/raddim.$dimh.h |
|---|
| 718 | cat $libf/phy$physique/raddim.$dimh.h |
|---|
| 719 | cat $libf/phy$physique/raddim.h |
|---|
| 720 | else |
|---|
| 721 | echo On peut diminuer la taille de l executable en creant |
|---|
| 722 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
|---|
| 723 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
|---|
| 724 | endif |
|---|
| 725 | endif |
|---|
| 726 | |
|---|
| 727 | ###################################################################### |
|---|
| 728 | # Gestion du filtre qui n'existe qu'en 3d. |
|---|
| 729 | ###################################################################### |
|---|
| 730 | |
|---|
| 731 | if ( `expr $dimc \> 2` == 1 ) then |
|---|
| 732 | set filtre="FILTRE=$filtre" |
|---|
| 733 | else |
|---|
| 734 | set filtre="FILTRE= L_FILTRE= " |
|---|
| 735 | endif |
|---|
| 736 | echo MACRO FILTRE $filtre |
|---|
| 737 | |
|---|
| 738 | echo $dimc |
|---|
| 739 | |
|---|
| 740 | ######################################################################## |
|---|
| 741 | # utilisation des vraies routines de couplage si on est en couple |
|---|
| 742 | ######################################################################## |
|---|
| 743 | if ( $couple == 'true' ) then |
|---|
| 744 | banner couple |
|---|
| 745 | pwd |
|---|
| 746 | if ( "$psmile" == 'true' ) then |
|---|
| 747 | if ( -f $libf/phy$physique/oasis.F ) then |
|---|
| 748 | \rm $libf/phy$physique/oasis.F |
|---|
| 749 | endif |
|---|
| 750 | if ( ! -f $libf/phy$physique/oasis.F90 ) then |
|---|
| 751 | \cp $libf/phy$physique/oasis.psmile $libf/phy$physique/oasis.F90 |
|---|
| 752 | endif |
|---|
| 753 | if ( `diff $libf/phy$physique/oasis.F90 $libf/phy$physique/oasis.psmile | wc -w` ) then |
|---|
| 754 | \cp $libf/phy$physique/oasis.psmile $libf/phy$physique/oasis.F90 |
|---|
| 755 | endif |
|---|
| 756 | else |
|---|
| 757 | if ( -f $libf/phy$physique/oasis.F90 ) then |
|---|
| 758 | \rm $libf/phy$physique/oasis.F90 |
|---|
| 759 | endif |
|---|
| 760 | if (! -f $libf/phy$physique/oasis.F ) then |
|---|
| 761 | \cp $libf/phy$physique/oasis.true $libf/phy$physique/oasis.F |
|---|
| 762 | else |
|---|
| 763 | if ( `diff $libf/phy$physique/oasis.F $libf/phy$physique/oasis.true | wc -w` ) then |
|---|
| 764 | # \cp $libf/phy$physique/oasis.F $libf/phy$physique/oasis.dummy |
|---|
| 765 | \cp $libf/phy$physique/oasis.true $libf/phy$physique/oasis.F |
|---|
| 766 | endif |
|---|
| 767 | endif |
|---|
| 768 | endif |
|---|
| 769 | else |
|---|
| 770 | if ( -f $libf/phy$physique/oasis.F90 ) then |
|---|
| 771 | \rm $libf/phy$physique/oasis.F90 |
|---|
| 772 | endif |
|---|
| 773 | if (! -f $libf/phy$physique/oasis.F ) then |
|---|
| 774 | \cp $libf/phy$physique/oasis.dummy $libf/phy$physique/oasis.F |
|---|
| 775 | else |
|---|
| 776 | if ( `diff $libf/phy$physique/oasis.F $libf/phy$physique/oasis.dummy | wc -w` ) then |
|---|
| 777 | \cp $libf/phy$physique/oasis.F $libf/phy$physique/oasis.true |
|---|
| 778 | \cp $libf/phy$physique/oasis.dummy $libf/phy$physique/oasis.F |
|---|
| 779 | endif |
|---|
| 780 | endif |
|---|
| 781 | endif |
|---|
| 782 | ######################################################################## |
|---|
| 783 | # Avant de lancer le make, on recree le makefile si necessaire |
|---|
| 784 | ######################################################################## |
|---|
| 785 | ######################################################################## |
|---|
| 786 | # c'est a dire dans 3 cas: |
|---|
| 787 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
|---|
| 788 | # derniere creation du makefile |
|---|
| 789 | # 2. si le fichier contenant cette liste "liste_des_sources" |
|---|
| 790 | # n'existe pas. |
|---|
| 791 | # 3. Si le makefile n'existe pas. |
|---|
| 792 | ######################################################################## |
|---|
| 793 | ########################################## |
|---|
| 794 | # On adapte d'abord certains include à F90 |
|---|
| 795 | ########################################## |
|---|
| 796 | sed -e 's/^c/\!/' $libf/grid/dimensions.h >! $libf/grid/dimensions90.tmp |
|---|
| 797 | if ( ! -f $libf/grid/dimensions90.h || `diff $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h | wc -w` ) then |
|---|
| 798 | \mv $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h |
|---|
| 799 | endif |
|---|
| 800 | awk 'BEGIN {} { sub ("^c","\!") ; if ($0 ~ /^ s/) {if (NR > 1) print p0," &"; sub (" s"," \\&")} else { if (NR > 1) print p0 } p0=$0 } END { print p0}' $libf/dyn3d/paramet.h >! $libf/dyn3d/paramet90.tmp |
|---|
| 801 | # sed -n -e 's/^c/\!/' -e '1 h' -e '2,$ H' -e '$ { x ; s/\n s/ \&\n \& /g ; p }' $libf/dyn3d/paramet.h >! $libf/dyn3d/paramet90.tmp |
|---|
| 802 | if ( ! -f $libf/dyn3d/paramet90.h || `diff $libf/dyn3d/paramet90.tmp $libf/dyn3d/paramet90.h | wc -w` ) then |
|---|
| 803 | \mv $libf/dyn3d/paramet90.tmp $libf/dyn3d/paramet90.h |
|---|
| 804 | endif |
|---|
| 805 | awk 'BEGIN {} { sub ("^c","\!") ; if ($0 ~ /^ \./) {if (NR > 1) print p0," &"; sub (" \."," \\&")} else { if (NR > 1) print p0 } p0=$0 } END { print p0}' $libf/dyn3d/control.h >! $libf/dyn3d/control.tmp |
|---|
| 806 | #sed -n -e 's/^c/\!/' -e '1 h' -e '2,$ H' -e '$ { x ; s/\n \./ \&\n \& /g ; p }' $libf/dyn3d/control.h >! $libf/dyn3d/control.tmp |
|---|
| 807 | if ( ! -f $libf/dyn3d/control.inc || `diff $libf/dyn3d/control.tmp $libf/dyn3d/control.inc | wc -w` ) then |
|---|
| 808 | \mv $libf/dyn3d/control.tmp $libf/dyn3d/control.inc |
|---|
| 809 | endif |
|---|
| 810 | awk 'BEGIN {} { sub ("^c","\!") ; if ($0 ~ /^ S/) {if (NR > 1) print p0," &"; sub (" S"," \\&")} else { if (NR > 1) print p0 } p0=$0 } END { print p0}' $libf/phylmd/YOMCST.h >! $libf/phylmd/YOMCST.tmp |
|---|
| 811 | if ( ! -f $libf/phylmd/YOMCST.inc || `diff $libf/phylmd/YOMCST.tmp $libf/phylmd/YOMCST.inc | wc -w` ) then |
|---|
| 812 | \mv $libf/phylmd/YOMCST.tmp $libf/phylmd/YOMCST.inc |
|---|
| 813 | endif |
|---|
| 814 | awk 'BEGIN {} { sub ("^c","\!") ; if ($0 ~ /^ S/) {if (NR > 1) print p0," &"; sub (" S"," \\&")} else { if (NR > 1) print p0 } p0=$0 } END { print p0}' $libf/phylmd/clesphys.h >! $libf/phylmd/clesphys.tmp |
|---|
| 815 | if ( ! -f $libf/phylmd/clesphys.inc || `diff $libf/phylmd/clesphys.tmp $libf/phylmd/clesphys.inc | wc -w` ) then |
|---|
| 816 | \mv $libf/phylmd/clesphys.tmp $libf/phylmd/clesphys.inc |
|---|
| 817 | endif |
|---|
| 818 | #sed -e 's/^c/\!/' $libf/dyn3dpar/paramet.h >! $libf/dyn3dpar/paramet90.h |
|---|
| 819 | ########################################## |
|---|
| 820 | cd $model |
|---|
| 821 | find libf -name '*.[Fh]' -print >! tmp77 |
|---|
| 822 | find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
|---|
| 823 | find libf -name '*.[Fh]90' -print >> tmp90 |
|---|
| 824 | |
|---|
| 825 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
|---|
| 826 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
|---|
| 827 | || ! -f makefile \ |
|---|
| 828 | || ! -f liste_des_sources_f90 \ |
|---|
| 829 | || ! -f liste_des_sources_f77 ) then |
|---|
| 830 | echo les fichiers suivants ont ete crees ou detruits |
|---|
| 831 | echo ou les fichiers suivants sont passes ou ne sont plus en Fortran 90 |
|---|
| 832 | diff liste_des_sources_f77 tmp77 |
|---|
| 833 | diff liste_des_sources_f90 tmp90 |
|---|
| 834 | \cp tmp77 liste_des_sources_f77 |
|---|
| 835 | \cp tmp90 liste_des_sources_f90 |
|---|
| 836 | echo On recree le makefile |
|---|
| 837 | ./create_make_gcm >! tmp |
|---|
| 838 | \mv tmp makefile |
|---|
| 839 | echo Nouveau makefile cree. |
|---|
| 840 | endif |
|---|
| 841 | |
|---|
| 842 | ######################################################################## |
|---|
| 843 | # Execution de la comande make |
|---|
| 844 | ######################################################################## |
|---|
| 845 | |
|---|
| 846 | echo PHYSIQUE $phys |
|---|
| 847 | echo dynamique $dyn $dimension |
|---|
| 848 | echo OPTIM="$optim" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
|---|
| 849 | echo PATH pour les fichiers INCLUDE $include |
|---|
| 850 | echo OPLINK="$oplink" |
|---|
| 851 | |
|---|
| 852 | ################# |
|---|
| 853 | if $HP then |
|---|
| 854 | ################# |
|---|
| 855 | set f77='fort77 +OP' |
|---|
| 856 | set f90='jensaisrien' |
|---|
| 857 | set opt_link="$opt_link -lm" |
|---|
| 858 | ################# |
|---|
| 859 | else if $VPP then |
|---|
| 860 | ################# |
|---|
| 861 | set f77=frt |
|---|
| 862 | set f90=$f77 |
|---|
| 863 | if ($couple == true) then |
|---|
| 864 | set opt_link="-Wg,-c $MODIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a" |
|---|
| 865 | set oplink="-Wl,-t,-P,-dy " |
|---|
| 866 | else |
|---|
| 867 | set opt_link="-Wg,-c -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a" |
|---|
| 868 | set oplink="-Wl,-t,-dy " |
|---|
| 869 | endif |
|---|
| 870 | if ($veget == true) then |
|---|
| 871 | set opt_link="$opt_link $link_veget -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a" |
|---|
| 872 | endif |
|---|
| 873 | ################# |
|---|
| 874 | else if $CRAY then |
|---|
| 875 | ################# |
|---|
| 876 | set f77=f90 |
|---|
| 877 | set f90=f90 |
|---|
| 878 | ################# |
|---|
| 879 | else if $LINUX then |
|---|
| 880 | ################# |
|---|
| 881 | # set f77=pgf90 |
|---|
| 882 | # set f90=pgf90 |
|---|
| 883 | set f77=$FC_LINUX |
|---|
| 884 | set f90=$FC_LINUX |
|---|
| 885 | if ( $FC_LINUX == 'pgf90' ) then |
|---|
| 886 | set opt_link=" -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/" |
|---|
| 887 | else if ($FC_LINUX == 'g95') then |
|---|
| 888 | set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lioipsl -lnetcdf " |
|---|
| 889 | else |
|---|
| 890 | set opt_link=" " |
|---|
| 891 | endif |
|---|
| 892 | ################# |
|---|
| 893 | else if $SUN then |
|---|
| 894 | ################# |
|---|
| 895 | set f77=f90 |
|---|
| 896 | set f90=f90 |
|---|
| 897 | set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf " |
|---|
| 898 | ################# |
|---|
| 899 | else if $NEC then |
|---|
| 900 | ################# |
|---|
| 901 | set f77=f90 -ftrace |
|---|
| 902 | set f90=f90 -ftrace |
|---|
| 903 | set opt_link="-L$MODIPSLDIR" |
|---|
| 904 | if ($veget == true) then |
|---|
| 905 | set opt_link="$opt_link $link_veget" |
|---|
| 906 | endif |
|---|
| 907 | if ($couple == true) then |
|---|
| 908 | set opt_link="$opt_link -lioipsl -loasis2.4_mpi2 -float0 -ew -P static $NCDFLIB " |
|---|
| 909 | else |
|---|
| 910 | set opt_link="$opt_link -L$MODIPSLDIR -lioipsl -float0 -ew -P static $NCDFLIB " |
|---|
| 911 | endif |
|---|
| 912 | set mod_loc_dir="./" |
|---|
| 913 | ################# |
|---|
| 914 | else if $XNEC then |
|---|
| 915 | ################# |
|---|
| 916 | set f77="sxmpif90 -ftrace" |
|---|
| 917 | set f90="sxmpif90 -ftrace" |
|---|
| 918 | if $MODIPSL then |
|---|
| 919 | set opt_link="-L$MODIPSLDIR" |
|---|
| 920 | if ($veget == true) then |
|---|
| 921 | set opt_link="$opt_link $link_veget" |
|---|
| 922 | endif |
|---|
| 923 | if ($couple == true) then |
|---|
| 924 | if ($psmile == true) then |
|---|
| 925 | set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB " |
|---|
| 926 | else |
|---|
| 927 | set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB " |
|---|
| 928 | endif |
|---|
| 929 | else |
|---|
| 930 | set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB " |
|---|
| 931 | endif |
|---|
| 932 | else |
|---|
| 933 | if ($couple == true) then |
|---|
| 934 | set opt_link="-L$MODIPSLDIR" |
|---|
| 935 | set opt_link="$opt_link $link_veget -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB " |
|---|
| 936 | else |
|---|
| 937 | set opt_link=" -C hopt -float0 $optdbl -P static -L$MODIPSLDIR $link_veget -lsxioipsl $NCDFLIB " |
|---|
| 938 | endif |
|---|
| 939 | endif |
|---|
| 940 | set mod_loc_dir="./" |
|---|
| 941 | ################## |
|---|
| 942 | else if $X6NEC then |
|---|
| 943 | ################## |
|---|
| 944 | set f77=sxmpif90 |
|---|
| 945 | set f90=sxmpif90 |
|---|
| 946 | if $MODIPSL then |
|---|
| 947 | set opt_link="-L$MODIPSLDIR" |
|---|
| 948 | if ($veget == true) then |
|---|
| 949 | set opt_link="$opt_link -lsxsechiba -lsxparameters -lsxstomate" |
|---|
| 950 | endif |
|---|
| 951 | if ($couple == true) then |
|---|
| 952 | if ($psmile == true) then |
|---|
| 953 | set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB " |
|---|
| 954 | else |
|---|
| 955 | set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 -size_t64 $optdbl -P static $NCDFLIB " |
|---|
| 956 | endif |
|---|
| 957 | else |
|---|
| 958 | set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB " |
|---|
| 959 | endif |
|---|
| 960 | else |
|---|
| 961 | # set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB " |
|---|
| 962 | set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB " |
|---|
| 963 | |
|---|
| 964 | endif |
|---|
| 965 | set mod_loc_dir="./" |
|---|
| 966 | ################# |
|---|
| 967 | else |
|---|
| 968 | ################# |
|---|
| 969 | set f77=f77 |
|---|
| 970 | set f90=f90 |
|---|
| 971 | endif |
|---|
| 972 | |
|---|
| 973 | cd $model |
|---|
| 974 | |
|---|
| 975 | if $VPP then |
|---|
| 976 | set make="gmake RANLIB=ls" |
|---|
| 977 | else if $CRAY then |
|---|
| 978 | set make="make RANLIB=ls" |
|---|
| 979 | else if $NEC then |
|---|
| 980 | set make="make RANLIB=ls" |
|---|
| 981 | else if $LINUX then |
|---|
| 982 | set make="make -k RANLIB=ranlib" |
|---|
| 983 | else if $XNEC then |
|---|
| 984 | set make="gmake RANLIB=ls" |
|---|
| 985 | else if $X6NEC then |
|---|
| 986 | set make="gmake RANLIB=ls" |
|---|
| 987 | else |
|---|
| 988 | set make="make RANLIB=ranlib" |
|---|
| 989 | endif |
|---|
| 990 | |
|---|
| 991 | |
|---|
| 992 | |
|---|
| 993 | |
|---|
| 994 | # |
|---|
| 995 | # etat0_netcdf a besoin d'info de la physique |
|---|
| 996 | # A revoir |
|---|
| 997 | set include="$include"' -I$(LIBF)/phy'"$physique" |
|---|
| 998 | # |
|---|
| 999 | # le programme principal create_limit a besoin de l'info du module |
|---|
| 1000 | # startvar: on met donc libo dans les include pour Nec |
|---|
| 1001 | set include="$include"' -I$(LIBO)' |
|---|
| 1002 | |
|---|
| 1003 | |
|---|
| 1004 | ################################################################# |
|---|
| 1005 | # Execution de la comande make... ENFIN! |
|---|
| 1006 | ################################################################# |
|---|
| 1007 | |
|---|
| 1008 | if $VPP then |
|---|
| 1009 | set optim90=" $optim90 -Am -M$libo" |
|---|
| 1010 | set optimtru90="$optim90" |
|---|
| 1011 | \cp $IOIPSLDIR/*.mod $libo |
|---|
| 1012 | else if $SUN then |
|---|
| 1013 | set optim90=" $optim90 -M$libo -M$MODIPSLDIR " |
|---|
| 1014 | set optimtru90=" $optimtru90 -M$libo -M$MODIPSLDIR " |
|---|
| 1015 | set optim="$optim90" |
|---|
| 1016 | \cp $IOIPSLDIR/*.mod $libo |
|---|
| 1017 | else if $NEC then |
|---|
| 1018 | set optim90=" $optim90 -I$libo " |
|---|
| 1019 | else if $XNEC then |
|---|
| 1020 | set optim90=" $optim90 -I$libo " |
|---|
| 1021 | set optimtru90=" $optimtru90 -I$libo " |
|---|
| 1022 | else if $X6NEC then |
|---|
| 1023 | set optim90=" $optim90 -I$libo " |
|---|
| 1024 | set optimtru90=" $optimtru90 -I$libo " |
|---|
| 1025 | else if $LINUX then |
|---|
| 1026 | if ( $FC_LINUX == "pgf90" ) then |
|---|
| 1027 | set optimtru90=" $optimtru90 -module $libo " |
|---|
| 1028 | set optim90=" $optim90 -module $libo " |
|---|
| 1029 | else if ( $FC_LINUX == 'g95' ) then |
|---|
| 1030 | set optimtru90=" $optimtru90 -fmod=$libo " |
|---|
| 1031 | set optim90=" $optim90 -fmod=$libo " |
|---|
| 1032 | endif |
|---|
| 1033 | set optim="$optim90" |
|---|
| 1034 | set mod_loc_dir=$libo |
|---|
| 1035 | \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo |
|---|
| 1036 | \cp $IOIPSLDIR/*.mod $libo |
|---|
| 1037 | endif |
|---|
| 1038 | |
|---|
| 1039 | set link="$f90 $optim90" |
|---|
| 1040 | |
|---|
| 1041 | set ar=ar |
|---|
| 1042 | |
|---|
| 1043 | if $XNEC then |
|---|
| 1044 | set link="sxld $opt_link" |
|---|
| 1045 | set link="$f90 " |
|---|
| 1046 | # set ar=sxar |
|---|
| 1047 | else if $X6NEC then |
|---|
| 1048 | set link="sxld $opt_link" |
|---|
| 1049 | set link="$f90 " |
|---|
| 1050 | endif |
|---|
| 1051 | |
|---|
| 1052 | |
|---|
| 1053 | cd $localdir |
|---|
| 1054 | |
|---|
| 1055 | echo $make -f $LMDGCM/makefile \ |
|---|
| 1056 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
|---|
| 1057 | OPTIM90="$optim90" \ |
|---|
| 1058 | OPTIMTRU90="$optimtru90" \ |
|---|
| 1059 | OPTIM="$optim$optimbis" \ |
|---|
| 1060 | INCLUDE="$include" \ |
|---|
| 1061 | $filtre \ |
|---|
| 1062 | LIBO=$libo \ |
|---|
| 1063 | $dyn \ |
|---|
| 1064 | $phys \ |
|---|
| 1065 | DIM=$dimc \ |
|---|
| 1066 | L_ADJNT="$adjnt" \ |
|---|
| 1067 | L_CHIMIE="$libchimie" \ |
|---|
| 1068 | LOCAL_DIR="$localdir" \ |
|---|
| 1069 | F77="$f77" \ |
|---|
| 1070 | F90="$f90" \ |
|---|
| 1071 | OPLINK="$oplink" \ |
|---|
| 1072 | LINK="$link" \ |
|---|
| 1073 | GCM="$LMDGCM" \ |
|---|
| 1074 | MOD_LOC_DIR=$mod_loc_dir \ |
|---|
| 1075 | MOD_SUFFIX=$mod_suffix \ |
|---|
| 1076 | AR=$ar \ |
|---|
| 1077 | PROG=$code |
|---|
| 1078 | |
|---|
| 1079 | $make -f $LMDGCM/makefile \ |
|---|
| 1080 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
|---|
| 1081 | OPTIM90="$optim90" \ |
|---|
| 1082 | OPTIMTRU90="$optimtru90" \ |
|---|
| 1083 | OPTIM="$optim$optimbis" \ |
|---|
| 1084 | INCLUDE="$include" \ |
|---|
| 1085 | $filtre \ |
|---|
| 1086 | LIBO=$libo \ |
|---|
| 1087 | $dyn \ |
|---|
| 1088 | $phys \ |
|---|
| 1089 | DIM=$dimc \ |
|---|
| 1090 | L_ADJNT="$adjnt" \ |
|---|
| 1091 | L_CHIMIE="$libchimie" \ |
|---|
| 1092 | LOCAL_DIR="$localdir" \ |
|---|
| 1093 | F77="$f77" \ |
|---|
| 1094 | F90="$f90" \ |
|---|
| 1095 | OPLINK="$oplink" \ |
|---|
| 1096 | LINK="$link" \ |
|---|
| 1097 | GCM="$LMDGCM" \ |
|---|
| 1098 | MOD_LOC_DIR=$mod_loc_dir \ |
|---|
| 1099 | MOD_SUFFIX=$mod_suffix \ |
|---|
| 1100 | AR=$ar \ |
|---|
| 1101 | PROG=$code |
|---|
| 1102 | |
|---|
| 1103 | \rm -f $libf/grid/dimensions.h |
|---|