/[MITgcm]/MITgcm/tools/genmake
ViewVC logotype

Diff of /MITgcm/tools/genmake

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.32 by adcroft, Mon Mar 5 19:57:31 2001 UTC revision 1.87 by stephd, Mon Oct 6 20:38:40 2003 UTC
# Line 1  Line 1 
1  #!/bin/csh -f  #!/bin/csh -f
2  #  #
3  # $Header$  # $Header$
4    # $Name$
5  #  #
6  # Makefile generator for MITgcm UV codes  # Makefile generator for MITgcm UV codes
7  #   created  by cnh 03/98  #   created  by cnh 03/98
# Line 8  Line 9 
9  #   modified by aja 01/00  #   modified by aja 01/00
10    
11  # Default lists  # Default lists
12  set DISABLE = ( aim )  if (! $?DISABLE) set DISABLE = ( aim aim_v23 autodiff cal cost ctrl ecco exf grdchk flt land ptracers seaice therm_seaice bulk_force dic gchem cfc )
13  set ENABLE  = ( )  if (! $?ENABLE) set ENABLE  = ( )
14  set MODS  = ( )  if (! $?DEFINES) set DEFINES = ( )
15    if (! $?MODS) set MODS  = ( )
16    
17  # Grab variables/lists from .genmakerc  # Grab variables/lists from .genmakerc
18  if (-r .genmakerc) source .genmakerc  if (-r .genmakerc) source .genmakerc
# Line 79  while ($#allargs) Line 81  while ($#allargs)
81   case -enable=*:   case -enable=*:
82     set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)     set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
83     breaksw     breaksw
84     case -cpp:
85     case -cpp=:
86       echo "To define CPP macros use -cpp=arg"
87       exit
88       breaksw
89     case -cpp=*:
90       set DEFINES = ( $DEFINES `echo $arg | sed 's/-cpp=//' | sed 's/,/ /g' `)
91       breaksw
92     case -ieee:
93       set IEEE
94       breaksw
95   case -mpi:   case -mpi:
96     echo "Enabling MPI options"     echo "Enabling MPI options"
97     set USEMPI     set USEMPI
# Line 87  while ($#allargs) Line 100  while ($#allargs)
100     set include_jam_libs     set include_jam_libs
101     echo "Including paths to JAM libraries"     echo "Including paths to JAM libraries"
102     breaksw     breaksw
103     case -arpack:
104       echo "Enabling ARPACK libraries"
105       set USEARPACK
106       breaksw
107     case -fc:
108     case -fc=:
109       echo "To change the compiler (\$FC) you must specify one with -fc="
110       echo "eg. -fc=f90  or  -fc=g77"
111       exit
112       breaksw
113     case -fc*:
114       if ($?FC) then
115        echo Option -fc=... can only be specified once.; exit 1
116       endif
117       set FC = ( `echo $arg | sed 's/-fc=//' `)
118       breaksw
119   case -help:   case -help:
120     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]"     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-arpack] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
121    cat << EOF
122    
123    $0 is used to generate the Makefile in the current directory.
124    
125    Typical invocations are:
126     o from "bin":   ../tools/genmake
127     o from "verification/expt/code": ../../../tools/genmake
128     o from "verification/expt/input": ../../../tools/genmake -mods=../code
129     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
130       or  ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
131    
132    Packages (collected modules of code)  can be disabled to avoid unnecessary
133    compilation of unused code. For instance if you know you will not
134    use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
135    configuration:
136       .../tools/genmake -disable=gmredi,kpp,obcs
137    
138    If you add some source files you can re-call the previous instance of
139    genmake with "make makefile".
140    
141    genmake also reads the file .genmakerc which can be used to configure
142    options (primarily the command-line options above) for particular experiments.
143    EOF
144     exit     exit
145     breaksw     breaksw
146   default:   default:
# Line 105  end Line 157  end
157  # If platform wasn't specified then determine platform type of the host  # If platform wasn't specified then determine platform type of the host
158  if (! $?platform) then  if (! $?platform) then
159   set platform = (`uname`)   set platform = (`uname`)
160    # This let's us distinguish between different Linux platforms
161     if ($platform == Linux) then
162      set machine = (`uname -m`)
163      set platform = ($platform'-'$machine)
164     endif
165  endif  endif
166  # If name of makefile wasn't specified then use default "Makefile"  # If name of makefile wasn't specified then use default "Makefile"
167  if (! $?mfile) set mfile = ( Makefile )  if (! $?mfile) set mfile = ( Makefile )
# Line 112  if (! $?mfile) set mfile = ( Makefile ) Line 169  if (! $?mfile) set mfile = ( Makefile )
169  set mach  = ( `uname -a` )  set mach  = ( `uname -a` )
170  echo Operating system: $mach  echo Operating system: $mach
171    
   
