source: trunk/LMDZ.MARS/makegcm_ifort @ 1109

Last change on this file since 1109 was 1109, checked in by aslmd, 12 years ago

MESOSCALE. A few modifications to bounding GCM stuff.

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