source: trunk/LMDZ.MARS/makegcm_pgf @ 1518

Last change on this file since 1518 was 1499, checked in by emillour, 9 years ago

Mars GCM:

  • Added option "-cpp" so that users can add the definition of specific precompiling flags in makegcm_* scripts (and added default BLAS and LAPACK flags for ifort on Gnome and Ada).
  • Put calls to dgesv (Lapack) routine in photochemistry_asis.F90 under the LAPACK preprocessing flag. Moved secondary routines in photochemistry.F and photochemistry_asis.F90 into the main (via contains instruction) to avoid multiple definitions of routines with identical names.

EM

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