172  # Directories for source, includes, binaries and executables  # Directories for source, includes, binaries and executables
173  #  #
174  # If -rootdir wasn't specified then assume script is being run from bin  # If -rootdir wasn't specified then assume script is being run from bin
# Line 145  endif Line 201  endif
201  # source code in the standard directories  # source code in the standard directories
202  if (! $?MODS) then  if (! $?MODS) then
203   set SOURCEDIRS  = ( )   set SOURCEDIRS  = ( )
204   set INCLUDEDIRS = ( . )   set INCLUDEDIRS = ( )
205  else  else
206   set SOURCEDIRS  = ( $MODS )   set SOURCEDIRS  = ( $MODS )
207   set INCLUDEDIRS = ( . $MODS )   set INCLUDEDIRS = ( $MODS )
208  endif  endif
209  if (! $?BUILDDIR) set BUILDDIR = ( . )  if (! $?BUILDDIR) set BUILDDIR = ( . )
210  if (! -d $BUILDDIR) then  if (! -d $BUILDDIR) then
# Line 171  if (! -d $TOOLSDIR) then Line 227  if (! -d $TOOLSDIR) then
227  endif  endif
228  if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )  if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )
229    
230    # We have a special set of source files in eesupp/src which
231    # are generated from some template source files. We'll make them
232    # first so the appear as regular source code
233    if (-r $ROOTDIR/eesupp/src/Makefile) then
234     echo Making source files in eesupp from templates...
235     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
236     if ($status == 0) then
237       rm -f make_eesupp.errs
238     else
239       cat make_eesupp.errs
240       exit 2
241     endif
242    endif
243    
244  # Now scan the standard source code tree  # Now scan the standard source code tree
245  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS)
246    set adr=$dr    set adr=$dr
247    if (! -d $adr) then    if (! -d $adr) then
248      echo mods directory $adr not found.; exit 1      echo mods directory $adr not found.; exit 1
249    endif    endif
250    echo Adding mods directory $adr    echo Adding mods dir: $adr
251  end  end
252  if (! $?PACKAGES) then  if (! $?PACKAGES) then
253    set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`)    set PACKAGES=()
254      foreach pkg (`cd $ROOTDIR/pkg; find . -type d -print | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
255       if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
256      end
257  endif  endif
258  foreach dr ($PACKAGES)  foreach dr ($PACKAGES)
259    set enable    set enable
# Line 191  foreach dr ($PACKAGES) Line 264  foreach dr ($PACKAGES)
264     endif     endif
265     if ($dr == $p) unset enable     if ($dr == $p) unset enable
266     if ($p == 'all') unset enable     if ($p == 'all') unset enable
267    #  The following allows entire trees to be disabled
268       if ($dr:h == $p) unset enable
269       if ($dr:h:h == $p) unset enable
270       if ($dr:h:h:h == $p) unset enable
271       if ($dr:h:h:h:h == $p) unset enable
272    end    end
273    foreach p ($ENABLE)    foreach p ($ENABLE)
274     if ($dr == $p) set enable     if ($dr == $p) set enable
# Line 200  foreach dr ($PACKAGES) Line 278  foreach dr ($PACKAGES)
278      if (! -d $adr) then      if (! -d $adr) then
279        echo Source directory $adr not found.; exit 1        echo Source directory $adr not found.; exit 1
280      endif      endif
281      echo Adding package directory $adr      echo Adding pkg dir: $adr
282      set SOURCEDIRS = ($SOURCEDIRS $adr)      set SOURCEDIRS = ($SOURCEDIRS $adr)
283      set INCLUDEDIRS = ($INCLUDEDIRS $adr)      set INCLUDEDIRS = ($INCLUDEDIRS $adr)
284        switch ($dr)
285          case ptracers:
286            set DEFINES = ($DEFINES '-DALLOW_PTRACERS'); breaksw
287          default:
288            breaksw
289        endsw
290    else    else
291      echo "*" Package \"$dr\" has not been enabled.      echo "                                      *" Package \"$dr\" NOT enabled.
292        switch ($dr)
293          case mom_fluxform:
294            set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
295          case mom_vecinv:
296            set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
297          case generic_advdiff:
298            set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
299          case debug:
300            set DEFINES = ($DEFINES '-DDISABLE_DEBUGMODE'); breaksw
301          default:
302            breaksw
303        endsw
304    endif    endif
305  end  end
306  if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags)  if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
307  foreach dr ($STANDARDDIRS)  foreach dr ($STANDARDDIRS)
308    set adr=$ROOTDIR/$dr/src    set adr=$ROOTDIR/$dr/src
309    if (! -d $adr) then    if (! -d $adr) then
310      echo Source directory $adr not found.; exit 1      echo Source directory $adr not found.; exit 1
311    endif    endif
312    echo Adding source directory $adr    echo Adding src dir: $adr
313    set SOURCEDIRS = ($SOURCEDIRS $adr)    set SOURCEDIRS = ($SOURCEDIRS $adr)
314    set idr = `echo $adr | sed 's/src/inc/'`    set idr = `echo $adr | sed 's/src/inc/'`
315    set INCLUDEDIRS = ($INCLUDEDIRS $idr)    set INCLUDEDIRS = ($INCLUDEDIRS $idr)
316  end  end
317    
318    # Find possible compilers
319    if ($?FC) then
320     echo "$FC was specified as the compiler"
321    else
322     echo " "
323     switch ($platform)
324      case Linux*:
325       set likelysuspects=(g77 ifc pgf77 f77 f90 f95)
326       breaksw
327      default:
328       set likelysuspects=(f77)
329       breaksw
330     endsw
331     foreach fc ($likelysuspects)
332      set foundfc=`which $fc |& cat - `
333      if (-x $foundfc[1]) then
334       if ($?possiblefc) then
335        set possiblefc=($possiblefc $fc)
336       else
337        set possiblefc=$fc
338       endif
339      endif
340     end
341     if ($?possiblefc) then
342      set FC=$possiblefc[1]
343      echo Found these compilers: $possiblefc.  Using \"$FC\" as the compiler
344     else
345      echo "No compiler found\!"
346      echo I tried looking for \"$likelysuspects\" in your \$PATH but found none
347      echo I will continue anyway and see what happens.
348      set FC = ( 'f77' )
349    # exit 13
350     endif
351    endif
352    
353  # This is the generic configuration.  # This is the generic configuration.
354  # Platform specific options are chosen below  # Platform specific options are chosen below
355  set LN         = ( 'ln -s' )  set LN         = ( 'ln -s' )
356  set CPP        = ( '/lib/cpp -P' )  set CPP        = ( '/lib/cpp -P' )
357    set S64        = ( '$(TOOLSDIR)/set64bitConst.sh' )
358  set KPP        = (  )  set KPP        = (  )
359  set FC         = ( 'f77' )  #set FC         = ( 'f77' )
360  set LINK       = ( 'f77' )  set LINK       = $FC
361  set DEFINES    = (  )  set MAKEDEPEND = ( 'makedepend' )
362  set INCLUDES   = (  )  set INCLUDES   = ( -I. )
363  set FFLAGS     = (  )  set FFLAGS     = (  )
364  set FOPTIM     = (  )  set FOPTIM     = (  )
365    set CFLAGS     = (  )
366  set KFLAGS1    = (  )  set KFLAGS1    = (  )
367  set KFLAGS2    = (  )  set KFLAGS2    = (  )
368  set LIBS       = (  )  set LIBS       = (  )
369  set KPPFILES   = (  )  set KPPFILES   = (  )
370  set NOOPTFILES = (  )  if (! $?NOOPTFILES ) set NOOPTFILES = (  )
371  set NOOPTFLAGS = (  )  if (! $?NOOPTFLAGS ) set NOOPTFLAGS = (  )
372  set RMFILES    = (  )  set RMFILES    = (  )
373    
374  # We often want to use different compile/link options is using MPI  # We often want to use different compile/link options is using MPI
# Line 247  else Line 380  else
380  # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )  # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
381  endif  endif
382    
383    if ($?USEARPACK) then
384      set USEARPACK  = ( '+arpack' )
385      set LIBS       = ( '-L/usr/lib -larpack -llapack' )
386    else
387      set USEARPACK
388    endif
389    
390  # Platform specific options  # Platform specific options
391  switch ($platform$USEMPI)  switch ($platform$USEMPI$USEARPACK)
   case OSF1:  
