source: trunk/LMDZ.GENERIC/makegcm_gfortran @ 1254

Last change on this file since 1254 was 1254, checked in by aslmd, 11 years ago

LMDZ.COMMON LMDZ.GENERIC oops defs should be with each physics

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