source: trunk/LMDZ.GENERIC/makegcm_pgf90 @ 2198

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