/[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.28 by adcroft, Wed Feb 7 16:49:20 2001 UTC revision 1.72 by cheisey, Thu Nov 21 19:36:38 2002 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 )  set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk flt ptracers seaice therm_seaice bulk_force)
13    set DEFINES = ( )
14  set ENABLE  = ( )  set ENABLE  = ( )
15  set MODS  = ( )  set MODS  = ( )
16    
# Line 50  while ($#allargs) Line 52  while ($#allargs)
52      echo "***" Command line \"$arg\" will override this.      echo "***" Command line \"$arg\" will override this.
53     endif     endif
54     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
    if (! $?EXEDIR) set EXEDIR = ( . )  
55     breaksw     breaksw
56   case -mods:   case -mods:
57   case -mods=:   case -mods=:
# Line 80  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 88  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 106  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 113  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
171  # but if it was supplied then we should place the executable in the build dir  # but if it was supplied then we should place the executable in the build dir
172  if (! $?ROOTDIR) then  if (! $?ROOTDIR) then
173    set pwd=`pwd`    set pwd=`pwd`
174    if ($pwd:t == bin) then    if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
175      if (-d ../exe & -d ../model & -d ../eesupp & -d ../pkg) then      set ROOTDIR = ( .. )
       set ROOTDIR = ( .. )  
       if (! $?EXEDIR) set EXEDIR = ( ../exe )  
     else if (-d ../model & -d ../eesupp & -d ../pkg) then  
       echo In bin with no exe  
       if (! $?EXEDIR) set EXEDIR = ( . )  
     endif  
176    endif    endif
177  endif  endif
178  # Scan for logical ROOTDIR  # Scan for logical ROOTDIR
# Line 135  if (! $?ROOTDIR) then Line 180  if (! $?ROOTDIR) then
180    foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)    foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)
181      if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then      if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then
182        set ROOTDIR = $dr        set ROOTDIR = $dr
       if (! $?EXEDIR) set EXEDIR = ( . )  
183        echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"        echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"
184        break        break
185      endif      endif
# Line 153  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
207    echo Build directory $BUILDDIR not found.;exit 1    echo Build directory $BUILDDIR not found.;exit 1
208  endif  endif
209    if (! $?EXEDIR) then
210      set pwd=`pwd`
211      if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then
212       set EXEDIR = ( ../exe )
213      else
214       set EXEDIR = ( . )
215      endif
216    endif
217  if (! -d $EXEDIR) then  if (! -d $EXEDIR) then
218    echo Executable directory $EXEDIR not found.;exit 1    echo Executable directory $EXEDIR not found.;exit 1
219  endif  endif
# 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
 end  
 if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags)  
 foreach dr ($STANDARDDIRS)  
   set adr=$ROOTDIR/$dr/src  
   if (! -d $adr) then  
     echo Source directory $adr not found.; exit 1  
   endif  
   echo Adding source directory $adr  
   set SOURCEDIRS = ($SOURCEDIRS $adr)  
   set idr = `echo $adr | sed 's/src/inc/'`  
   set INCLUDEDIRS = ($INCLUDEDIRS $idr)  
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
256    foreach p ($DISABLE)    foreach p ($DISABLE)
257       if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
258         echo Specified package \"$p\" does not exist.
259         exit 1
260       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 207  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
301    end
302    if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
303    foreach dr ($STANDARDDIRS)
304      set adr=$ROOTDIR/$dr/src
305      if (! -d $adr) then
306        echo Source directory $adr not found.; exit 1
307    endif    endif
308      echo Adding src dir: $adr
309      set SOURCEDIRS = ($SOURCEDIRS $adr)
310      set idr = `echo $adr | sed 's/src/inc/'`
311      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       = (  )
# Line 245  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        echo "Configuring for DEC Alpha with MPI"
383        set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
384      case OSF1:
385      echo "Configuring for DEC Alpha"      echo "Configuring for DEC Alpha"
386      set CPP        = ( '/usr/bin/cpp -P' )      set CPP        = ( '/usr/bin/cpp -P' )
387      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )
388      set KPP        = ( 'kapf' )      set KPP        = ( )
389      set KPPFILES   = ( 'main.F' )      set KPPFILES   = ( )
390      set KFLAGS1    = ( '-scan=132 -noconc -cmp=' )      set KFLAGS1    = ( )
391      set FC         = ( 'f77' )      set FC         = ( 'f77' )
392      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' )
393      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )
394      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
     set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )  
