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