/[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.83 by dimitri, Wed Sep 17 18:24:51 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 )
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 -fc:
104     case -fc=:
105       echo "To change the compiler (\$FC) you must specify one with -fc="
106       echo "eg. -fc=f90  or  -fc=g77"
107       exit
108       breaksw
109     case -fc*:
110       if ($?FC) then
111        echo Option -fc=... can only be specified once.; exit 1
112       endif
113       set FC = ( `echo $arg | sed 's/-fc=//' `)
114       breaksw
115   case -help:   case -help:
116     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]"     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
117    cat << EOF
118    
119    $0 is used to generate the Makefile in the current directory.
120    
121    Typical invocations are:
122     o from "bin":   ../tools/genmake
123     o from "verification/expt/code": ../../../tools/genmake
124     o from "verification/expt/input": ../../../tools/genmake -mods=../code
125     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
126       or  ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
127    
128    Packages (collected modules of code)  can be disabled to avoid unnecessary
129    compilation of unused code. For instance if you know you will not
130    use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
131    configuration:
132       .../tools/genmake -disable=gmredi,kpp,obcs
133    
134    If you add some source files you can re-call the previous instance of
135    genmake with "make makefile".
136    
137    genmake also reads the file .genmakerc which can be used to configure
138    options (primarily the command-line options above) for particular experiments.
139    EOF
140     exit     exit
141     breaksw     breaksw
142   default:   default:
# Line 105  end Line 153  end
153  # If platform wasn't specified then determine platform type of the host  # If platform wasn't specified then determine platform type of the host
154  if (! $?platform) then  if (! $?platform) then
155   set platform = (`uname`)   set platform = (`uname`)
156    # This let's us distinguish between different Linux platforms
157     if ($platform == Linux) then
158      set machine = (`uname -m`)
159      set platform = ($platform'-'$machine)
160     endif
161  endif  endif
162  # If name of makefile wasn't specified then use default "Makefile"  # If name of makefile wasn't specified then use default "Makefile"
163  if (! $?mfile) set mfile = ( Makefile )  if (! $?mfile) set mfile = ( Makefile )
# Line 112  if (! $?mfile) set mfile = ( Makefile ) Line 165  if (! $?mfile) set mfile = ( Makefile )
165  set mach  = ( `uname -a` )  set mach  = ( `uname -a` )
166  echo Operating system: $mach  echo Operating system: $mach
167    
   
