source: trunk/LMDZ.MARS/makegcm_g95 @ 1059

Last change on this file since 1059 was 1036, checked in by emillour, 12 years ago

Mars GCM: (a first step towards using parallel dynamics)

  • IMPORTANT CHANGE: Implemented dynamic tracers. It is no longer necessary to compile the model with the '-t #' option, number of tracers is simply read from tracer.def file (as before). Adapted makegcm_* scripts (and co.) accordingly. Technical aspects of the switch to dynamic tracers are:
    • advtrac.h (in dyn3d) removed and replaced by module infotrac.F
    • tracer.h (in phymars) removed and replaced by module tracer_mod.F90 (which contains nqmx, the number of tracers, etc. and can be used anywhere in the physics).
  • Included some side cleanups: removed unused files (in dyn3d) anldoppler2.F, anl_mcdstats.F and anl_stats-diag.F, and all the unecessary dimensions.* files in grid/dimension.
  • Checked that changes are clean and that GCM yields identical results (in debug mode) to previous svn version.

EM

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