source: trunk/LMDZ.GENERIC/makegcm_gfortran @ 1181

Last change on this file since 1181 was 989, checked in by emillour, 11 years ago

Generic GCM:

  • Some minor changes so that gcm compiles with gfortran:
    • Added option to compile "long lines" (>132 characters) in makegcm_gfortran
    • Removed use of isnan() in physiq.F90 (it is not a standard function)
    • Avoid possible underflow of psat in watercommon_h.F90
    • Adapted the checks on the *IR and *VI band files to be more strict

EM

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