source: trunk/LMDZ.GENERIC/makegcm_ifort @ 1416

Last change on this file since 1416 was 1416, checked in by milmd, 10 years ago

Update newstart and start2archive programs to work with LMDZ.GENERIC or LMDZ.MARS dynamics. Modification of makegcm_ifort to compile on Ada.

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