source: trunk/LMDZ.MARS/makegcm_ifort @ 1013

Last change on this file since 1013 was 1001, checked in by emillour, 12 years ago

Mars GCM:

  • Removed options "-static" and "-xSSE4.2" from ifort default options from makegcm_ifort (-static not usable on Gnome computer, and not much benefit anyways, and -xSSE4.2 causes unexplained crashes with thermosphere on Gnome)

EM

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