392    case OSF1+mpi:    case OSF1+mpi:
393    #ph: e.g. halem.gsfc.nasa.gov
394        echo "Configuring for DEC Alpha with MPI"
395        set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
396    #ph: -lkmp_osfp10 not needed on some/many platforms
397      case OSF1:
398      echo "Configuring for DEC Alpha"      echo "Configuring for DEC Alpha"
399      set CPP        = ( '/usr/bin/cpp -P' )      set CPP        = ( '/usr/bin/cpp -P' )
400      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )
401      set KPP        = ( 'kapf' )      set MAKEDEPEND = ( mkdep -f depend.out )
402      set KPPFILES   = ( 'main.F' )  #ph: makedepend not available on some/many DEC Alpha's; use mkdep instead
403      set KFLAGS1    = ( '-scan=132 -noconc -cmp=' )      set KPP        = ( )
404        set KPPFILES   = ( )
405        set KFLAGS1    = ( )
406      set FC         = ( 'f77' )      set FC         = ( 'f77' )
407      set FFLAGS     = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )      set FFLAGS     = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
408      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )
409    #ph: -O5 probably too aggressive in conjunction with adjoint code
410      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
     set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )  
411      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
412      set RMFILES    = ( '*.p.out' )      set RMFILES    = ( '*.p.out' )
413      breaksw      breaksw
# Line 279  switch ($platform$USEMPI) Line 425  switch ($platform$USEMPI)
425      echo "Configuring for SGI Mips"      echo "Configuring for SGI Mips"
426      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
427      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
428      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
429      set FOPTIM     = ( '-O3' )      set FOPTIM     = ( '-O3' )
430  #   set NOOPTFLAGS = ( '-O0' )      if ($?IEEE) set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -static' )
431  #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \      if ($?IEEE) set FOPTIM = ( '-O0 -OPT:IEEE_arithmetic=1 -OPT:IEEE_NaN_inf=ON' )
 #                      'external_fields_load.F' )  
