1 | #!/bin/csh -f |
---|
2 | # $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $ |
---|
3 | #set verbose echo |
---|
4 | ######################################################################## |
---|
5 | # options par defaut pour la commande make |
---|
6 | ######################################################################## |
---|
7 | set dim="64x48x32" |
---|
8 | set physique=mars |
---|
9 | set phys="PHYS=$physique" |
---|
10 | set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. -I$(LIBF)/aeronomars' |
---|
11 | set ntrac = 1 |
---|
12 | set filtre=filtrez |
---|
13 | set grille=reg |
---|
14 | set dyntype="dyn" |
---|
15 | set full="" |
---|
16 | ######################################################################## |
---|
17 | # path a changer contenant les sources et les objets du modele |
---|
18 | ######################################################################## |
---|
19 | |
---|
20 | #### If you want you can set environment variables here (instead of |
---|
21 | #### relying on the C-shell environment variables) |
---|
22 | # default LMDGCM to where makegcm script is located: |
---|
23 | set scriptdir=`dirname $0` |
---|
24 | setenv LMDGCM `readlink -f $scriptdir` |
---|
25 | # You may set LIBOGCM to something else; otherwise we default to: |
---|
26 | setenv LIBOGCM $LMDGCM/libo |
---|
27 | ## NetCDF Libraries: what follows is OK for LMD 32 and 64bit Linux Machines |
---|
28 | #if ( `uname -m` == "x86_64" ) then |
---|
29 | # 64 bit machines |
---|
30 | setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_gfortran/lib |
---|
31 | setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_gfortran/include |
---|
32 | #else |
---|
33 | # setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_gfortran/lib |
---|
34 | # setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_gfortran/include |
---|
35 | #endif |
---|
36 | #### |
---|
37 | |
---|
38 | setenv localdir "`pwd`" |
---|
39 | set MODIPSL=0 |
---|
40 | echo $localdir | grep modipsl >& /dev/null |
---|
41 | if ( ! $status ) then |
---|
42 | set MODIPSL=1 |
---|
43 | setenv LMDGCM $localdir |
---|
44 | cd ../.. |
---|
45 | setenv LIBOGCM "`pwd`/lib" |
---|
46 | cd $localdir |
---|
47 | if ( `hostname` == rhodes ) then |
---|
48 | set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
49 | set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
50 | else |
---|
51 | if ( `hostname` == nymphea0 ) then |
---|
52 | set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"` |
---|
53 | set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'` |
---|
54 | else |
---|
55 | echo 'Probleme de definition des variables NCDFINC et NCDFLIB' |
---|
56 | endif |
---|
57 | endif |
---|
58 | else |
---|
59 | if ( ! $?LMDGCM ) then |
---|
60 | echo You must initialize the variable LMDGCM in your environnement |
---|
61 | echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc |
---|
62 | exit |
---|
63 | endif |
---|
64 | if ( ! $?LIBOGCM ) then |
---|
65 | set LIBOGCM=$LMDGCM/libo |
---|
66 | endif |
---|
67 | if ( ! $?NCDFLIB ) then |
---|
68 | echo You must initialize the variable NCDFLIB in your environnement |
---|
69 | echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc |
---|
70 | exit |
---|
71 | endif |
---|
72 | if ( ! $?NCDFINC ) then |
---|
73 | echo You must initialize the variable NCDFINC in your environnement |
---|
74 | echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc |
---|
75 | exit |
---|
76 | endif |
---|
77 | endif |
---|
78 | set model=$LMDGCM |
---|
79 | set libo=$LIBOGCM |
---|
80 | |
---|
81 | ######################################################################## |
---|
82 | # Les differentes platformes reconnues |
---|
83 | ######################################################################## |
---|
84 | |
---|
85 | set HP=0 |
---|
86 | set IBM=0 |
---|
87 | set SUN=0 |
---|
88 | set VPP=0 |
---|
89 | set CRAY=0 |
---|
90 | set DEC=0 |
---|
91 | set LINUX=0 |
---|
92 | set NEC=0 |
---|
93 | set XNEC=0 |
---|
94 | if ( `uname` == HP-UX ) then |
---|
95 | set machine=HP |
---|
96 | set HP=1 |
---|
97 | else if (`uname` == UNIX_System_V ) then |
---|
98 | set machine=VPP |
---|
99 | set VPP=1 |
---|
100 | else if (`uname` == SunOS ) then |
---|
101 | set machine=SUN |
---|
102 | set SUN=1 |
---|
103 | else if ( `uname` == AIX ) then |
---|
104 | set machine=IBM |
---|
105 | set IBM=1 |
---|
106 | else if ( `uname` == OSF1 ) then |
---|
107 | set machine=ALPHA |
---|
108 | set DEC=1 |
---|
109 | else if ( `uname` == Linux ) then |
---|
110 | set machine=LINUX |
---|
111 | set LINUX=1 |
---|
112 | else if ( `hostname` == atlas || `hostname` == axis || `hostname` == etoile ) then |
---|
113 | set machine=CRAY |
---|
114 | set CRAY=1 |
---|
115 | else if ( `uname` == SUPER-UX ) then |
---|
116 | set machine=NEC |
---|
117 | set NEC=1 |
---|
118 | else if ( `hostname` == rhodes) then |
---|
119 | set machine=XNEC |
---|
120 | set XNEC=1 |
---|
121 | else |
---|
122 | echo Vous travaillez sur une machine non prevue par le reglement |
---|
123 | exit |
---|
124 | endif |
---|
125 | |
---|
126 | # create $libo directory if it doesn't exist |
---|
127 | if ( ! -d $libo ) then |
---|
128 | mkdir $libo |
---|
129 | endif |
---|
130 | |
---|
131 | if $VPP then |
---|
132 | set netcdf=netcdf_v |
---|
133 | else |
---|
134 | set netcdf=netcdf |
---|
135 | endif |
---|
136 | ######################################################################## |
---|
137 | # Quelques initialisations de variables du shell. |
---|
138 | ######################################################################## |
---|
139 | |
---|
140 | set dyn= |
---|
141 | set opt_link="" |
---|
142 | set adjnt="" |
---|
143 | set opt_dep="" |
---|
144 | |
---|
145 | set optim90="" |
---|
146 | set oplink="" |
---|
147 | |
---|
148 | ######################################################################## |
---|
149 | # Optimisations par defaut suivant les machines |
---|
150 | ######################################################################## |
---|
151 | |
---|
152 | echo "Optimisations par defaut suivant les machines" |
---|
153 | set libf=$model/libf |
---|
154 | #setenv localdir "LOCAL_DIR=`pwd`" |
---|
155 | #setenv localdir "`pwd`" |
---|
156 | cd $model |
---|
157 | if $CRAY then |
---|
158 | set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv ' |
---|
159 | set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf " |
---|
160 | set mod_loc_dir=" " |
---|
161 | set mod_suffix=" " |
---|
162 | else if $SUN then |
---|
163 | set optim90=" -fast" |
---|
164 | set optimtru90=" -fast -free" |
---|
165 | set opt_link="-L$NCDFLIB -lnetcdf" |
---|
166 | set mod_loc_dir=$localdir |
---|
167 | set mod_suffix=mod |
---|
168 | else if $HP then |
---|
169 | else if $IBM then |
---|
170 | else if $VPP then |
---|
171 | set optim90="$optim -X9 -w" |
---|
172 | if $COUPLE then |
---|
173 | set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
174 | set oplink="-Wl,-t,-P,-dy " |
---|
175 | else |
---|
176 | set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl" |
---|
177 | set oplink="-Wl,-t,-dy " |
---|
178 | endif |
---|
179 | set mod_loc_dir=$IOIPSLDIR |
---|
180 | set mod_suffix=mod |
---|
181 | else if $DEC then |
---|
182 | else if $LINUX then |
---|
183 | # Ehouarn 'gfortran' compiler |
---|
184 | set optim="-O3 -funroll-loops " |
---|
185 | set optim90="-O3 -funroll-loops " |
---|
186 | set optimtru90="-O3 -funroll-loops " |
---|
187 | # |
---|
188 | set opt_link=" -L$NCDFLIB -lnetcdf " |
---|
189 | set mod_loc_dir=$localdir |
---|
190 | set mod_suffix=mod |
---|
191 | else if $NEC then |
---|
192 | set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
193 | set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "' |
---|
194 | ### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v " |
---|
195 | set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib -lnetcdf_i8r8 " |
---|
196 | set mod_loc_dir="." |
---|
197 | set mod_suffix="mod" |
---|
198 | else if $XNEC then |
---|
199 | set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
200 | set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "' |
---|
201 | if $MODIPSL then |
---|
202 | if $COUPLE then |
---|
203 | set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
204 | else |
---|
205 | set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB " |
---|
206 | endif |
---|
207 | set mod_loc_dir="./" |
---|
208 | else |
---|
209 | #### set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
210 | set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8" |
---|
211 | set mod_loc_dir="." |
---|
212 | endif |
---|
213 | set mod_suffix="mod" |
---|
214 | |
---|
215 | endif |
---|
216 | |
---|
217 | # Ehouarn: add 'g9fortran' string to pathname |
---|
218 | set nomlib=${machine}_gfortran |
---|
219 | |
---|
220 | # Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64) |
---|
221 | if (`uname` == Linux && `uname -m` == "x86_64") then |
---|
222 | set nomlib=${machine}64_gfortran |
---|
223 | endif |
---|
224 | |
---|
225 | ######################################################################## |
---|
226 | # lecture des options de mymake |
---|
227 | ######################################################################## |
---|
228 | |
---|
229 | top: |
---|
230 | if ($#argv > 0) then |
---|
231 | switch ($1:q) |
---|
232 | |
---|
233 | case -h: |
---|
234 | |
---|
235 | ######################################################################## |
---|
236 | # Manuel en ligne |
---|
237 | ######################################################################## |
---|
238 | more <<eod |
---|
239 | |
---|
240 | |
---|
241 | makegcm [Options] prog |
---|
242 | |
---|
243 | |
---|
244 | The makegcm script: |
---|
245 | ------------------- |
---|
246 | |
---|
247 | 1. compiles a series of subroutines located in the $LMDGCM/libf |
---|
248 | sub-directories. |
---|
249 | The objects are then stored in the libraries in $LIBOGCM. |
---|
250 | |
---|
251 | 2. then, makegcm compiles program prog.f located by default in |
---|
252 | $LMDGCM/libf/dyn3d and makes the link with the libraries. |
---|
253 | |
---|
254 | Environment Variables '$LMDGCM' and '$LIBOGCM' |
---|
255 | must be set as environment variables or directly |
---|
256 | in the makegcm file. |
---|
257 | |
---|
258 | The makegcm command is used to control the different versions of the model |
---|
259 | in parallel, compiled using the compilation options |
---|
260 | and the various dimensions, without having to recompile the whole model. |
---|
261 | |
---|
262 | The FORTRAN libraries are stored in directory $LIBOGCM. |
---|
263 | |
---|
264 | |
---|
265 | OPTIONS: |
---|
266 | -------- |
---|
267 | |
---|
268 | The following options can either be defined by default by editing the |
---|
269 | makegcm "script", or in interactive mode: |
---|
270 | |
---|
271 | -d imxjmxlm where im, jm, and lm are the number of longitudes, |
---|
272 | latitudes and vertical layers respectively. |
---|
273 | |
---|
274 | -t ntrac Selects the number of tracers present in the model |
---|
275 | |
---|
276 | Options -d and -t overwrite file |
---|
277 | $LMDGCM/libf/grid/dimensions.h |
---|
278 | which contains the 3 dimensions of the |
---|
279 | horizontal grid |
---|
280 | im, jm, lm plus the number of tracers passively advected |
---|
281 | by the dynamics ntrac, |
---|
282 | in 4 PARAMETER FORTRAN format |
---|
283 | with a new file: |
---|
284 | $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac |
---|
285 | If the file does not exist already |
---|
286 | it is created by the script |
---|
287 | $LMDGCM/libf/grid/dimension/makdim |
---|
288 | |
---|
289 | -p PHYS Selects the set of physical parameterizations |
---|
290 | you want to compile the model with. |
---|
291 | The model is then compiled using the physical |
---|
292 | parameterization sources in directory: |
---|
293 | $LMDGCM/libf/phyPHYS |
---|
294 | |
---|
295 | -g grille Selects the grid type. |
---|
296 | This option overwrites file |
---|
297 | $LMDGCM/libf/grid/fxyprim.h |
---|
298 | with file |
---|
299 | $LMDGCM/libf/grid/fxy_grille.h |
---|
300 | the grid can take the following values: |
---|
301 | 1. reg - the regular grid |
---|
302 | 2. sin - to obtain equidistant points in terms of sin(latitude) |
---|
303 | 3. new - to zoom into a part of the globe |
---|
304 | |
---|
305 | -O "compilation options" set of fortran compilation options to use |
---|
306 | |
---|
307 | -include path |
---|
308 | Used if the subroutines contain #include files (ccp) that |
---|
309 | are located in directories that are not referenced by default. |
---|
310 | |
---|
311 | -adjnt Compiles the adjoint model to the dynamical code. |
---|
312 | |
---|
313 | -olddyn To compile GCM with "old dynamics" |
---|
314 | |
---|
315 | -filtre filter |
---|
316 | To select the longitudinal filter in the polar regions. |
---|
317 | "filter" corresponds to the name of a directory located in |
---|
318 | $LMDGCM/libf. The standard filter for the model is "filtrez" |
---|
319 | which can be used for a regular grid and for a |
---|
320 | grid with longitudinal zoom. |
---|
321 | |
---|
322 | -link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..." |
---|
323 | Adds a link to FORTRAN libraries |
---|
324 | libfile1.a, libfile2.a ... |
---|
325 | located in directories dir1, dir2 ...respectively |
---|
326 | If dirn is a directory with an automatic path |
---|
327 | (/usr/lib ... for example) |
---|
328 | there is no need to specify -Ldirn. |
---|
329 | |
---|
330 | -full Full (re)compilation (from scratch) |
---|
331 | |
---|
332 | eod |
---|
333 | exit |
---|
334 | |
---|
335 | ######################################################################## |
---|
336 | # Lecture des differentes options |
---|
337 | ######################################################################## |
---|
338 | |
---|
339 | case -d: |
---|
340 | set dim=$2 ; shift ; shift ; goto top |
---|
341 | |
---|
342 | case -O: |
---|
343 | set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top |
---|
344 | |
---|
345 | case -p |
---|
346 | set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top |
---|
347 | |
---|
348 | case -g |
---|
349 | set grille="$2" ; shift ; shift ; goto top |
---|
350 | |
---|
351 | case -t |
---|
352 | set ntrac=$2 ; shift ; shift ; goto top |
---|
353 | |
---|
354 | case -include |
---|
355 | set include="$include -I$2" ; shift ; shift ; goto top |
---|
356 | |
---|
357 | case -adjnt |
---|
358 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
---|
359 | |
---|
360 | case -olddyn |
---|
361 | set dyntype="olddyn" ; shift; goto top |
---|
362 | |
---|
363 | case -full |
---|
364 | set full="full" ; shift ; goto top |
---|
365 | |
---|
366 | case -filtre |
---|
367 | set filtre=$2 ; shift ; shift ; goto top |
---|
368 | |
---|
369 | case -link |
---|
370 | set opt_link="$opt_link $2" ; shift ; shift ; goto top |
---|
371 | |
---|
372 | case -debug |
---|
373 | if $HP then |
---|
374 | set optim90=" -g " |
---|
375 | else if $SUN then |
---|
376 | setenv PARALLEL 4 |
---|
377 | set optim90=" -g -C " |
---|
378 | set optimtru90=" -g -C " |
---|
379 | else if $CRAY then |
---|
380 | set optim90="$optim90"" -G1 " |
---|
381 | else if $LINUX then |
---|
382 | ## for gfortran |
---|
383 | set optim="-g -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
384 | set optim90="-g -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
385 | set optimtru90="-g -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow" |
---|
386 | else |
---|
387 | echo "pas d option debug predefinie pour cette machine" |
---|
388 | exit |
---|
389 | endif |
---|
390 | shift ; goto top |
---|
391 | |
---|
392 | default |
---|
393 | set code="$1" ; shift ; goto top |
---|
394 | |
---|
395 | endsw |
---|
396 | endif |
---|
397 | |
---|
398 | echo "apres les opts dim $dim" |
---|
399 | |
---|
400 | ######################################################################## |
---|
401 | # cas special sans physique |
---|
402 | ######################################################################## |
---|
403 | if ( "$physique" == 'nophys' ) then |
---|
404 | set phys="L_PHY= LIBPHY=" |
---|
405 | endif |
---|
406 | |
---|
407 | ######################################################################## |
---|
408 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
---|
409 | # suivant la physique |
---|
410 | ######################################################################## |
---|
411 | |
---|
412 | if ( $ntrac == 0 ) then |
---|
413 | if ( "$physique" == 'nophys' ) then |
---|
414 | set ntrac=1 |
---|
415 | else if ( "$physique" == 'lmd' ) then |
---|
416 | set ntrac=2 |
---|
417 | else if ( "$physique" == 'lmd_test_li' ) then |
---|
418 | set ntrac=2 |
---|
419 | else if ( "$physique" == 'ec' ) then |
---|
420 | set ntrac=1 |
---|
421 | else |
---|
422 | set ntrac = 1 |
---|
423 | endif |
---|
424 | endif |
---|
425 | |
---|
426 | ######################################################################## |
---|
427 | #subtilites sur le nom de la librairie |
---|
428 | ######################################################################## |
---|
429 | |
---|
430 | \rm tmp ; touch tmp |
---|
431 | \rm tmp90 ; touch tmp90 |
---|
432 | foreach i ( $optim90 ) |
---|
433 | echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp |
---|
434 | end |
---|
435 | set suf= |
---|
436 | foreach i ( `sort tmp | uniq ` ) |
---|
437 | set suf=$suf$i |
---|
438 | end |
---|
439 | if ( ! $IBM ) then |
---|
440 | set nomlib="$nomlib$suf" |
---|
441 | endif |
---|
442 | if ( $DEC ) then |
---|
443 | set nomlib=DEC |
---|
444 | endif |
---|
445 | |
---|
446 | # dimension |
---|
447 | |
---|
448 | echo "dimension avant sed $dim" |
---|
449 | if ( $IBM ) then |
---|
450 | set dim=`echo $dim | sed -en 's/[^0-9]/ /g'` |
---|
451 | set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'` |
---|
452 | else if ( $SUN || $XNEC ) then |
---|
453 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
454 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
455 | else |
---|
456 | # set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'` |
---|
457 | # set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'` |
---|
458 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
---|
459 | set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'` |
---|
460 | endif |
---|
461 | |
---|
462 | # build final name of libraries directory: |
---|
463 | if ( "$dyntype" == "olddyn" ) then |
---|
464 | set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille}_olddyn |
---|
465 | else |
---|
466 | set nomlib=${nomlib}_${dim_}_t${ntrac}_${grille} |
---|
467 | endif |
---|
468 | |
---|
469 | # Append 'physique' type, if it is not mars, to nomlib |
---|
470 | if ( "$physique" != "mars" ) then |
---|
471 | set nomlib=${nomlib}_${physique} |
---|
472 | endif |
---|
473 | |
---|
474 | ## M-A-F nomlib trop long sur CRAY pour ar |
---|
475 | if ( $CRAY ) then |
---|
476 | set nomlib=F90_${dim_}_t${ntrac} |
---|
477 | endif |
---|
478 | if ( $NEC || $XNEC ) then |
---|
479 | set nomlib=F90_${dim_}_t${ntrac} |
---|
480 | endif |
---|
481 | |
---|
482 | echo "calcul de la dimension" |
---|
483 | set dimc=`echo $dim | wc -w` |
---|
484 | |
---|
485 | if ( "$dimc" == "2" ) then |
---|
486 | set include="$include "'-I$(LIBF)/dyn2d ' |
---|
487 | set dimh=$dim |
---|
488 | else |
---|
489 | if ( "$dyntype" == "olddyn" ) then |
---|
490 | set include="$include "'-I$(LIBF)/olddyn3d ' |
---|
491 | else |
---|
492 | set include="$include "'-I$(LIBF)/dyn3d ' |
---|
493 | endif |
---|
494 | set dimh=`echo $dim | awk ' { print $1 "." $2 } '` |
---|
495 | endif |
---|
496 | echo "dimc is $dimc" |
---|
497 | |
---|
498 | ######################################################################## |
---|
499 | # path pour les #include |
---|
500 | ######################################################################## |
---|
501 | |
---|
502 | set include="$include -I$NCDFINC " |
---|
503 | echo $include |
---|
504 | |
---|
505 | ######################################################################## |
---|
506 | # Gestion des dimensions du modele. |
---|
507 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
---|
508 | ######################################################################## |
---|
509 | |
---|
510 | cd $libf/grid |
---|
511 | if ( -f dimensions.h ) then |
---|
512 | echo "WARNING: you are probably already compiling the model (perhaps" |
---|
513 | echo " elsewhere). Wait until the first compilation ends before " |
---|
514 | echo " compiling a different configuration." |
---|
515 | echo "If you are sure that you are not already compiling, then you" |
---|
516 | echo " may continue this compilation by answering yes." |
---|
517 | echo "Do you want to continue?" |
---|
518 | if ( $< == "yes" ) then |
---|
519 | #remove old dimensions.h file |
---|
520 | \rm -f $libf/grid/dimensions.h |
---|
521 | else |
---|
522 | exit |
---|
523 | endif |
---|
524 | endif |
---|
525 | |
---|
526 | # Build the appropriate 'dimensions.h' file |
---|
527 | cd dimension |
---|
528 | ./makdim $dim |
---|
529 | # echo contents of dimensions.h to standard output |
---|
530 | cat $libf/grid/dimensions.h |
---|
531 | |
---|
532 | cd $LMDGCM |
---|
533 | # set path to objects directory |
---|
534 | set libo=$libo/$nomlib |
---|
535 | # create objects directory, if it doesn't exist |
---|
536 | if ( ! -d $libo ) then |
---|
537 | mkdir $libo |
---|
538 | cd $model |
---|
539 | endif |
---|
540 | |
---|
541 | ######################################################################## |
---|
542 | # Differentes dynamiques (3d, 2d, 1d) |
---|
543 | ######################################################################## |
---|
544 | |
---|
545 | set dimension=`echo $dim | wc -w` |
---|
546 | echo dimension $dimension dim $dim |
---|
547 | if ( $dimension == 1 ) then |
---|
548 | echo "No dynamics" |
---|
549 | ## set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
550 | ## NB: we still need to have L_DYN=libdyn3d to reach routines and module |
---|
551 | ## objects which are located in dyn3d |
---|
552 | set dyn="L_DYN=-ldyn3d DYN= L_FILTRE= DIRMAIN=phy$physique " |
---|
553 | endif |
---|
554 | endif |
---|
555 | |
---|
556 | cd $model |
---|
557 | if ( $dimension == 3 ) then |
---|
558 | cd libf/grid |
---|
559 | \rm fxyprim.h |
---|
560 | cp -p fxy_${grille}.h fxyprim.h |
---|
561 | endif |
---|
562 | |
---|
563 | ###################################################################### |
---|
564 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
---|
565 | ###################################################################### |
---|
566 | |
---|
567 | if ( -f $libf/phy$physique/raddim.h ) then |
---|
568 | if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
---|
569 | \rm $libf/phy$physique/raddim.h |
---|
570 | cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
---|
571 | echo $libf/phy$physique/raddim.$dimh.h |
---|
572 | cat $libf/phy$physique/raddim.$dimh.h |
---|
573 | cat $libf/phy$physique/raddim.h |
---|
574 | else |
---|
575 | echo On peut diminuer la taille de l executable en creant |
---|
576 | echo le fichier $libf/phy$physique/raddim.$dimh.h |
---|
577 | \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
---|
578 | endif |
---|
579 | endif |
---|
580 | |
---|
581 | ###################################################################### |
---|
582 | # Gestion du filtre qui n'existe qu'en 3d. |
---|
583 | ###################################################################### |
---|
584 | |
---|
585 | # set filtre to 'oldfiltrez' if using -olddyn option |
---|
586 | if ( "$dyntype" == "olddyn" ) then |
---|
587 | set filtre="oldfiltrez" |
---|
588 | endif |
---|
589 | |
---|
590 | if ( `expr $dimc \> 2` == 1 ) then |
---|
591 | set filtre="FILTRE=$filtre" |
---|
592 | else |
---|
593 | set filtre="FILTRE= L_FILTRE= " |
---|
594 | endif |
---|
595 | echo "MACRO FILTRE $filtre" |
---|
596 | |
---|
597 | echo "dimc $dimc" |
---|
598 | |
---|
599 | #cleanup for a full recompilation, if requested |
---|
600 | if ("$full" == "full") then |
---|
601 | # remove makefile and $libo |
---|
602 | cd $model |
---|
603 | \rm -f makefile |
---|
604 | \rm -rf $libo/* |
---|
605 | endif |
---|
606 | |
---|
607 | ######################################################################## |
---|
608 | # Avant de lancer le make, on recree le makefile si necessaire |
---|
609 | ######################################################################## |
---|
610 | # c'est a dire dans 3 cas: |
---|
611 | # 1. si la liste des fichiers .F et .h a ete modifiee depuis la |
---|
612 | # derniere creation du makefile |
---|
613 | # 2. si le fichier contenant cette liste "liste_des_sources" |
---|
614 | # n'existe pas. |
---|
615 | # 3. Si le makefile n'existe pas. |
---|
616 | ######################################################################## |
---|
617 | |
---|
618 | cd $model |
---|
619 | find libf -name '*.[Fh]' -print | sort >! tmp77 |
---|
620 | #find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90 |
---|
621 | find libf -name '*.[Fh]90' -print | sort >> tmp90 |
---|
622 | |
---|
623 | if ( `diff tmp77 liste_des_sources_f77 | wc -w` \ |
---|
624 | || `diff tmp90 liste_des_sources_f90 | wc -w` \ |
---|
625 | || ! -f makefile \ |
---|
626 | || ! -f liste_des_sources_f90 \ |
---|
627 | || ! -f liste_des_sources_f77 ) then |
---|
628 | echo "les fichiers suivants ont ete crees ou detruits" |
---|
629 | echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90" |
---|
630 | diff liste_des_sources_f77 tmp77 |
---|
631 | diff liste_des_sources_f90 tmp90 |
---|
632 | \cp tmp77 liste_des_sources_f77 |
---|
633 | \cp tmp90 liste_des_sources_f90 |
---|
634 | echo "On recree le makefile" |
---|
635 | if ("$dyntype" == "olddyn") then |
---|
636 | ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp |
---|
637 | else |
---|
638 | ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp |
---|
639 | endif |
---|
640 | \mv tmp makefile |
---|
641 | echo "Nouveau makefile cree." |
---|
642 | endif |
---|
643 | |
---|
644 | ######################################################################## |
---|
645 | # Execution de la comande make |
---|
646 | ######################################################################## |
---|
647 | |
---|
648 | echo PHYSIQUE $phys |
---|
649 | echo dynamique $dyn $dimension |
---|
650 | echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code |
---|
651 | echo PATH pour les fichiers INCLUDE $include |
---|
652 | echo OPLINK="$oplink" |
---|
653 | |
---|
654 | if $HP then |
---|
655 | set f77='fort77 +OP' |
---|
656 | set f90='jensaisrien' |
---|
657 | set opt_link="$opt_link -lm" |
---|
658 | else if $VPP then |
---|
659 | set f77=frt |
---|
660 | set f90=$f77 |
---|
661 | else if $CRAY then |
---|
662 | set f77=f90 |
---|
663 | set f90=f90 |
---|
664 | else if $LINUX then |
---|
665 | # set f77=pgf90 |
---|
666 | # set f90=pgf90 |
---|
667 | set f77=gfortran |
---|
668 | set f90=gfortran |
---|
669 | else if $SUN then |
---|
670 | set f77=f90 |
---|
671 | set f90=f90 |
---|
672 | else if $NEC then |
---|
673 | set f77=f90 |
---|
674 | set f90=f90 |
---|
675 | else if $XNEC then |
---|
676 | set f77=sxmpif90 |
---|
677 | set f90=sxmpif90 |
---|
678 | else |
---|
679 | set f77=f77 |
---|
680 | set f90=f90 |
---|
681 | endif |
---|
682 | |
---|
683 | cd $model |
---|
684 | |
---|
685 | if $VPP then |
---|
686 | set make="gmake RANLIB=ls" |
---|
687 | else if $CRAY then |
---|
688 | set make="make RANLIB=ls" |
---|
689 | else if $NEC then |
---|
690 | set make="make RANLIB=ls" |
---|
691 | else if $LINUX then |
---|
692 | set make="make -k RANLIB=ranlib" |
---|
693 | else if $XNEC then |
---|
694 | set make="/usr/local/bin/gmake RANLIB=ls" |
---|
695 | set make="/usr/freeware/bin/gmake RANLIB=ls" |
---|
696 | else |
---|
697 | set make="make RANLIB=ranlib" |
---|
698 | endif |
---|
699 | |
---|
700 | set include="$include"" -I$libf/phy$physique" |
---|
701 | |
---|
702 | |
---|
703 | ################################################################# |
---|
704 | # Execution de la comande make... ENFIN! |
---|
705 | ################################################################# |
---|
706 | |
---|
707 | if $VPP then |
---|
708 | set optim90=" $optim90 -Am -M$libo" |
---|
709 | set optimtru90="$optim90" |
---|
710 | else if $SUN then |
---|
711 | set optim90=" $optim90 -M$libo" |
---|
712 | set optimtru90=" $optimtru90 " |
---|
713 | else if $NEC then |
---|
714 | set optim90=" $optim90 -I$libo " |
---|
715 | else if $XNEC then |
---|
716 | set optim90=" $optim90 -I$libo " |
---|
717 | set optimtru90=" $optimtru90 -I$libo " |
---|
718 | else if $LINUX then |
---|
719 | # Ehouarn : adapt to gfortran |
---|
720 | set optim="$optim -I${libo}" |
---|
721 | set optim90="$optim90 -I${libo}" |
---|
722 | set optimtru90="$optimtru90 -ffree-form -I${libo}" |
---|
723 | # Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above) |
---|
724 | # set mod_loc_dir=$libo |
---|
725 | endif |
---|
726 | |
---|
727 | set link="$f90 $optim90" |
---|
728 | |
---|
729 | set ar=ar |
---|
730 | |
---|
731 | if $XNEC then |
---|
732 | set link="sxld $opt_link" |
---|
733 | set link="$f90 " |
---|
734 | # set ar=sxar |
---|
735 | endif |
---|
736 | |
---|
737 | |
---|
738 | cd $localdir |
---|
739 | |
---|
740 | ## locate main program (could be in dyn3d or phy$physique |
---|
741 | ## and could be .F or .F90) |
---|
742 | set source_code=${code}.F |
---|
743 | if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then |
---|
744 | set source_code=${code}.F90 |
---|
745 | endif |
---|
746 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F ) then |
---|
747 | set source_code=${code}.F |
---|
748 | endif |
---|
749 | if ( -f $LMDGCM/libf/phy${physique}/${code}.F90 ) then |
---|
750 | set source_code=${code}.F90 |
---|
751 | endif |
---|
752 | |
---|
753 | ## locate directory where main program is located |
---|
754 | if ( $dimension == 3 ) then |
---|
755 | if ( -f $LMDGCM/libf/dyn3d/${source_code} ) then |
---|
756 | set dyn="DIRMAIN=dyn3d " |
---|
757 | endif |
---|
758 | if ( -f $LMDGCM/libf/phy${physique}/${source_code} ) then |
---|
759 | set dyn="DIRMAIN=phy${physique} " |
---|
760 | endif |
---|
761 | endif |
---|
762 | |
---|
763 | echo $make -f $LMDGCM/makefile \ |
---|
764 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
765 | OPTIM="$optim" \ |
---|
766 | OPTIM90="$optim90" \ |
---|
767 | OPTIMTRU90="$optimtru90" \ |
---|
768 | INCLUDE="$include" \ |
---|
769 | $filtre \ |
---|
770 | LIBO=$libo \ |
---|
771 | $dyn \ |
---|
772 | $phys \ |
---|
773 | DIM=$dimc \ |
---|
774 | DYNTYPE="$dyntype" \ |
---|
775 | L_ADJNT="$adjnt" \ |
---|
776 | LOCAL_DIR="$localdir" \ |
---|
777 | F77="$f77" \ |
---|
778 | F90="$f90" \ |
---|
779 | OPLINK="$oplink" \ |
---|
780 | LINK="$link" \ |
---|
781 | GCM="$LMDGCM" \ |
---|
782 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
783 | MOD_SUFFIX=$mod_suffix \ |
---|
784 | AR=$ar \ |
---|
785 | SOURCE=$source_code \ |
---|
786 | PROG=$code |
---|
787 | |
---|
788 | |
---|
789 | $make -f $LMDGCM/makefile \ |
---|
790 | OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \ |
---|
791 | OPTIM="$optim" \ |
---|
792 | OPTIM90="$optim90" \ |
---|
793 | OPTIMTRU90="$optimtru90" \ |
---|
794 | INCLUDE="$include" \ |
---|
795 | $filtre \ |
---|
796 | LIBO=$libo \ |
---|
797 | $dyn \ |
---|
798 | $phys \ |
---|
799 | DIM=$dimc \ |
---|
800 | DYNTYPE="$dyntype" \ |
---|
801 | L_ADJNT="$adjnt" \ |
---|
802 | LOCAL_DIR="$localdir" \ |
---|
803 | F77="$f77" \ |
---|
804 | F90="$f90" \ |
---|
805 | OPLINK="$oplink" \ |
---|
806 | LINK="$link" \ |
---|
807 | GCM="$LMDGCM" \ |
---|
808 | MOD_LOC_DIR=$mod_loc_dir \ |
---|
809 | MOD_SUFFIX=$mod_suffix \ |
---|
810 | AR=$ar \ |
---|
811 | SOURCE=$source_code \ |
---|
812 | PROG=$code |
---|
813 | |
---|
814 | # cleanup, remove dimensions.h |
---|
815 | \rm -f $libf/grid/dimensions.h |
---|