395      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
396      set RMFILES    = ( '*.p.out' )      set RMFILES    = ( '*.p.out' )
397      breaksw      breaksw
# Line 275  switch ($platform$USEMPI) Line 409  switch ($platform$USEMPI)
409      echo "Configuring for SGI Mips"      echo "Configuring for SGI Mips"
410      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
411      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
412      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
413      set FOPTIM     = ( '-O3' )      set FOPTIM     = ( '-O3' )
414  #   set NOOPTFLAGS = ( '-O0' )  #   set NOOPTFLAGS = ( '-O0' )
415  #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \  #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
# Line 323  switch ($platform$USEMPI) Line 457  switch ($platform$USEMPI)
457    case SunOS:    case SunOS:
458      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
459      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
460      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
461      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
462      set FOPTIM     = ( '-fast -O3' )      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
463      set NOOPTFLAGS = ( '-O0' )      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
464      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')      set CFLAGS     = ( '-dalign -O3 -xarch=v9' )
465        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
466        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 ')
467      breaksw      breaksw
468    case SunOS+mpi:    case SunOS+mpi:
469      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
470      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
471      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
472      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' )  
473      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
474        set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
475        set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
476        set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
477                         '-lsocket -lnsl' )                         '-lsocket -lnsl' )
478      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')
479      breaksw      breaksw
480    case IRIX32:    case IRIX32:
481      echo "Configuring for SGI ONYX running IRIX64"      echo "Configuring for SGI ONYX running IRIX64"
# Line 367  switch ($platform$USEMPI) Line 503  switch ($platform$USEMPI)
503      set NOOPTFILES = ( 'barrier.F different_multiple.F' \      set NOOPTFILES = ( 'barrier.F different_multiple.F' \
504                         'external_fields_load.F' )                         'external_fields_load.F' )
505      breaksw      breaksw
506    case Linux+mpi:    case Linux-alpha+mpi:
507        echo "Configuring with MPI"
508      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
509      set INCLUDES   = ( '-I/usr/local/include' )      set INCLUDES   = ( '-I/usr/local/include' )
510    case Linux:    case Linux-alpha:
511        echo "Configuring for " $platform
512      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
513      set CPP        = ( '/lib/cpp  -traditional -P' )      set CPP        = ( '/lib/cpp  -traditional -P' )
514      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
515      set FC         = ( 'g77' )      set FC         = ( 'g77' )
516      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )      set FFLAGS     = ( ' ' )
517      set FOPTIM     = ( '-O3 -malign-double -funroll-loops ' )      if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
518        set FOPTIM     = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
519      set LINK       = ( 'g77' )      set LINK       = ( 'g77' )
520      breaksw      breaksw
521    case Linux+pgi+mpi:    case Linux*+pgi+mpi:
522      if ($?include_jam_libs) then      if ($?include_jam_libs) then
523       set INCLUDES   = ( '-I/usr/local//mpich-cnh-install/include' )       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
524       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' )
525      else      else
526       set INCLUDES   = ( '-I/usr/local/include' )       set INCLUDES   = ( '-I/usr/local/include' )
527       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
528      endif      endif
529    case Linux+pgi:    case Linux*+pgi:
530        echo "Configuring for " $platform
531      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
532      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
533      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
# Line 396  switch ($platform$USEMPI) Line 536  switch ($platform$USEMPI)
536      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
537      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
538      breaksw      breaksw
539      case Linux*+mpi:
540        set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
541        set INCLUDES   = ( '-I/usr/local/include' )
542      case Linux*:
543        echo "Configuring for " $platform
544        set LN         = ( '/bin/ln -s' )
545        set CPP        = ( '/lib/cpp  -traditional -P' )
546        switch ($FC)
547         case g77:
548          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
549          set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )
550          if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
551          set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )
552          breaksw
553         case pgf77:
554          set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
555          set FC         = ( 'pgf77' )
556          set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
557          set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
558          breaksw
559         case ifc:
560          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
561          set FFLAGS     = ( '-132 -r8 -i4 -w95 -W0 -WB' )
562          if ($?IEEE) set FFLAGS     = ( $FFLAGS '-mp' )
563          set FOPTIM     = ( '-O3 -align' )
564    #P3   set FOPTIM     = ( $FOPTIM '-tpp6 -xWKM' )
565    #P4   set FOPTIM     = ( $FOPTIM '-tpp7 -xWKM' )
566          set LIBS       = ( '-lPEPCF90' )
567          breaksw
568         default:
569          echo Error: Linux compiler not recognized: \$FC=$FC
570          exit
571          breaksw
572        endsw      
573        breaksw
574    case T3E:    case T3E:
575    case sn6312:    case sn6312:
576        echo "Configuring for T3E"
577      set CPP        = ( '/opt/ctl/bin/cpp -P')      set CPP        = ( '/opt/ctl/bin/cpp -P')
578      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
579      set FC         = ( 'f90' )      set FC         = ( 'f90' )
# Line 406  switch ($platform$USEMPI) Line 582  switch ($platform$USEMPI)
582      breaksw      breaksw
583    case T90:    case T90:
584    case sn7113:    case sn7113:
585        echo "Configuring for T90"
586      set FC         = ( 'f90' )      set FC         = ( 'f90' )
587      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
588      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
# Line 428  switch ($platform$USEMPI) Line 605  switch ($platform$USEMPI)
605      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
606      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
607      breaksw      breaksw
608      case cg01+pgi:
609        set LN         = ( '/bin/ln -s' )
610        set CPP        = ( '/lib/cpp -traditional -P' )
611        set INCLUDES   = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' )
612        set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
613        set FC         = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
614        set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
615    #    set LIBS       = ( '-L/home/cnh/src/gm-1.4/libgm')
616        set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
617        set LINK       = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
618        breaksw
619      case SP3:
620    # originally from A. Biastoch, SIO.
621        echo "Configuring for IBM SP POWER3"
622        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
623        set LN         = ( 'ln -s' )
624        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
625        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
626    #    set CPP        = ( '/lib/cpp' )
627        set FC         = ( 'mpxlf95' )
628        set LINK       = ( 'mpxlf95' )
629        set FLAGS      = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
630                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
631        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
632                               '-bmaxdata:0x80000000 ' )
633        set LDFLAGS    = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
634                               '-bmaxdata:0x80000000' )
635        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
636    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
637    #    set FOPTIM     = ( '-O3' )
638    #   set NOOPTFLAGS = ( '-O0' )
639    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
640    #                      'external_fields_load.F' )
641        set RMFILES    = ( 'rii_files' )
642        breaksw
643    default:    default:
644      echo "Error: platform not recognized: uname -p = " $platform$USEMPI      echo "Error: platform not recognized: uname -p = " $platform$USEMPI
645      exit      exit
# Line 452  echo "# This section creates symbolic li Line 664  echo "# This section creates symbolic li
664  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
665  echo -n 'SRCFILES = ' > srclist.inc  echo -n 'SRCFILES = ' > srclist.inc
666  echo -n 'CSRCFILES = ' > csrclist.inc  echo -n 'CSRCFILES = ' > csrclist.inc
667  #echo -n 'HEADERFILES = ' > hlist.inc  echo -n 'HEADERFILES = ' > hlist.inc
668  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
669   set deplist=( )   set deplist=( )
670   foreach srcfile (`cd $dr; ls *.[hcF]`)   foreach srcfile (`cd $dr; ls *.[hcF]`)
671    if (! -r .links.tmp/$srcfile) then    if (! -r .links.tmp/$srcfile) then
# Line 472  foreach dr ($SOURCEDIRS) Line 684  foreach dr ($SOURCEDIRS)
684       echo -n "           " $srcfile >> csrclist.inc       echo -n "           " $srcfile >> csrclist.inc
685       breaksw       breaksw
686      case h:      case h:
687  #     touch .links.tmp/$srcfile        touch .links.tmp/$srcfile
688  #     set deplist=($deplist $srcfile)        set deplist=($deplist $srcfile)
689  #     echo    ' \'                   >> hlist.inc        echo    ' \'                   >> hlist.inc
690  #     echo -n "           " $srcfile >> hlist.inc        echo -n "           " $srcfile >> hlist.inc
691       breaksw       breaksw
692      endsw      endsw
693     endif     endif
# Line 490  end Line 702  end
702  rm -rf .links.tmp  rm -rf .links.tmp
703  echo "" >> srclist.inc  echo "" >> srclist.inc
704  echo "" >> csrclist.inc  echo "" >> csrclist.inc
705  #echo "" >> hlist.inc  echo "" >> hlist.inc
706    
707  set THISHOSTNAME = ( `hostname` )  set THISHOSTNAME = ( `hostname` )
708  set THISCWD = ( `pwd` )  set THISCWD = ( `pwd` )
# Line 519  cat >> ${mfile} <<EOF Line 731  cat >> ${mfile} <<EOF
731  # CPP          : C-preprocessor command  # CPP          : C-preprocessor command
732  # INCLUDES     : Directories searched for header files  # INCLUDES     : Directories searched for header files
733  # DEFINES      : Macro definitions for CPP  # DEFINES      : Macro definitions for CPP
734    # MAKEDEPEND   : Dependency generator
735  # KPP          : Special preprocessor command (specific to platform)  # KPP          : Special preprocessor command (specific to platform)
736  # KFLAGS       : Flags for KPP  # KFLAGS       : Flags for KPP
737  # FC           : Fortran compiler command  # FC           : Fortran compiler command
# Line 544  cat >> ${mfile} <<EOF Line 757  cat >> ${mfile} <<EOF
757  # extra stuff for Hyades ............................................  # extra stuff for Hyades ............................................
758  HYADES_DIR = /u/u0/cnh/jam-lib/software  HYADES_DIR = /u/u0/cnh/jam-lib/software
759  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
760    HYADES_DIR = /usr/local/jamlib/current/dual_proc
761  WORK_DIR   = \$(HYADES_DIR)  WORK_DIR   = \$(HYADES_DIR)
762  DEPOSIT_DIR = linux_bin  DEPOSIT_DIR = linux_bin
763    
# Line 575  cat >> ${mfile} <<EOF Line 789  cat >> ${mfile} <<EOF
789  # Unix ln (link)  # Unix ln (link)
790  LN = ${LN}  LN = ${LN}
791  # C preprocessor  # C preprocessor
792  CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}  CPP = cat \$< | ${S64} | ${CPP}
793    # Dependency generator
794    MAKEDEPEND = ${MAKEDEPEND}
795  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
796  KPP = ${KPP}  KPP = ${KPP}
797  # Fortran compiler  # Fortran compiler
# Line 593  KFLAGS2 = ${KFLAGS2} Line 809  KFLAGS2 = ${KFLAGS2}
809  # Optim./debug for FC  # Optim./debug for FC
810  FFLAGS = ${FFLAGS}  FFLAGS = ${FFLAGS}
811  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM}
812    # Flags for CC
813    CFLAGS = ${CFLAGS}
814  # Files that should not be optimized  # Files that should not be optimized
815  NOOPTFILES = ${NOOPTFILES}  NOOPTFILES = ${NOOPTFILES}
816  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
# Line 603  EOF Line 821  EOF
821    
822  cat srclist.inc  >> ${mfile}  cat srclist.inc  >> ${mfile}
823  cat csrclist.inc >> ${mfile}  cat csrclist.inc >> ${mfile}
824    cat hlist.inc >> ${mfile}
825  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}
826  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
827    
828  rm -f srclist.inc csrclist.inc flist.tmp clist.tmp  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
829    
830  cat >> ${mfile} <<EOF  cat >> ${mfile} <<EOF
831    
# Line 618  all: \$(EXECUTABLE) Line 837  all: \$(EXECUTABLE)
837          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
838  depend:  depend:
839          @make links          @make links
840          makedepend -o .f \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
841  links: \$(SRCFILES)  
842    links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
843    
844  small_f: \$(F77FILES)  small_f: \$(F77FILES)
845    
846    output.txt: \$(EXECUTABLE)
847            @printf 'running ... '
848            @\$(EXECUTABLE) > \$@
849    
850  clean:  clean:
851          -rm -rf *.o *.f *.p ${RMFILES}          -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
852  Clean:  Clean:
853          @make clean          @make clean
854          -find . -type l -exec rm {} \;          @make cleanlinks
855          -rm -f Makefile.bak          -rm -f Makefile.bak
856  CLEAN:  CLEAN:
857          @make Clean          @make Clean
# Line 635  CLEAN: Line 859  CLEAN:
859          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
860          -rm -f \$(EXECUTABLE)          -rm -f \$(EXECUTABLE)
861    
862    makefile:
863            ${0} $argv
864    cleanlinks:
865            -find . -type l -exec rm {} \;
866    
867  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .f - .o  )
868  .F.f:  .F.f:
869          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
870  .f.o:  .f.o:
871          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
872    .c.o:
873            \$(CC) \$(CFLAGS) -c \$<
874    
875  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
876  .F.p:  .F.p:

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.72

  ViewVC Help
Powered by ViewVC 1.1.22