432      set RMFILES    = ( 'rii_files' )      set RMFILES    = ( 'rii_files' )
433      breaksw      breaksw
434    case o2:    case o2:
# Line 309  switch ($platform$USEMPI) Line 454  switch ($platform$USEMPI)
454      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
455      set INCLUDES   = ( '-I/usr/include' )      set INCLUDES   = ( '-I/usr/include' )
456      set FFLAGS     = ( '-n32 -extend_source -bytereclen' )      set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
457      set FOPTIM     = ( '-O2' )      set FOPTIM     = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
458      set NOOPTFILES = ( 'calc_mom_rhs.F' )      set LIBS       = ( '-lmpi -lscs' )
459      set NOOPTFLAGS = ( '-O1' )      breaksw
460      case o2k_noopt:
461      case o2k_noopt+mpi:
462        echo "Configuring for SGI Origin2000 running IRIX 6.5"
463        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
464        set INCLUDES   = ( '-I/usr/include' )
465        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
466        set FOPTIM     = ( '-O0' )
467        set LIBS       = ( '-lmpi' )
468        breaksw
469      case ames_dbg+mpi:
470        echo "Configuring for SGI Origin2000 running IRIX 6.5"
471        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
472        set INCLUDES   = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
473        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
474      set LIBS       = ( '-lmpi -lscs' )      set LIBS       = ( '-lmpi -lscs' )
475        set FC         = ( 'f90' )
476        set LINK       = ( 'f90' )
477        breaksw
478      case ames_opt+mpi:
479        echo "Configuring for SGI Origin2000 running IRIX 6.5"
480        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
481        set INCLUDES   = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
482        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
483        set FOPTIM     = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
484        set LIBS       = ( '-lmpi -lscs' )
485        set FC         = ( 'f90' )
486        set LINK       = ( 'f90' )
487      breaksw      breaksw
488    case onyx:    case onyx:
489    case onyx+mpi:    case onyx+mpi:
# Line 327  switch ($platform$USEMPI) Line 498  switch ($platform$USEMPI)
498    case SunOS:    case SunOS:
499      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
500      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
501      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
502      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
503      set FOPTIM     = ( '-fast -O3' )      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
504      set NOOPTFLAGS = ( '-O0' )      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
505      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')      set CFLAGS     = ( '-dalign -O3 -xarch=v9' )
506        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
507        set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F aim_aim2dyn.F aim_dyn2aim.F aim_aim2dyn_exchanges.F aim_external_fields_load.F aim_calc_diags.F aim_external_forcing.F aim_do_atmos_physics.F aim_write_diags.F aim_do_inphys.F ')
508      breaksw      breaksw
509    case SunOS+mpi:    case SunOS+mpi:
510      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
511      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
512      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
513      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
     set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')  
     set FOPTIM     = ( '-fast -O3' )  
     set NOOPTFLAGS = ( '-O0' )  