168  # Directories for source, includes, binaries and executables  # Directories for source, includes, binaries and executables
169  #  #
170  # 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 197  endif
197  # source code in the standard directories  # source code in the standard directories
198  if (! $?MODS) then  if (! $?MODS) then
199   set SOURCEDIRS  = ( )   set SOURCEDIRS  = ( )
200   set INCLUDEDIRS = ( . )   set INCLUDEDIRS = ( )
201  else  else
202   set SOURCEDIRS  = ( $MODS )   set SOURCEDIRS  = ( $MODS )
203   set INCLUDEDIRS = ( . $MODS )   set INCLUDEDIRS = ( $MODS )
204  endif  endif
205  if (! $?BUILDDIR) set BUILDDIR = ( . )  if (! $?BUILDDIR) set BUILDDIR = ( . )
206  if (! -d $BUILDDIR) then  if (! -d $BUILDDIR) then
# Line 171  if (! -d $TOOLSDIR) then Line 223  if (! -d $TOOLSDIR) then
223  endif  endif
224  if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )  if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )
225    
226    # We have a special set of source files in eesupp/src which
227    # are generated from some template source files. We'll make them
228    # first so the appear as regular source code
229    if (-r $ROOTDIR/eesupp/src/Makefile) then
230     echo Making source files in eesupp from templates...
231     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
232     if ($status == 0) then
233       rm -f make_eesupp.errs
234     else
235       cat make_eesupp.errs
236       exit 2
237     endif
238    endif
239    
240  # Now scan the standard source code tree  # Now scan the standard source code tree
241  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS)
242    set adr=$dr    set adr=$dr
243    if (! -d $adr) then    if (! -d $adr) then
244      echo mods directory $adr not found.; exit 1      echo mods directory $adr not found.; exit 1
245    endif    endif
246    echo Adding mods directory $adr    echo Adding mods dir: $adr
247  end  end
248  if (! $?PACKAGES) then  if (! $?PACKAGES) then
249    set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`)    set PACKAGES=()
250      foreach pkg (`cd $ROOTDIR/pkg; find . -type d -print | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
251       if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
252      end
253  endif  endif
254  foreach dr ($PACKAGES)  foreach dr ($PACKAGES)
255    set enable    set enable
# Line 191  foreach dr ($PACKAGES) Line 260  foreach dr ($PACKAGES)
260     endif     endif
261     if ($dr == $p) unset enable     if ($dr == $p) unset enable
262     if ($p == 'all') unset enable     if ($p == 'all') unset enable
263    #  The following allows entire trees to be disabled
264       if ($dr:h == $p) unset enable
265       if ($dr:h:h == $p) unset enable
266       if ($dr:h:h:h == $p) unset enable
267       if ($dr:h:h:h:h == $p) unset enable
268    end    end
269    foreach p ($ENABLE)    foreach p ($ENABLE)
270     if ($dr == $p) set enable     if ($dr == $p) set enable
# Line 200  foreach dr ($PACKAGES) Line 274  foreach dr ($PACKAGES)
274      if (! -d $adr) then      if (! -d $adr) then
275        echo Source directory $adr not found.; exit 1        echo Source directory $adr not found.; exit 1
276      endif      endif
277      echo Adding package directory $adr      echo Adding pkg dir: $adr
278      set SOURCEDIRS = ($SOURCEDIRS $adr)      set SOURCEDIRS = ($SOURCEDIRS $adr)
279      set INCLUDEDIRS = ($INCLUDEDIRS $adr)      set INCLUDEDIRS = ($INCLUDEDIRS $adr)
280        switch ($dr)
281          case ptracers:
282            set DEFINES = ($DEFINES '-DALLOW_PTRACERS'); breaksw
283          default:
284            breaksw
285        endsw
286    else    else
287      echo "*" Package \"$dr\" has not been enabled.      echo "                                      *" Package \"$dr\" NOT enabled.
288        switch ($dr)
289          case mom_fluxform:
290            set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
291          case mom_vecinv:
292            set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
293          case generic_advdiff:
294            set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
295          case debug:
296            set DEFINES = ($DEFINES '-DDISABLE_DEBUGMODE'); breaksw
297          default:
298            breaksw
299        endsw
300    endif    endif
301  end  end
302  if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags)  if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
303  foreach dr ($STANDARDDIRS)  foreach dr ($STANDARDDIRS)
304    set adr=$ROOTDIR/$dr/src    set adr=$ROOTDIR/$dr/src
305    if (! -d $adr) then    if (! -d $adr) then
306      echo Source directory $adr not found.; exit 1      echo Source directory $adr not found.; exit 1
307    endif    endif
308    echo Adding source directory $adr    echo Adding src dir: $adr
309    set SOURCEDIRS = ($SOURCEDIRS $adr)    set SOURCEDIRS = ($SOURCEDIRS $adr)
310    set idr = `echo $adr | sed 's/src/inc/'`    set idr = `echo $adr | sed 's/src/inc/'`
311    set INCLUDEDIRS = ($INCLUDEDIRS $idr)    set INCLUDEDIRS = ($INCLUDEDIRS $idr)
312  end  end
313    
314    # Find possible compilers
315    if ($?FC) then
316     echo "$FC was specified as the compiler"
317    else
318     echo " "
319     switch ($platform)
320      case Linux*:
321       set likelysuspects=(g77 ifc pgf77 f77 f90 f95)
322       breaksw
323      default:
324       set likelysuspects=(f77)
325       breaksw
326     endsw
327     foreach fc ($likelysuspects)
328      set foundfc=`which $fc |& cat - `
329      if (-x $foundfc[1]) then
330       if ($?possiblefc) then
331        set possiblefc=($possiblefc $fc)
332       else
333        set possiblefc=$fc
334       endif
335      endif
336     end
337     if ($?possiblefc) then
338      set FC=$possiblefc[1]
339      echo Found these compilers: $possiblefc.  Using \"$FC\" as the compiler
340     else
341      echo "No compiler found\!"
342      echo I tried looking for \"$likelysuspects\" in your \$PATH but found none
343      echo I will continue anyway and see what happens.
344      set FC = ( 'f77' )
345    # exit 13
346     endif
347    endif
348    
349  # This is the generic configuration.  # This is the generic configuration.
350  # Platform specific options are chosen below  # Platform specific options are chosen below
351  set LN         = ( 'ln -s' )  set LN         = ( 'ln -s' )
352  set CPP        = ( '/lib/cpp -P' )  set CPP        = ( '/lib/cpp -P' )
353    set S64        = ( '$(TOOLSDIR)/set64bitConst.sh' )
354  set KPP        = (  )  set KPP        = (  )
355  set FC         = ( 'f77' )  #set FC         = ( 'f77' )
356  set LINK       = ( 'f77' )  set LINK       = $FC
357  set DEFINES    = (  )  set MAKEDEPEND = ( 'makedepend' )
358  set INCLUDES   = (  )  set INCLUDES   = ( -I. )
359  set FFLAGS     = (  )  set FFLAGS     = (  )
360  set FOPTIM     = (  )  set FOPTIM     = (  )
361    set CFLAGS     = (  )
362  set KFLAGS1    = (  )  set KFLAGS1    = (  )
363  set KFLAGS2    = (  )  set KFLAGS2    = (  )
364  set LIBS       = (  )  set LIBS       = (  )
365  set KPPFILES   = (  )  set KPPFILES   = (  )
366  set NOOPTFILES = (  )  if (! $?NOOPTFILES ) set NOOPTFILES = (  )
367  set NOOPTFLAGS = (  )  if (! $?NOOPTFLAGS ) set NOOPTFLAGS = (  )
368  set RMFILES    = (  )  set RMFILES    = (  )
369    
370  # 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 249  endif Line 378  endif
378    
379  # Platform specific options  # Platform specific options
380  switch ($platform$USEMPI)  switch ($platform$USEMPI)
   case OSF1:  
