source: trunk/LMDZ.MARS/makegcm_pgf @ 1428

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