source: trunk/LMDZ.MARS/makegcm_pgf @ 2164

Last change on this file since 2164 was 1540, checked in by emillour, 9 years ago

All GCMS: Further adaptations to keep up with changes in LMDZ5 concerning
physics/dynamics separation:

  • changed directory "dynlonlat_phylonlat" to "dynphy_lonlat" and adapted makelmdz and makelmdz_fcm scripts accordingly.
  • added option "-libphy" to makelmdz_fcm to just build a physics library, without any main program (not operational yet; further cleanup in the physics required).
  • moved "iniprint.h" from dyn3d_common to misc (NB: it is used in both physics and dynamics; this should be cleaned up further...)

EM

  • Property svn:executable set to *
File size: 25.2 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)/dynphy_lonlat'
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 64bit Linux Machines
32  setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_pgi/lib
33  setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_pgi/include
34####
35# Adapt example below to your personal machine (here "antolini"), if necessary
36if (`hostname -s` == "antolini" ) then
37  setenv NCDFLIB /home/MILLOUR/netcdf64-4.0.1_pgi/lib
38  setenv NCDFINC /home/MILLOUR/netcdf64-4.0.1_pgi/include
39endif
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-cpp FLAG  Add preprocessing definition of FLAG
320
321-adjnt     Compiles the adjoint model to the dynamical code.
322
323-olddyn    To compile GCM with "old dynamics"
324
325-filtre  filter
326           To select the longitudinal filter in the polar regions.
327           "filter" corresponds to the name of a directory located in
328           $LMDGCM/libf. The standard filter for the model is "filtrez"
329           which can be used for a regular grid and for a 
330           grid with longitudinal zoom.
331
332-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
333           Adds a link to FORTRAN libraries
334           libfile1.a, libfile2.a ...
335           located in directories dir1, dir2 ...respectively
336           If dirn is a directory with an automatic path
337           (/usr/lib ... for example)
338           there is no need to specify  -Ldirn.
339
340-full      Full (re)compilation (from scratch)
341
342eod
343exit
344
345########################################################################
346# Lecture des differentes options
347########################################################################
348
349    case -d:
350        set dim=$2 ; shift ; shift ; goto top
351                       
352    case -O:
353        set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
354
355     case -p
356        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
357
358     case -g
359        set grille="$2" ; shift ; shift ; goto top
360
361     case -t
362        set ntrac=$2 ; shift ; shift ; goto top
363
364     case -include
365        set include="$include -I$2" ; shift ; shift ; goto top
366
367     case -cpp
368        set cpp_def="$cpp_def -D$2" ; shift ; shift ; goto top
369
370     case -adjnt
371        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
372
373     case -olddyn
374        set dyntype="olddyn" ; shift; goto top
375
376     case -full
377        set full="full" ; shift ; goto top
378
379     case -filtre
380        set filtre=$2 ; shift ; shift ; goto top
381
382     case -link
383        set opt_link="$opt_link $2" ; shift ; shift ; goto top
384
385     case -debug
386        if $HP then
387           set optim90=" -g "
388        else if $SUN then
389           setenv PARALLEL 4
390           set optim90=" -g -C "
391           set optimtru90=" -g -C "
392        else if $CRAY then
393           set optim90="$optim90"" -G1 "
394        else if $LINUX then
395           set optim="-g -Mbounds -Kieee -Ktrap=fp -traceback"
396           set optim90="-g -Mbounds -Kieee -Ktrap=fp -traceback"
397           set optimtru90="-g -Mbounds -Kieee -Ktrap=fp -traceback"
398        else
399           echo "pas d option debug predefinie pour cette machine"
400           exit
401        endif
402        shift ; goto top
403
404     default
405        set code="$1" ; shift ; goto top
406
407   endsw
408endif
409
410echo "apres les opts dim $dim"
411
412########################################################################
413# cas special sans physique
414########################################################################
415if ( "$physique" == 'nophys' ) then
416   set phys="L_PHY= LIBPHY="
417else
418   set src_dirs="$src_dirs phy_common aerono$physique phy$physique"
419   set include="$include "'-I$(LIBF)/phy_common -I$(LIBF)/aerono'"$physique"' -I$(LIBF)/phy'"$physique"
420   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
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 dynphy_lonlat dynphy_lonlat/phy$physique"
510  else
511    set include="$include "'-I$(LIBF)/dyn3d '
512    set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
513  endif
514  set libdyn_phy="-ldynphy_lonlat"
515  set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.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 dynphy_lonlat/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/dynphy_lonlat/phy${physique}/${code}.F ) then
782  set dirmain=dynphy_lonlat/phy${physique}
783  set source_code=${code}.F
784endif
785if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then
786  set dirmain=dynphy_lonlat/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 \
799LIBPHY_COMMON=${LIBPHY_COMMON} \
800LIBDYN_PHYS=${LIBDYN_PHYS} \
801DIM=$dimc \
802DYNTYPE="$dyntype" \
803L_DYN_PHY="$libdyn_phy" \
804L_ADJNT="$adjnt" \
805LOCAL_DIR="$localdir"  \
806F77="$f77" \
807F90="$f90" \
808OPLINK="$oplink" \
809LINK="$link" \
810GCM="$LMDGCM" \
811MOD_LOC_DIR=$mod_loc_dir \
812MOD_SUFFIX=$mod_suffix \
813AR=$ar \
814DIRMAIN=$dirmain \
815SOURCE=$source_code \
816PROG=$code
817
818
819$make -f $LMDGCM/makefile \
820OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
821OPTIM="$optim" \
822OPTIM90="$optim90" \
823OPTIMTRU90="$optimtru90" \
824INCLUDE="$include" \
825$filtre \
826LIBO=$libo \
827$phys \
828LIBPHY_COMMON=${LIBPHY_COMMON} \
829LIBDYN_PHYS=${LIBDYN_PHYS} \
830DIM=$dimc \
831DYNTYPE="$dyntype" \
832L_DYN_PHY="$libdyn_phy" \
833L_ADJNT="$adjnt" \
834LOCAL_DIR="$localdir"  \
835F77="$f77" \
836F90="$f90" \
837OPLINK="$oplink" \
838LINK="$link" \
839GCM="$LMDGCM" \
840MOD_LOC_DIR=$mod_loc_dir \
841MOD_SUFFIX=$mod_suffix \
842AR=$ar \
843DIRMAIN=$dirmain \
844SOURCE=$source_code \
845PROG=$code
846
847# cleanup, remove dimensions.h
848\rm -f $libf/grid/dimensions.h
Note: See TracBrowser for help on using the repository browser.