source: trunk/LMDZ.MARS/makegcm_g95 @ 1421

Last change on this file since 1421 was 1403, checked in by emillour, 10 years ago

All models: Reorganizing the physics/dynamics interface.

  • makelmdz and makelmdz_fcm scripts adapted to handle the new directory settings
  • misc: (replaces what was the "bibio" directory)
  • Should only contain extremely generic (and non physics or dynamics-specific) routines
  • Therefore moved initdynav.F90, initfluxsto.F, inithist.F, writedynav.F90, write_field.F90, writehist.F to "dyn3d_common"
  • dynlonlat_phylonlat: (new interface directory)
  • This directory contains routines relevent to physics/dynamics grid interactions, e.g. routines gr_dyn_fi or gr_fi_dyn and calfis
  • Moreover the dynlonlat_phylonlat contains directories "phy*" corresponding to each physics package "phy*" to be used. These subdirectories should only contain specific interfaces (e.g. iniphysiq) or main programs (e.g. newstart)
  • phy*/dyn1d: this subdirectory contains the 1D model using physics from phy*

EM

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