source: trunk/LMDZ.GENERIC/makegcm_gfortran @ 1579

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