381    case OSF1+mpi:    case OSF1+mpi:
382    #ph: e.g. halem.gsfc.nasa.gov
383        echo "Configuring for DEC Alpha with MPI"
384        set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
385    #ph: -lkmp_osfp10 not needed on some/many platforms
386      case OSF1:
387      echo "Configuring for DEC Alpha"      echo "Configuring for DEC Alpha"
388      set CPP        = ( '/usr/bin/cpp -P' )      set CPP        = ( '/usr/bin/cpp -P' )
389      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )
390      set KPP        = ( 'kapf' )      set MAKEDEPEND = ( mkdep -f depend.out )
391      set KPPFILES   = ( 'main.F' )  #ph: makedepend not available on some/many DEC Alpha's; use mkdep instead
392      set KFLAGS1    = ( '-scan=132 -noconc -cmp=' )      set KPP        = ( )
393        set KPPFILES   = ( )
394        set KFLAGS1    = ( )
395      set FC         = ( 'f77' )      set FC         = ( 'f77' )
396      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' )
397      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )
398    #ph: -O5 probably too aggressive in conjunction with adjoint code
399      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
     set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )  
400      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
401      set RMFILES    = ( '*.p.out' )      set RMFILES    = ( '*.p.out' )
402      breaksw      breaksw
# Line 279  switch ($platform$USEMPI) Line 414  switch ($platform$USEMPI)
414      echo "Configuring for SGI Mips"      echo "Configuring for SGI Mips"
415      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
416      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
417      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
418      set FOPTIM     = ( '-O3' )      set FOPTIM     = ( '-O3' )
419  #   set NOOPTFLAGS = ( '-O0' )      if ($?IEEE) set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -static' )
420  #   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' )  
421      set RMFILES    = ( 'rii_files' )      set RMFILES    = ( 'rii_files' )
422      breaksw      breaksw
423    case o2:    case o2:
# Line 309  switch ($platform$USEMPI) Line 443  switch ($platform$USEMPI)
443      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
444      set INCLUDES   = ( '-I/usr/include' )      set INCLUDES   = ( '-I/usr/include' )
445      set FFLAGS     = ( '-n32 -extend_source -bytereclen' )      set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
446      set FOPTIM     = ( '-O2' )      set FOPTIM     = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
     set NOOPTFILES = ( 'calc_mom_rhs.F' )  
     set NOOPTFLAGS = ( '-O1' )  
