source: LMDZ6/branches/Ocean_skin/makegcm @ 3605

Last change on this file since 3605 was 3605, checked in by lguez, 4 years ago

Merge revisions 3427:3600 of trunk into branch Ocean_skin

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