source: trunk/LMDZ.GENERIC/makegcm_gfortran @ 1473

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