447      set LIBS       = ( '-lmpi -lscs' )      set LIBS       = ( '-lmpi -lscs' )
448      breaksw      breaksw
449      case o2k_noopt:
450      case o2k_noopt+mpi:
451        echo "Configuring for SGI Origin2000 running IRIX 6.5"
452        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
453        set INCLUDES   = ( '-I/usr/include' )
454        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
455        set FOPTIM     = ( '-O0' )
456        set LIBS       = ( '-lmpi' )
457        breaksw
458      case ames_dbg+mpi:
459        echo "Configuring for SGI Origin2000 running IRIX 6.5"
460        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
461        set INCLUDES   = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
462        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
463        set LIBS       = ( '-lmpi -lscs' )
464        set FC         = ( 'f90' )
465        set LINK       = ( 'f90' )
466        breaksw
467      case ames_opt+mpi:
468        echo "Configuring for SGI Origin2000 running IRIX 6.5"
469        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
470        set INCLUDES   = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
471        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
472        set FOPTIM     = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
473        set LIBS       = ( '-lmpi -lscs' )
474        set FC         = ( 'f90' )
475        set LINK       = ( 'f90' )
476        breaksw
477    case onyx:    case onyx:
478    case onyx+mpi:    case onyx+mpi:
479      echo "Configuring for SGI ONYX running IRIX64"      echo "Configuring for SGI ONYX running IRIX64"
# Line 327  switch ($platform$USEMPI) Line 487  switch ($platform$USEMPI)
487    case SunOS:    case SunOS:
488      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
489      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
490      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
491      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
492      set FOPTIM     = ( '-fast -O3' )      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
493      set NOOPTFLAGS = ( '-O0' )      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
494      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')      set CFLAGS     = ( '-dalign -O3 -xarch=v9' )
495        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
496        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 ')
497      breaksw      breaksw
498    case SunOS+mpi:    case SunOS+mpi:
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 DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
502      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' )  
503      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
504        set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
505        set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
506        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
507                         '-lsocket -lnsl' )                         '-lsocket -lnsl' )
508      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')
509        breaksw
510      case SunFire+mpi:
511        set FC         = ( 'mpf77' )  
512        set LINK       = ( 'mpf77' )
513        set LN         = ( '/usr/bin/ln -s' )
514        set CPP        = ( '/usr/ccs/lib/cpp -P' )
515        set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
516        set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
517        set INCLUDES   = ( '-I/opt/SUNWhpc/include' )
518        set LIBS       = ( '-lmpi -lthread -lsocket -lnsl' )
519        set FFLAGS     = ( '-e -u -noautopar ' \
520                           '-xtypemap=real:64,double:64,integer:32 -fsimple=0' )
521        set FOPTIM     = ( '-dalign -O4 -xarch=native' )
522        set CFLAGS     = ( '-dalign -xO4 -xarch=native' )
523        set NOOPTFLAGS = ( '-dalign -O0 -xarch=native' )
524      breaksw      breaksw
525    case IRIX32:    case IRIX32:
526      echo "Configuring for SGI ONYX running IRIX64"      echo "Configuring for SGI ONYX running IRIX64"
# Line 371  switch ($platform$USEMPI) Line 548  switch ($platform$USEMPI)
548      set NOOPTFILES = ( 'barrier.F different_multiple.F' \      set NOOPTFILES = ( 'barrier.F different_multiple.F' \
549                         'external_fields_load.F' )                         'external_fields_load.F' )
550      breaksw      breaksw
551    case Linux+mpi:    case Linux-ia64+mpi:
552        echo "Configuring with MPI"
553      case Linux-ia64:
554        echo "Configuring for " $platform
555        set LN = ( '/bin/ln -s' )
556        set CPP = ( '/lib/cpp -traditional -P' )
557        set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
558        set FC = ( 'efc' )
559        set FFLAGS = ( '-WB -Vaxlib -u -w' )
560        set FOPTIM = ( '-O2 ' )
561        set LINK = ( 'efc' )
562        set LIBS       = ( '-lmpi -lscs -lpthread' )
563        breaksw
564      case Linux-alpha+mpi:
565        echo "Configuring with MPI"
566      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
567      set INCLUDES   = ( '-I/usr/local/include' )      set INCLUDES   = ( '-I/usr/local/include' )
568    case Linux:    case Linux-alpha:
569        echo "Configuring for " $platform
570      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
571      set CPP        = ( '/lib/cpp  -traditional -P' )      set CPP        = ( '/lib/cpp  -traditional -P' )
572      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
573      set FC         = ( 'g77' )      set FC         = ( 'g77' )
574      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )      set FFLAGS     = ( ' ' )
575      set FOPTIM     = ( '-O3 -malign-double -funroll-loops ' )      if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
576        set FOPTIM     = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
577      set LINK       = ( 'g77' )      set LINK       = ( 'g77' )
578      breaksw      breaksw
579    case Linux+pgi+mpi:    case Linux*+pgi+mpi:
580      if ($?include_jam_libs) then      if ($?include_jam_libs) then
581       set INCLUDES   = ( '-I/usr/local//mpich-cnh-install/include' )       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
582       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' )
583      else      else
584       set INCLUDES   = ( '-I/usr/local/include' )       set INCLUDES   = ( '-I/usr/local/include' )
585       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
586      endif      endif
587    case Linux+pgi:    case Linux*+pgi:
588        echo "Configuring for " $platform
589      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
590      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
591      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
# Line 400  switch ($platform$USEMPI) Line 594  switch ($platform$USEMPI)
594      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
595      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
596      breaksw      breaksw
597      case Linux*+mpi:
598        set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
599        set INCLUDES   = ( '-I/usr/local/include' )
600      case Linux*:
601        echo "Configuring for " $platform
602        set LN         = ( '/bin/ln -s' )
603        set CPP        = ( '/lib/cpp  -traditional -P' )
604        switch ($FC)
605         case g77:
606          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
607          set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )
608          if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
609          set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )
610          set NOOPTFLAGS = ( '-O0' )
611          breaksw
612         case pgf77:
613          set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
614          set FC         = ( 'pgf77' )
615          set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
616          set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
617          breaksw
618         case ifc:
619          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
620          set FFLAGS     = ( '-132 -r8 -i4 -w95 -W0 -WB' )
621          if ($?IEEE) set FFLAGS     = ( $FFLAGS '-mp' )
622          set FOPTIM     = ( '-O3 -align' )
623    #P3   set FOPTIM     = ( $FOPTIM '-tpp6 -xWKM' )
624    #P4   set FOPTIM     = ( $FOPTIM '-tpp7 -xWKM' )
625          set LIBS       = ( '-lPEPCF90' )
626          breaksw
627         default:
628          echo Error: Linux compiler not recognized: \$FC=$FC
629          exit
630          breaksw
631        endsw      
632        breaksw
633    case T3E:    case T3E:
634    case sn6312:    case sn6312:
635        echo "Configuring for T3E"
636      set CPP        = ( '/opt/ctl/bin/cpp -P')      set CPP        = ( '/opt/ctl/bin/cpp -P')
637      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
638      set FC         = ( 'f90' )      set FC         = ( 'f90' )
# Line 410  switch ($platform$USEMPI) Line 641  switch ($platform$USEMPI)
641      breaksw      breaksw
642    case T90:    case T90:
643    case sn7113:    case sn7113:
644        echo "Configuring for T90"
645      set FC         = ( 'f90' )      set FC         = ( 'f90' )
646      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
647      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
# Line 432  switch ($platform$USEMPI) Line 664  switch ($platform$USEMPI)
664      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
665      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
666      breaksw      breaksw
667      case cg01+pgi:
668        set LN         = ( '/bin/ln -s' )
669        set CPP        = ( '/lib/cpp -traditional -P' )
670        set INCLUDES   = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' )
671        set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
672        set FC         = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
673        set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
674    #    set LIBS       = ( '-L/home/cnh/src/gm-1.4/libgm')
675        set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
676        set LINK       = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
677        breaksw
678      case SP3:
679    # originally from A. Biastoch, SIO.
680    # e.g. horizon.npaci.edu
681        echo "Configuring for IBM SP POWER3"
682        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
683        set LN         = ( 'ln -s' )
684        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
685        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
686    #    set CPP        = ( '/lib/cpp' )
687        set FC         = ( 'mpxlf95' )
688        set LINK       = ( 'mpxlf95' )
689        set FLAGS      = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
690                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
691        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
692                               '-bmaxdata:0x80000000 ' )
693        set LDFLAGS    = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
694                               '-bmaxdata:0x80000000' )
695        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
696    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
697    #    set FOPTIM     = ( '-O3' )
698    #   set NOOPTFLAGS = ( '-O0' )
699    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
700    #                      'external_fields_load.F' )
701        set RMFILES    = ( 'rii_files' )
702        breaksw
703      case SP4:
704    #ph: e.g. bluesky.ucar.edu, marcellus.navo.hpc.mil
705        echo "Configuring for IBM SP POWER4"
706        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
707        set LN         = ( 'ln -s' )
708        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
709        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
710    #    set CPP        = ( '/lib/cpp' )
711        set FC         = ( 'mpxlf95' )
712        set LINK       = ( 'mpxlf95' )
713        set FLAGS      = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
714                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
715        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
716                               '-bmaxdata:0x80000000 ' )
717        set LDFLAGS    = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
718                               '-bmaxdata:0x80000000' )
719        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
720    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
721    #    set FOPTIM     = ( '-O3' )
722    #   set NOOPTFLAGS = ( '-O0' )
723    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
724    #                      'external_fields_load.F' )
725        set RMFILES    = ( 'rii_files' )
726        breaksw
727      case aer-linux-cluster+mpi
728        echo "Configuring for " $platform
729        set LN         = ( '/bin/ln -s' )
730        set CPP        = ( '/lib/cpp  -traditional -P' )
731        set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
732        set FC         = ( '/opt/mpich/bin/mpif77' )
733        set LINK       = ( '/opt/mpich/bin/mpif77' )
734        set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
735        set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
736        set LIBS       = ( '-L/opt/mpich/lib/ -lfmpich -lmpich' )
737        set INCLUDES   = ( '-I/opt/mpich/include' )
738        breaksw
739    default:    default:
740      echo "Error: platform not recognized: uname -p = " $platform$USEMPI      echo "Error: platform not recognized: uname -p = " $platform$USEMPI
741      exit      exit
# Line 456  echo "# This section creates symbolic li Line 760  echo "# This section creates symbolic li
760  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
761  echo -n 'SRCFILES = ' > srclist.inc  echo -n 'SRCFILES = ' > srclist.inc
762  echo -n 'CSRCFILES = ' > csrclist.inc  echo -n 'CSRCFILES = ' > csrclist.inc
763  #echo -n 'HEADERFILES = ' > hlist.inc  echo -n 'HEADERFILES = ' > hlist.inc
764  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
765   set deplist=( )   set deplist=( )
766   foreach srcfile (`cd $dr; ls *.[hcF]`)   foreach srcfile (`cd $dr; ls *.[hcF]`)
767    if (! -r .links.tmp/$srcfile) then    if (! -r .links.tmp/$srcfile) then
# Line 476  foreach dr ($SOURCEDIRS) Line 780  foreach dr ($SOURCEDIRS)
780       echo -n "           " $srcfile >> csrclist.inc       echo -n "           " $srcfile >> csrclist.inc
781       breaksw       breaksw
782      case h:      case h:
783  #     touch .links.tmp/$srcfile        touch .links.tmp/$srcfile
784  #     set deplist=($deplist $srcfile)        set deplist=($deplist $srcfile)
785  #     echo    ' \'                   >> hlist.inc        echo    ' \'                   >> hlist.inc
786  #     echo -n "           " $srcfile >> hlist.inc        echo -n "           " $srcfile >> hlist.inc
787       breaksw       breaksw
788      endsw      endsw
789     endif     endif
# Line 494  end Line 798  end
798  rm -rf .links.tmp  rm -rf .links.tmp
799  echo "" >> srclist.inc  echo "" >> srclist.inc
800  echo "" >> csrclist.inc  echo "" >> csrclist.inc
801  #echo "" >> hlist.inc  echo "" >> hlist.inc
802    
803  set THISHOSTNAME = ( `hostname` )  set THISHOSTNAME = ( `hostname` )
804  set THISCWD = ( `pwd` )  set THISCWD = ( `pwd` )
# Line 523  cat >> ${mfile} <<EOF Line 827  cat >> ${mfile} <<EOF
827  # CPP          : C-preprocessor command  # CPP          : C-preprocessor command
828  # INCLUDES     : Directories searched for header files  # INCLUDES     : Directories searched for header files
829  # DEFINES      : Macro definitions for CPP  # DEFINES      : Macro definitions for CPP
830    # MAKEDEPEND   : Dependency generator
831  # KPP          : Special preprocessor command (specific to platform)  # KPP          : Special preprocessor command (specific to platform)
832  # KFLAGS       : Flags for KPP  # KFLAGS       : Flags for KPP
833  # FC           : Fortran compiler command  # FC           : Fortran compiler command
# Line 548  cat >> ${mfile} <<EOF Line 853  cat >> ${mfile} <<EOF
853  # extra stuff for Hyades ............................................  # extra stuff for Hyades ............................................
854  HYADES_DIR = /u/u0/cnh/jam-lib/software  HYADES_DIR = /u/u0/cnh/jam-lib/software
855  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
856    HYADES_DIR = /usr/local/jamlib/current/dual_proc
857  WORK_DIR   = \$(HYADES_DIR)  WORK_DIR   = \$(HYADES_DIR)
858  DEPOSIT_DIR = linux_bin  DEPOSIT_DIR = linux_bin
859    
# Line 579  cat >> ${mfile} <<EOF Line 885  cat >> ${mfile} <<EOF
885  # Unix ln (link)  # Unix ln (link)
886  LN = ${LN}  LN = ${LN}
887  # C preprocessor  # C preprocessor
888  CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}  CPP = cat \$< | ${S64} | ${CPP}
889    # Dependency generator
890    MAKEDEPEND = ${MAKEDEPEND}
891  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
892  KPP = ${KPP}  KPP = ${KPP}
893  # Fortran compiler  # Fortran compiler
# Line 597  KFLAGS2 = ${KFLAGS2} Line 905  KFLAGS2 = ${KFLAGS2}
905  # Optim./debug for FC  # Optim./debug for FC
906  FFLAGS = ${FFLAGS}  FFLAGS = ${FFLAGS}
907  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM}
908    # Flags for CC
909    CFLAGS = ${CFLAGS}
910  # Files that should not be optimized  # Files that should not be optimized
911  NOOPTFILES = ${NOOPTFILES}  NOOPTFILES = ${NOOPTFILES}
912  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
# Line 607  EOF Line 917  EOF
917    
918  cat srclist.inc  >> ${mfile}  cat srclist.inc  >> ${mfile}
919  cat csrclist.inc >> ${mfile}  cat csrclist.inc >> ${mfile}
920    cat hlist.inc >> ${mfile}
921  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}
922  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
923    
924  rm -f srclist.inc csrclist.inc flist.tmp clist.tmp  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
925    
926  cat >> ${mfile} <<EOF  cat >> ${mfile} <<EOF
927    
# Line 622  all: \$(EXECUTABLE) Line 933  all: \$(EXECUTABLE)
933          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
934  depend:  depend:
935          @make links          @make links
936          makedepend -o .f \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
937    
938  links: \$(SRCFILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
939    
940  small_f: \$(F77FILES)  small_f: \$(F77FILES)
941    
942    output.txt: \$(EXECUTABLE)
943            @printf 'running ... '
944            @\$(EXECUTABLE) > \$@
945    
946  clean:  clean:
947          -rm -rf *.o *.f *.p ${RMFILES}          -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
948  Clean:  Clean:
949          @make clean          @make clean
950          @make cleanlinks          @make cleanlinks
# Line 638  CLEAN: Line 953  CLEAN:
953          @make Clean          @make Clean
954          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
955          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
956            -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
957          -rm -f \$(EXECUTABLE)          -rm -f \$(EXECUTABLE)
958    
959  makefile:  makefile:
# Line 650  cleanlinks: Line 966  cleanlinks:
966          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
967  .f.o:  .f.o:
968          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
969    .c.o:
970            \$(CC) \$(CFLAGS) -c \$<
971    
972  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
973  .F.p:  .F.p:

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

  ViewVC Help
Powered by ViewVC 1.1.22