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