514      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
515        set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
516        set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
517        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
518                         '-lsocket -lnsl' )                         '-lsocket -lnsl' )
519      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F')
520        breaksw
521      case SunFire+mpi:
522        set FC         = ( 'mpf77' )  
523        set LINK       = ( 'mpf77' )
524        set LN         = ( '/usr/bin/ln -s' )
525        set CPP        = ( '/usr/ccs/lib/cpp -P' )
526        set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
527        set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
528        set INCLUDES   = ( '-I/opt/SUNWhpc/include' )
529        set LIBS       = ( '-lmpi -lthread -lsocket -lnsl' )
530        set FFLAGS     = ( '-e -u -noautopar ' \
531                           '-xtypemap=real:64,double:64,integer:32 -fsimple=0' )
532        set FOPTIM     = ( '-dalign -O4 -xarch=native' )
533        set CFLAGS     = ( '-dalign -xO4 -xarch=native' )
534        set NOOPTFLAGS = ( '-dalign -O0 -xarch=native' )
535      breaksw      breaksw
536    case IRIX32:    case IRIX32:
537      echo "Configuring for SGI ONYX running IRIX64"      echo "Configuring for SGI ONYX running IRIX64"
# Line 371  switch ($platform$USEMPI) Line 559  switch ($platform$USEMPI)
559      set NOOPTFILES = ( 'barrier.F different_multiple.F' \      set NOOPTFILES = ( 'barrier.F different_multiple.F' \
560                         'external_fields_load.F' )                         'external_fields_load.F' )
561      breaksw      breaksw
562    case Linux+mpi:    case Linux-ia64+mpi:
563        echo "Configuring with MPI"
564      case Linux-ia64:
565        echo "Configuring for " $platform
566        set LN = ( '/bin/ln -s' )
567        set CPP = ( '/lib/cpp -traditional -P' )
568        set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
569        set FC = ( 'efc' )
570        set FFLAGS = ( '-WB -Vaxlib -u -w' )
571    #    set FOPTIM = ( '-O2 -ftz' )
572        set FOPTIM = ( '-O3 -mp' )
573        set LINK = ( 'efc' )
574        set LIBS       = ( '-lmpi -lscs -lpthread' )
575        breaksw
576      case Linux-alpha+mpi:
577        echo "Configuring with MPI"
578      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
579      set INCLUDES   = ( '-I/usr/local/include' )      set INCLUDES   = ( '-I/usr/local/include' )
580    case Linux:    case Linux-alpha:
581        echo "Configuring for " $platform
582      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
583      set CPP        = ( '/lib/cpp  -traditional -P' )      set CPP        = ( '/lib/cpp  -traditional -P' )
584      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
585      set FC         = ( 'g77' )      set FC         = ( 'g77' )
586      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )      set FFLAGS     = ( ' ' )
587      set FOPTIM     = ( '-O3 -malign-double -funroll-loops ' )      if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
588        set FOPTIM     = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
589      set LINK       = ( 'g77' )      set LINK       = ( 'g77' )
590      breaksw      breaksw
591    case Linux+pgi+mpi:    case Linux*+pgi+mpi:
592      if ($?include_jam_libs) then      if ($?include_jam_libs) then
593       set INCLUDES   = ( '-I/usr/local//mpich-cnh-install/include' )       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
594       set LIBS       = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
595      else      else
596       set INCLUDES   = ( '-I/usr/local/include' )       set INCLUDES   = ( '-I/usr/local/include' )
597       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
598      endif      endif
599    case Linux+pgi:    case Linux*+pgi:
600        echo "Configuring for " $platform
601      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
602      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
603      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
# Line 400  switch ($platform$USEMPI) Line 606  switch ($platform$USEMPI)
606      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
607      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
608      breaksw      breaksw
609      case Linux*+mpi:
610        set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
611        set INCLUDES   = ( '-I/usr/local/include' )
612      case Linux*:
613        echo "Configuring for " $platform
614        set LN         = ( '/bin/ln -s' )
615        set CPP        = ( '/lib/cpp  -traditional -P' )
616        switch ($FC)
617         case g77:
618          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
619          set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )
620          if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
621          set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )
622          set NOOPTFLAGS = ( '-O0' )
623          breaksw
624         case pgf77:
625          set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
626          set FC         = ( 'pgf77' )
627          set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
628          set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
629          breaksw
630         case ifc:
631          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
632          set FFLAGS     = ( '-132 -r8 -i4 -w95 -W0 -WB' )
633          if ($?IEEE) set FFLAGS     = ( $FFLAGS '-mp' )
634          set FOPTIM     = ( '-O3 -align' )
635    #P3   set FOPTIM     = ( $FOPTIM '-tpp6 -xWKM' )
636    #P4   set FOPTIM     = ( $FOPTIM '-tpp7 -xWKM' )
637          set LIBS       = ( ${LIBS} '-lPEPCF90' )
638          breaksw
639         default:
640          echo Error: Linux compiler not recognized: \$FC=$FC
641          exit
642          breaksw
643        endsw      
644        breaksw
645    case T3E:    case T3E:
646    case sn6312:    case sn6312:
647        echo "Configuring for T3E"
648      set CPP        = ( '/opt/ctl/bin/cpp -P')      set CPP        = ( '/opt/ctl/bin/cpp -P')
649      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
650      set FC         = ( 'f90' )      set FC         = ( 'f90' )
# Line 410  switch ($platform$USEMPI) Line 653  switch ($platform$USEMPI)
653      breaksw      breaksw
654    case T90:    case T90:
655    case sn7113:    case sn7113:
656        echo "Configuring for T90"
657      set FC         = ( 'f90' )      set FC         = ( 'f90' )
658      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
659      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
# Line 432  switch ($platform$USEMPI) Line 676  switch ($platform$USEMPI)
676      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
677      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
678      breaksw      breaksw
679      case cg01+pgi:
680        set LN         = ( '/bin/ln -s' )
681        set CPP        = ( '/lib/cpp -traditional -P' )
682        set INCLUDES   = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' )
683        set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
684        set FC         = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
685        set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
686    #    set LIBS       = ( '-L/home/cnh/src/gm-1.4/libgm')
687        set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
688        set LINK       = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
689        breaksw
690      case SP3:
691    # originally from A. Biastoch, SIO.
692    # e.g. horizon.npaci.edu
693        echo "Configuring for IBM SP POWER3"
694        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
695        set LN         = ( 'ln -s' )
696        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
697        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
698    #    set CPP        = ( '/lib/cpp' )
699        set FC         = ( 'mpxlf95' )
700        set LINK       = ( 'mpxlf95' )
701        set FLAGS      = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
702                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
703        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
704                               '-bmaxdata:0x80000000 ' )
705        set LDFLAGS    = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
706                               '-bmaxdata:0x80000000' )
707        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
708    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
709    #    set FOPTIM     = ( '-O3' )
710    #   set NOOPTFLAGS = ( '-O0' )
711    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
712    #                      'external_fields_load.F' )
713        set RMFILES    = ( 'rii_files' )
714        breaksw
715      case SP4:
716    #ph: e.g. bluesky.ucar.edu, marcellus.navo.hpc.mil
717        echo "Configuring for IBM SP POWER4"
718        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
719        set LN         = ( 'ln -s' )
720        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
721        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
722    #    set CPP        = ( '/lib/cpp' )
723        set FC         = ( 'mpxlf95' )
724        set LINK       = ( 'mpxlf95' )
725        set FLAGS      = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
726                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
727        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
728                               '-bmaxdata:0x80000000 ' )
729        set LDFLAGS    = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
730                               '-bmaxdata:0x80000000' )
731        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
732    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
733    #    set FOPTIM     = ( '-O3' )
734    #   set NOOPTFLAGS = ( '-O0' )
735    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
736    #                      'external_fields_load.F' )
737        set RMFILES    = ( 'rii_files' )
738        breaksw
739      case aer-linux-cluster+mpi
740        echo "Configuring for " $platform
741        set LN         = ( '/bin/ln -s' )
742        set CPP        = ( '/lib/cpp  -traditional -P' )
743        set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
744        set FC         = ( '/opt/mpich/bin/mpif77' )
745        set LINK       = ( '/opt/mpich/bin/mpif77' )
746        set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
747        set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
748        set LIBS       = ( '-L/opt/mpich/lib/ -lfmpich -lmpich' )
749        set INCLUDES   = ( '-I/opt/mpich/include' )
750        breaksw
751      case gfdl-sgi-o3k
752        echo "Configuring for " $platform
753        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
754        set FFLAGS     = ( 'extend_source -mp -mpio -bytereclen -mips4 -r8 -static' )
755        set FOPTIM     = ( '-O3' )
756        set LIBS       = ( '-lmpi' )
757        set INCLUDES   = ( '-I/opt/mpt/1510/usr/include' )
758        breaksw
759      default:
760        echo "Error: platform not recognized: uname -p = " $platform$USEMPI
761        exit
762        breaksw
763    default:    default:
764      echo "Error: platform not recognized: uname -p = " $platform$USEMPI      echo "Error: platform not recognized: uname -p = " $platform$USEMPI
765      exit      exit
# Line 456  echo "# This section creates symbolic li Line 784  echo "# This section creates symbolic li
784  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
785  echo -n 'SRCFILES = ' > srclist.inc  echo -n 'SRCFILES = ' > srclist.inc
786  echo -n 'CSRCFILES = ' > csrclist.inc  echo -n 'CSRCFILES = ' > csrclist.inc
787  #echo -n 'HEADERFILES = ' > hlist.inc  echo -n 'HEADERFILES = ' > hlist.inc
788  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
789   set deplist=( )   set deplist=( )
790   foreach srcfile (`cd $dr; ls *.[hcF]`)   foreach srcfile (`cd $dr; ls *.[hcF]`)
791    if (! -r .links.tmp/$srcfile) then    if (! -r .links.tmp/$srcfile) then
# Line 476  foreach dr ($SOURCEDIRS) Line 804  foreach dr ($SOURCEDIRS)
804       echo -n "           " $srcfile >> csrclist.inc       echo -n "           " $srcfile >> csrclist.inc
805       breaksw       breaksw
806      case h:      case h:
807  #     touch .links.tmp/$srcfile        touch .links.tmp/$srcfile
808  #     set deplist=($deplist $srcfile)        set deplist=($deplist $srcfile)
809  #     echo    ' \'                   >> hlist.inc        echo    ' \'                   >> hlist.inc
810  #     echo -n "           " $srcfile >> hlist.inc        echo -n "           " $srcfile >> hlist.inc
811       breaksw       breaksw
812      endsw      endsw
813     endif     endif
# Line 494  end Line 822  end
822  rm -rf .links.tmp  rm -rf .links.tmp
823  echo "" >> srclist.inc  echo "" >> srclist.inc
824  echo "" >> csrclist.inc  echo "" >> csrclist.inc
825  #echo "" >> hlist.inc  echo "" >> hlist.inc
826    
827  set THISHOSTNAME = ( `hostname` )  set THISHOSTNAME = ( `hostname` )
828  set THISCWD = ( `pwd` )  set THISCWD = ( `pwd` )
# Line 523  cat >> ${mfile} <<EOF Line 851  cat >> ${mfile} <<EOF
851  # CPP          : C-preprocessor command  # CPP          : C-preprocessor command
852  # INCLUDES     : Directories searched for header files  # INCLUDES     : Directories searched for header files
853  # DEFINES      : Macro definitions for CPP  # DEFINES      : Macro definitions for CPP
854    # MAKEDEPEND   : Dependency generator
855  # KPP          : Special preprocessor command (specific to platform)  # KPP          : Special preprocessor command (specific to platform)
856  # KFLAGS       : Flags for KPP  # KFLAGS       : Flags for KPP
857  # FC           : Fortran compiler command  # FC           : Fortran compiler command
# Line 548  cat >> ${mfile} <<EOF Line 877  cat >> ${mfile} <<EOF
877  # extra stuff for Hyades ............................................  # extra stuff for Hyades ............................................
878  HYADES_DIR = /u/u0/cnh/jam-lib/software  HYADES_DIR = /u/u0/cnh/jam-lib/software
879  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
880    HYADES_DIR = /usr/local/jamlib/current/dual_proc
881  WORK_DIR   = \$(HYADES_DIR)  WORK_DIR   = \$(HYADES_DIR)
882  DEPOSIT_DIR = linux_bin  DEPOSIT_DIR = linux_bin
883    
# Line 579  cat >> ${mfile} <<EOF Line 909  cat >> ${mfile} <<EOF
909  # Unix ln (link)  # Unix ln (link)
910  LN = ${LN}  LN = ${LN}
911  # C preprocessor  # C preprocessor
912  CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}  CPP = cat \$< | ${S64} | ${CPP}
913    # Dependency generator
914    MAKEDEPEND = ${MAKEDEPEND}
915  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
916  KPP = ${KPP}  KPP = ${KPP}
917  # Fortran compiler  # Fortran compiler
# Line 597  KFLAGS2 = ${KFLAGS2} Line 929  KFLAGS2 = ${KFLAGS2}
929  # Optim./debug for FC  # Optim./debug for FC
930  FFLAGS = ${FFLAGS}  FFLAGS = ${FFLAGS}
931  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM}
932    # Flags for CC
933    CFLAGS = ${CFLAGS}
934  # Files that should not be optimized  # Files that should not be optimized
935  NOOPTFILES = ${NOOPTFILES}  NOOPTFILES = ${NOOPTFILES}
936  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
# Line 607  EOF Line 941  EOF
941    
942  cat srclist.inc  >> ${mfile}  cat srclist.inc  >> ${mfile}
943  cat csrclist.inc >> ${mfile}  cat csrclist.inc >> ${mfile}
944    cat hlist.inc >> ${mfile}
945  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}
946  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
947    
948  rm -f srclist.inc csrclist.inc flist.tmp clist.tmp  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
949    
950  cat >> ${mfile} <<EOF  cat >> ${mfile} <<EOF
951    
# Line 622  all: \$(EXECUTABLE) Line 957  all: \$(EXECUTABLE)
957          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
958  depend:  depend:
959          @make links          @make links
960          makedepend -o .f \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
961    
962  links: \$(SRCFILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
963    
964  small_f: \$(F77FILES)  small_f: \$(F77FILES)
965    
966    output.txt: \$(EXECUTABLE)
967            @printf 'running ... '
968            @\$(EXECUTABLE) > \$@
969    
970  clean:  clean:
971          -rm -rf *.o *.f *.p ${RMFILES}          -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
972  Clean:  Clean:
973          @make clean          @make clean
974          @make cleanlinks          @make cleanlinks
# Line 638  CLEAN: Line 977  CLEAN:
977          @make Clean          @make Clean
978          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
979          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
980            -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
981          -rm -f \$(EXECUTABLE)          -rm -f \$(EXECUTABLE)
982    
983  makefile:  makefile:
# Line 650  cleanlinks: Line 990  cleanlinks:
990          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
991  .f.o:  .f.o:
992          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
993    .c.o:
994            \$(CC) \$(CFLAGS) -c \$<
995    
996  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
997  .F.p:  .F.p:

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.87

  ViewVC Help
Powered by ViewVC 1.1.22