source: trunk/LMDZ.GENERIC/makegcm_ifort @ 2045

Last change on this file since 2045 was 1540, checked in by emillour, 9 years ago

All GCMS: Further adaptations to keep up with changes in LMDZ5 concerning
physics/dynamics separation:

  • changed directory "dynlonlat_phylonlat" to "dynphy_lonlat" and adapted makelmdz and makelmdz_fcm scripts accordingly.
  • added option "-libphy" to makelmdz_fcm to just build a physics library, without any main program (not operational yet; further cleanup in the physics required).
  • moved "iniprint.h" from dyn3d_common to misc (NB: it is used in both physics and dynamics; this should be cleaned up further...)

EM

  • 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)/dynphy_lonlat'
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_common phy$physique"
417   set include="$include "'-I$(LIBF)/phy_common  -I$(LIBF)/phy'"$physique"
418   set LIBPHY_COMMON='$(LIBO)/libphy_common.a'
419endif
420set libdyn_phy=""
421set LIBDYN_PHYS=""
422########################################################################
423#subtilites sur le nom de la librairie
424########################################################################
425
426
427\rm tmp ; touch tmp
428\rm tmp90 ; touch tmp90
429foreach i ( $optim90 )
430   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
431end
432set suf=
433foreach i ( `sort tmp | uniq ` )
434   set suf=$suf$i
435end
436if ( ! $IBM ) then
437   set nomlib="$nomlib$suf"
438endif
439if ( $DEC ) then
440   set nomlib=DEC
441endif
442
443# dimension
444echo "dimension avant sed $dim"
445if ( $IBM ) then
446   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
447   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
448else if ( $SUN || $XNEC ) then
449   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
450   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
451else
452     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
453     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
454endif
455
456# bands
457echo "bands avant sed $bands"
458if ( $IBM ) then
459   set bands=`echo $bands | sed -en 's/[^0-9]/ /g'`
460   set bands_=`echo $bands | sed -en 's/[^0-9]/_/g'`
461else if ( $SUN || $XNEC ) then
462   set bands=`echo $bands | sed -e 's/[^0-9]/ /g'` 
463   set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
464else
465     set bands=`echo $bands | sed -e 's/[^0-9]/ /g'`
466     set bands_=`echo $bands | sed -e 's/[^0-9]/_/g'`
467endif
468
469
470# build final name of libraries directory:
471if ( "$dyntype" == "olddyn" ) then
472  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn
473else
474  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}
475endif
476
477# Append number of bands to nomlib (new for universal model)
478set nomlib=${nomlib}_${bands_}
479
480# Append 'physique' type, if it is not mars, to nomlib
481if ( "$physique" != "mars" ) then
482  set nomlib=${nomlib}_${physique}
483endif
484
485## M-A-F nomlib trop long sur CRAY pour ar
486if ( $CRAY ) then
487    set nomlib=F90_${dim_}_t${ntrac}
488endif
489if ( $NEC || $XNEC ) then
490    set nomlib=F90_${dim_}_t${ntrac}
491endif
492
493echo "calcul de la dimension"
494set dimc=`echo $dim | wc -w`
495
496if ( "$dimc" == "2" ) then
497  set include="$include "'-I$(LIBF)/dyn2d '
498  set dimh=$dim
499endif
500if ( "$dimc" == "3" ) then
501  if ( "$dyntype" == "olddyn" ) then
502    set include="$include "'-I$(LIBF)/olddyn3d '
503    set src_dirs="$src_dirs olddyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
504  else
505    set include="$include "'-I$(LIBF)/dyn3d '
506    set src_dirs="$src_dirs dyn3d dynphy_lonlat dynphy_lonlat/phy$physique"
507  endif
508  set libdyn_phy="-ldynphy_lonlat"
509  set LIBDYN_PHYS='$(LIBO)/libdynphy_lonlat.a'
510  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
511endif
512echo "dimc is $dimc"
513
514########################################################################
515# path pour les #include
516########################################################################
517
518set include="$include -I$NCDFINC "
519echo $include
520
521########################################################################
522# Gestion des dimensions du modele.
523# on cree ou remplace le fichier des dimensions/nombre de traceur
524########################################################################
525
526cd $libf/grid
527if ( -f dimensions.h ) then
528  echo "WARNING: you are already compiling the model somewhere else"
529  echo "Wait until the first compilation is finished before starting."
530  echo "If you are sure that you are not compiling elsewhere, you can"
531  echo "type [yes] to continue."
532  echo "Do you want to continue?"
533  if ( $< == "yes" ) then
534    #remove old dimensions.h , bands.h and scatterers.h files
535    \rm -f $libf/grid/dimensions.h
536    \rm -f $libf/grid/bands.h
537    \rm -f $libf/phy${physique}/bands.h
538    \rm -f $libf/phy${physique}/scatterers.h
539  else
540    exit
541  endif
542endif
543
544# Build the appropriate 'dimensions.h' file
545cd dimension
546./makdim $dim
547# echo contents of dimensions.h to standard output
548cat $libf/grid/dimensions.h
549
550# Build the appropriate 'bands.h' file
551cd $libf/phy$physique/bands
552./makbands $bands
553# echo contents of bands.h to standard output
554cat $libf/phy$physique/bands.h
555
556# Build the appropriate 'scatterers.h' file
557cd $libf/phy$physique/scatterers
558./make_scatterers $scatterers
559# echo contents of scatterers.h to standard output
560cat $libf/phy$physique/scatterers.h
561
562cd $LMDGCM
563# set path to objects directory
564set libo=$libo/$nomlib
565# create objects directory, if it doesn't exist
566if ( ! -d $libo )  then
567   mkdir $libo
568   cd $model
569endif
570
571########################################################################
572# Differentes dynamiques (3d, 2d, 1d)
573########################################################################
574
575set dimension=`echo $dim | wc -w`
576echo dimension $dimension dim $dim
577if ( $dimension == 1 ) then
578  echo "No dynamics"
579##  set dyn="L_DYN= DYN= L_FILTRE= "
580## NB: we still need to have L_DYN=libdyn3d to reach routines and module
581## objects which are located in dyn3d
582  set dyntype=""
583  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
584  set dyn="L_DYN= DYN= L_FILTRE= "
585  set dirmain="phy$physique/dyn1d"
586  set src_dirs="$src_dirs phy$physique/dyn1d "
587  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
588endif
589endif
590
591cd $model
592if ( $dimension == 3 ) then
593  cd libf/grid
594  \rm fxyprim.h
595  cp -p fxy_${grille}.h fxyprim.h
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"
609   if ( "$dyntype" == "olddyn" ) then
610     set src_dirs="$src_dirs oldfiltrez"
611   else
612     set src_dirs="$src_dirs filtrez"
613   endif
614else
615   set filtre="FILTRE= L_FILTRE= L_DYN= "
616endif
617echo "MACRO FILTRE $filtre"
618
619echo "dimc $dimc"
620
621#cleanup for a full recompilation, if requested
622if ("$full" == "full") then
623# remove makefile and $libo
624  cd $model
625  \rm -f makefile
626  \rm -rf $libo/*
627endif
628
629########################################################################
630#  Avant de lancer le make, on recree le makefile si necessaire
631########################################################################
632# c'est a dire dans 3 cas:
633# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
634#    derniere creation du makefile
635# 2. si le fichier contenant cette liste "liste_des_sources"
636#    n'existe pas.
637# 3. Si le makefile n'existe pas.
638########################################################################
639
640cd $model
641find libf -name '*.[Fh]' -print | sort >! tmp77
642#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
643find libf -name '*.[Fh]90' -print | sort >> tmp90
644
645if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
646     || `diff tmp90 liste_des_sources_f90 | wc -w` \
647     || ! -f makefile \
648     || ! -f liste_des_sources_f90 \
649     || ! -f liste_des_sources_f77 ) then
650        echo "les fichiers suivants ont ete crees ou detruits"
651        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
652        diff liste_des_sources_f77 tmp77
653        diff liste_des_sources_f90 tmp90
654        \cp tmp77 liste_des_sources_f77
655        \cp tmp90 liste_des_sources_f90
656        echo "Remaking the makefile!"
657        echo "src_dirs: $src_dirs"
658        ./create_make_gcm $src_dirs >! tmp
659        \mv tmp makefile
660        echo "New makefile created."
661endif
662
663########################################################################
664#  Execution de la comande make
665########################################################################
666
667
668echo PHYSIQUE $phys
669echo dynamique $dyn $dimension
670echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
671echo PATH pour les fichiers INCLUDE $include
672echo OPLINK="$oplink"
673
674if $HP then
675   set f77='fort77 +OP'
676   set f90='jensaisrien'
677   set opt_link="$opt_link -lm"
678else  if $VPP then
679   set f77=frt
680   set f90=$f77
681else if $CRAY then
682   set f77=f90
683   set f90=f90
684else if $LINUX then
685   set f77=ifort
686   set f90=ifort
687#### uncomment for double precision
688#   set f77="ifort -real-size 64 -DNC_DOUBLE"
689#   set f90="ifort -real-size 64 -DNC_DOUBLE"
690   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
691else if $SUN then
692   set f77=f90
693   set f90=f90
694else if $NEC then
695   set f77=f90
696   set f90=f90
697else if $XNEC then
698   set f77=sxmpif90
699   set f90=sxmpif90
700else
701   set f77=f77
702   set f90=f90
703endif
704
705cd $model
706
707if $VPP then
708  set make="gmake RANLIB=ls"
709else if $CRAY then
710  set make="make RANLIB=ls"
711else if $NEC then
712  set make="make RANLIB=ls"
713else if $LINUX then
714  set make="make -k RANLIB=ranlib"
715else if $XNEC then
716  set make="/usr/local/bin/gmake RANLIB=ls"
717  set make="/usr/freeware/bin/gmake RANLIB=ls"
718else
719  set make="make RANLIB=ranlib"
720endif
721
722#
723# etat0_netcdf a besoin d'info de la physique
724# A revoir
725set include="$include"" -I$libf/phy$physique"
726
727
728#################################################################
729# Execution de la comande make... ENFIN!
730#################################################################
731
732if $VPP then
733  set optim90=" $optim90 -Am -M$libo"
734  set optimtru90="$optim90"
735else if $SUN then
736 set optim90=" $optim90 -M$libo"
737 set optimtru90=" $optimtru90 "
738else if $NEC then
739 set optim90=" $optim90 -I$libo "
740else if $XNEC then
741 set optim90=" $optim90 -I$libo "
742 set optimtru90=" $optimtru90 -I$libo "
743else if $LINUX then
744 set optim="$optim -module $libo"
745 set optim90="$optim90 -module $libo"
746 set optimtru90="$optimtru90 -module $libo"
747# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
748# set mod_loc_dir=$libo
749endif
750
751set link="$f90 $optim90"
752
753set ar=ar
754
755if $XNEC then
756  set link="sxld $opt_link"
757  set link="$f90 "
758#  set ar=sxar
759endif
760
761cd $localdir
762
763set source_code=${code}.F
764# handle cases when the main program is in the physics directory
765set dirmain=dyn${dimc}d
766if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
767  set source_code=${code}.F90
768endif
769if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
770  set dirmain=phy${physique}/dyn1d
771  set source_code=${code}.F
772endif
773if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
774  set dirmain=phy${physique}/dyn1d
775  set source_code=${code}.F90
776endif
777if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F ) then
778  set dirmain=dynphy_lonlat/phy${physique}
779  set source_code=${code}.F
780endif
781if ( -f $LMDGCM/libf/dynphy_lonlat/phy${physique}/${code}.F90 ) then
782  set dirmain=dynphy_lonlat/phy${physique}
783  set source_code=${code}.F90
784endif
785
786echo $make -f $LMDGCM/makefile \
787OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
788OPTIM="$optim" \
789OPTIM90="$optim90" \
790OPTIMTRU90="$optimtru90" \
791INCLUDE="$include" \
792$filtre \
793LIBO=$libo \
794$phys \
795LIBPHY_COMMON=${LIBPHY_COMMON} \
796LIBDYN_PHYS=${LIBDYN_PHYS} \
797DIM=$dimc \
798DYNTYPE="$dyntype" \
799L_DYN_PHY="$libdyn_phy" \
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 \
810DIRMAIN=$dirmain \
811SOURCE=$source_code \
812PROG=$code
813
814
815$make -f $LMDGCM/makefile \
816OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
817OPTIM="$optim" \
818OPTIM90="$optim90" \
819OPTIMTRU90="$optimtru90" \
820INCLUDE="$include" \
821$filtre \
822LIBO=$libo \
823$phys \
824LIBPHY_COMMON=${LIBPHY_COMMON} \
825LIBDYN_PHYS=${LIBDYN_PHYS} \
826DIM=$dimc \
827DYNTYPE="$dyntype" \
828L_DYN_PHY="$libdyn_phy" \
829L_ADJNT="$adjnt" \
830LOCAL_DIR="$localdir"  \
831F77="$f77" \
832F90="$f90" \
833OPLINK="$oplink" \
834LINK="$link" \
835GCM="$LMDGCM" \
836MOD_LOC_DIR=$mod_loc_dir \
837MOD_SUFFIX=$mod_suffix \
838AR=$ar \
839DIRMAIN=$dirmain \
840SOURCE=$source_code \
841PROG=$code
842
843\rm -f $libf/grid/dimensions.h
844\rm -f $libf/grid/bands.h
845\rm -f $libf/phy$physique/bands.h
846\rm -f $libf/phy$physique/scatterers.h
Note: See TracBrowser for help on using the repository browser.