source: trunk/LMDZ.GENERIC/makegcm_gfortran @ 1243

Last change on this file since 1243 was 1216, checked in by emillour, 11 years ago

Generic model:
Major cleanup, in order to ease the use of LMDZ.GENERIC with (parallel) dynamics
in LMDZ.COMMON: (NB: this will break LMDZ.UNIVERSAL, which should be thrashed
in the near future)

  • Updated makegcm_* scripts (and makdim) and added the "-full" (to enforce full recomputation of the model) option
  • In dyn3d: converted control.h to module control_mod.F90 and converted iniadvtrac.F to module infotrac.F90
  • Added module mod_const_mpi.F90 in dyn3d (not used in serial mode)
  • Rearanged input/outputs routines everywhere to handle serial/MPI cases. physdem.F => phyredem.F90 , phyetat0.F => phyetat0.F90 ; all read/write routines for startfi files are gathered in module iostart.F90
  • added parallelism related routines init_phys_lmdz.F90, comgeomphy.F90, dimphy.F90, iniphysiq.F90, mod_grid_phy_lmdz.F90, mod_phys_lmdz_mpi_data.F90, mod_phys_lmdz_mpi_transfert.F90, mod_phys_lmdz_omp_data.F90, mod_phys_lmdz_omp_transfert.F90, mod_phys_lmdz_para.F90, mod_phys_lmdz_transfert_para.F90 in phymars and mod_const_mpi.F90 in dyn3d (for compliance with parallelism)
  • added created generic routines 'planetwide_maxval' and 'planetwide_minval', in module "planetwide_mod", that enable obtaining the max and min of a field over the whole planet. This should be further imroved with computation of means (possibly area weighed), etc.

EM

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