/[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.19 by heimbach, Tue Sep 12 19:20:35 2000 UTC revision 1.40 by adcroft, Mon Aug 6 15:11:03 2001 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
8  #   adapted by aja 06/98  #   adapted  by aja 06/98
9    #   modified by aja 01/00
10    
11    # Default lists
12    set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk )
13    set ENABLE  = ( )
14    set MODS  = ( )
15    
16    # Grab variables/lists from .genmakerc
17    if (-r .genmakerc) source .genmakerc
18    
19  # Process command-line arguments  # Process command-line arguments
20  set allargs=( $argv )  set allargs=( $argv )
# Line 24  while ($#allargs) Line 34  while ($#allargs)
34     exit     exit
35     breaksw     breaksw
36   case -platform*:   case -platform*:
37       if ($?platform) then
38        echo Option -platform=dir can only be specified once.; exit 1
39       endif
40     set platform = ( `echo $arg | sed 's/-platform=//' `)     set platform = ( `echo $arg | sed 's/-platform=//' `)
41     breaksw     breaksw
42     case -rootdir:
43     case -rootdir=:
44       echo "To specify root directory you must specify one with -rootdir=dir"
45       echo "with NO space eg. -rootdir=../../..  or  -rootdir=/usr/people/joe/src"
46       exit
47       breaksw
48     case -rootdir=*:
49       if ($?ROOTDIR) then
50        echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
51        echo "***" Command line \"$arg\" will override this.
52       endif
53       set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
54       breaksw
55     case -mods:
56     case -mods=:
57       echo "To specify an additional source directory you must specify one with -mods=dir"
58       echo "with NO space eg. -mods=../code  or  -mods=/usr/people/joe/src"
59       exit
60       breaksw
61     case -mods=*:
62       set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `)
63       breaksw
64     case -disable:
65     case -disable=:
66       echo "To disable packages from compilation use -disable=pkg1,pkg2"
67       echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)"
68       exit
69       breaksw
70     case -disable=*:
71       set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `)
72       breaksw
73     case -enable:
74     case -enable=:
75       echo "To enable packages from compilation use -enable=pkg1,pkg2"
76       echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)"
77       echo "-enable overrides -disable, ie. a package listed in both is enabled"
78       exit
79       breaksw
80     case -ieee:
81       set IEEE
82       breaksw
83     case -enable=*:
84       set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
85       breaksw
86   case -mpi:   case -mpi:
87     echo "Enabling MPI options"     echo "Enabling MPI options"
88     set USEMPI     set USEMPI
# Line 35  while ($#allargs) Line 92  while ($#allargs)
92     echo "Including paths to JAM libraries"     echo "Including paths to JAM libraries"
93     breaksw     breaksw
94   case -help:   case -help:
95     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]"
96    cat << EOF
97    
98    $0 is used to generate the Makefile in the current directory.
99    
100    Typical invocations are:
101     o from "bin":   ../tools/genmake
102     o from "verification/expt/code": ../../../tools/genmake
103     o from "verification/expt/input": ../../../tools/genmake -mods=../code
104     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
105       or  ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
106    
107    Packages (collected modules of code)  can be disabled to avoid unnecessary
108    compilation of unused code. For instance if you know you will not
109    use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
110    configuration:
111       .../tools/genmake -disable=gmredi,kpp,obcs
112    
113    If you add some source files you can re-call the previous instance of
114    genmake with "make makefile".
115    
116    genmake also reads the file .genmakerc which can be used to configure
117    options (primarily the command-line options above) for particular experiments.
118    EOF
119     exit     exit
120     breaksw     breaksw
121   default:   default:
# Line 47  while ($#allargs) Line 127  while ($#allargs)
127   shift allargs   shift allargs
128  end  end
129    
130  if ($?platform == 0) then  # Default actions/options
131    
132    # If platform wasn't specified then determine platform type of the host
133    if (! $?platform) then
134   set platform = (`uname`)   set platform = (`uname`)
135  endif  endif
136  if ($?mfile == 0) set mfile = ( Makefile.$platform )  # If name of makefile wasn't specified then use default "Makefile"
137    if (! $?mfile) set mfile = ( Makefile )
138    
139  set mach  = ( `uname -a` )  set mach  = ( `uname -a` )
140  echo Operating system: $mach  echo Operating system: $mach
141    
142  # Directories for source, includes, binaries and executables  # Directories for source, includes, binaries and executables
143  # Note  #
144  # o If you prefer/need everything under a single directory  # If -rootdir wasn't specified then assume script is being run from bin
145  #   copy everything in ../eesupp/src, ../model/src,  # but if it was supplied then we should place the executable in the build dir
146  #   ../eesupp/inc and ../model/inc into a directory and then  if (! $?ROOTDIR) then
147  #   edit the paths below to ./    set pwd=`pwd`
148  set SOURCEDIRS  = ( ../eesupp/src/ ../model/src/ ../diags/src/ ../pkg/*/ )    if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
149  set INCLUDEDIRS = ( ./ ../eesupp/inc/ ../model/inc/ ../diags/inc/ ../pkg/*/ )      set ROOTDIR = ( .. )
150  set BUILDDIR    = ( ../bin/ )    endif
151  set EXEDIR      = ( ../exe/ )  endif
152  set EXECUTABLE  = ( mitgcmuv )  # Scan for logical ROOTDIR
153    if (! $?ROOTDIR) then
154      foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)
155        if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then
156          set ROOTDIR = $dr
157          echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"
158          break
159        endif
160      end
161    endif
162    if (! $?ROOTDIR) then
163      echo Root directory was not specified and could not be determined.
164      echo Specify the root location of the model source with -rootdir=dir
165      exit 1
166    endif
167    if (! -d $ROOTDIR) then
168      echo Root directory $ROOTDIR not found.;exit 1
169    endif
170    # If -mods wasn't specified then we will assume that we can find all the
171    # source code in the standard directories
172    if (! $?MODS) then
173     set SOURCEDIRS  = ( )
174     set INCLUDEDIRS = ( . )
175    else
176     set SOURCEDIRS  = ( $MODS )
177     set INCLUDEDIRS = ( . $MODS )
178    endif
179    if (! $?BUILDDIR) set BUILDDIR = ( . )
180    if (! -d $BUILDDIR) then
181      echo Build directory $BUILDDIR not found.;exit 1
182    endif
183    if (! $?EXEDIR) then
184      set pwd=`pwd`
185      if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then
186       set EXEDIR = ( ../exe )
187      else
188       set EXEDIR = ( . )
189      endif
190    endif
191    if (! -d $EXEDIR) then
192      echo Executable directory $EXEDIR not found.;exit 1
193    endif
194    if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools )
195    if (! -d $TOOLSDIR) then
196      echo Tools directory $TOOLSDIR not found.;exit 1
197    endif
198    if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )
199    
200    # We have a special set of source files in eesupp/src which
201    # are generated from some template source files. We'll make them
202    # first so the appear as regular source code
203    if (-r $ROOTDIR/eesupp/src/Makefile) then
204     echo Making source files in eesupp from templates...
205     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
206     if ($status == 0) then
207       rm -f make_eesupp.errs
208     else
209       cat make_eesupp.errs
210       exit 2
211     endif
212    endif
213    
214    # Now scan the standard source code tree
215    foreach dr ($SOURCEDIRS)
216      set adr=$dr
217      if (! -d $adr) then
218        echo mods directory $adr not found.; exit 1
219      endif
220      echo Adding mods dir: $adr
221    end
222    if (! $?PACKAGES) then
223      set PACKAGES=()
224      foreach pkg (`cd $ROOTDIR/pkg; find . -type d | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
225       if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
226      end
227    endif
228    foreach dr ($PACKAGES)
229      set enable
230      foreach p ($DISABLE)
231       if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
232         echo Specified package \"$p\" does not exist.
233         exit 1
234       endif
235       if ($dr == $p) unset enable
236       if ($p == 'all') unset enable
237    #  The following allows entire trees to be disabled
238       if ($dr:h == $p) unset enable
239       if ($dr:h:h == $p) unset enable
240       if ($dr:h:h:h == $p) unset enable
241       if ($dr:h:h:h:h == $p) unset enable
242      end
243      foreach p ($ENABLE)
244       if ($dr == $p) set enable
245      end
246      if ($?enable) then
247        set adr=$ROOTDIR/pkg/$dr
248        if (! -d $adr) then
249          echo Source directory $adr not found.; exit 1
250        endif
251        echo Adding pkg dir: $adr
252        set SOURCEDIRS = ($SOURCEDIRS $adr)
253        set INCLUDEDIRS = ($INCLUDEDIRS $adr)
254      else
255        echo "                                      *" Package \"$dr\" NOT enabled.
256      endif
257    end
258    if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
259    foreach dr ($STANDARDDIRS)
260      set adr=$ROOTDIR/$dr/src
261      if (! -d $adr) then
262        echo Source directory $adr not found.; exit 1
263      endif
264      echo Adding src dir: $adr
265      set SOURCEDIRS = ($SOURCEDIRS $adr)
266      set idr = `echo $adr | sed 's/src/inc/'`
267      set INCLUDEDIRS = ($INCLUDEDIRS $idr)
268    end
269    
270  # This is the generic configuration.  # This is the generic configuration.
271  # Platform specific options are chosen below  # Platform specific options are chosen below
272  set LN         = ( 'ln -sf' )  set LN         = ( 'ln -s' )
273  set CPP        = ( '/lib/cpp -P' )  set CPP        = ( '/lib/cpp -P' )
274  set KPP        = (  )  set KPP        = (  )
275  set FC         = ( 'f77' )  set FC         = ( 'f77' )
# Line 96  endif Line 297  endif
297    
298  # Platform specific options  # Platform specific options
299  switch ($platform$USEMPI)  switch ($platform$USEMPI)
   case OSF1:  
300    case OSF1+mpi:    case OSF1+mpi:
301        echo "Configuring for DEC Alpha with MPI"
302        set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
303      case OSF1:
304      echo "Configuring for DEC Alpha"      echo "Configuring for DEC Alpha"
305      set CPP        = ( '/usr/bin/cpp -P' )      set CPP        = ( '/usr/bin/cpp -P' )
306      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )      set DEFINES    = ( ${DEFINES}  '-DTARGET_DEC -DWORDLENGTH=1' )
307      set KPP        = ( 'kapf' )      set KPP        = ( )
308      set KPPFILES   = ( 'main.F' )      set KPPFILES   = ( )
309      set KFLAGS1    = ( '-scan=132 -noconc -cmp=' )      set KFLAGS1    = ( )
310      set FC         = ( 'f77' )      set FC         = ( 'f77' )
311      set FFLAGS     = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' )      set FFLAGS     = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
312      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )      set FOPTIM     = ( '-O5 -fast -tune host -inline all' )
313      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
314      set LIBS       = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
     set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F')  
315      set RMFILES    = ( '*.p.out' )      set RMFILES    = ( '*.p.out' )
316      breaksw      breaksw
317    case IRIX64+mpi:    case IRIX64+mpi:
# Line 126  switch ($platform$USEMPI) Line 328  switch ($platform$USEMPI)
328      echo "Configuring for SGI Mips"      echo "Configuring for SGI Mips"
329      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
330      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
331      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )      set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
332      set FOPTIM     = ( '-O3' )      set FOPTIM     = ( '-O3' )
333  #   set NOOPTFLAGS = ( '-O0' )  #   set NOOPTFLAGS = ( '-O0' )
334  #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \  #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
335  #                      'load_external_fields.F' )  #                      'external_fields_load.F' )
336      set RMFILES    = ( 'rii_files' )      set RMFILES    = ( 'rii_files' )
337      breaksw      breaksw
338      case o2:
339      case IRIX:
340        echo "Configuring for SGI O2 running IRIX 6.5"
341        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
342        set FFLAGS     = ( '-extend_source -bytereclen -r10000 -mips4' )
343        set FOPTIM     = ( '-O2' )
344        set NOOPTFLAGS = ( '-O0' )
345        breaksw
346      case o2+mpi:
347      case IRIX+mpi:
348        echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
349        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
350        set FFLAGS     = ( '-extend_source -bytereclen -r10000 -mips4' )
351        set FOPTIM     = ( '-O2' )
352        set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
353        set NOOPTFLAGS = ( '-O0' )
354        set LIBS       = ( '-lmpi' )
355        breaksw
356      case o2k+mpi:
357        echo "Configuring for SGI Origin2000 running IRIX 6.5"
358        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
359        set INCLUDES   = ( '-I/usr/include' )
360        set FFLAGS     = ( '-n32 -extend_source -bytereclen' )
361        set FOPTIM     = ( '-O2' )
362        set NOOPTFILES = ( 'calc_mom_rhs.F' )
363        set NOOPTFLAGS = ( '-O1' )
364        set LIBS       = ( '-lmpi -lscs' )
365        breaksw
366      case onyx:
367      case onyx+mpi:
368        echo "Configuring for SGI ONYX running IRIX64"
369        set DEFINES    = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
370        set FFLAGS     = ( '-extend_source -bytereclen -r10000 -64' )
371        set FOPTIM     = ( '-O2' )
372        set NOOPTFLAGS = ( '-O0' )
373        set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
374        set LIBS       = ( '-lmpi' )
375        breaksw
376    case SunOS:    case SunOS:
377      set LN         = ( '/usr/bin/ln -fs' )      set LN         = ( '/usr/bin/ln -s' )
378      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
379      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
380      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
381      set FOPTIM     = ( '-fast -O4' )      set FOPTIM     = ( '-fast -O3' )
382      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
383      set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.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')
384      breaksw      breaksw
385    case SunOS+mpi:    case SunOS+mpi:
386      set LN         = ( '/usr/bin/ln -fs' )      set LN         = ( '/usr/bin/ln -s' )
387      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
388      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
389      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
390      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
391      set FOPTIM     = ( '-fast -O4' )      set FOPTIM     = ( '-fast -O3' )
392      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
393      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
394                         '-lsocket -lnsl' )                         '-lsocket -lnsl' )
395      set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.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')
396      breaksw      breaksw
397    case IRIX32:    case IRIX32:
398      echo "Configuring for SGI ONYX running IRIX64"      echo "Configuring for SGI ONYX running IRIX64"
# Line 162  switch ($platform$USEMPI) Line 402  switch ($platform$USEMPI)
402      set FOPTIM     = ( '-O2' )      set FOPTIM     = ( '-O2' )
403      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
404      set NOOPTFILES = ( 'barrier.F different_multiple.F ' \      set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
405                         'load_external_fields.F' )                         'external_fields_load.F' )
406      set LIBS       = ( '-lmpi' )      set LIBS       = ( '-lmpi' )
407      breaksw      breaksw
408    case HP-UX+mpi:    case HP-UX+mpi:
# Line 178  switch ($platform$USEMPI) Line 418  switch ($platform$USEMPI)
418      set FOPTIM     = ( '+O2' )      set FOPTIM     = ( '+O2' )
419      set NOOPTFLAGS = ( '+O0' )      set NOOPTFLAGS = ( '+O0' )
420      set NOOPTFILES = ( 'barrier.F different_multiple.F' \      set NOOPTFILES = ( 'barrier.F different_multiple.F' \
421                         'load_external_fields.F' )                         'external_fields_load.F' )
422      breaksw      breaksw
423    case Linux+mpi:    case Linux+mpi:
424      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
425      set INCLUDES   = ( '-I/usr/local/include' )      set INCLUDES   = ( '-I/usr/local/include' )
426    case Linux:    case Linux:
427      set LN         = ( '/bin/ln -fs' )      set LN         = ( '/bin/ln -s' )
428      set CPP        = ( '/lib/cpp  -traditional -P' )      set CPP        = ( '/lib/cpp  -traditional -P' )
429      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
430      set FC         = ( 'g77' )      set FC         = ( 'g77' )
431      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )
432      set FOPTIM     = ( '-O3 -malign-double -funroll-loops ' )      if ($?IEEE) set FFLAGS     = ( $FFLAGS '-ffloat-store' )
433        set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )
434      set LINK       = ( 'g77' )      set LINK       = ( 'g77' )
435      breaksw      breaksw
436    case Linux+pgi+mpi:    case Linux+pgi+mpi:
437      if ($?include_jam_libs) then      if ($?include_jam_libs) then
438       set INCLUDES   = ( '-I/usr/local//mpich-cnh-install/include' )       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
439       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' )
440      else      else
441       set INCLUDES   = ( '-I/usr/local/include' )       set INCLUDES   = ( '-I/usr/local/include' )
442       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
443      endif      endif
444    case Linux+pgi:    case Linux+pgi:
445      set LN         = ( '/bin/ln -fs' )      set LN         = ( '/bin/ln -s' )
446      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
447      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
448      set FC         = ( 'pgf77' )      set FC         = ( 'pgf77' )
449      set FFLAGS     = ( '-byteswapio' )      set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
450      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
451      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
452      breaksw      breaksw
# Line 221  switch ($platform$USEMPI) Line 462  switch ($platform$USEMPI)
462    case sn7113:    case sn7113:
463      set FC         = ( 'f90' )      set FC         = ( 'f90' )
464      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
465      set LN         = ( '/bin/ln -fs' )      set LN         = ( '/bin/ln -s' )
466      set CPP        = ( '/opt/ctl/bin/cpp -N -P' )      set CPP        = ( '/opt/ctl/bin/cpp -N -P' )
467      set DEFINES    = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
468      set FFLAGS     = ( '-m3 -Rabc -N 132')      set FFLAGS     = ( '-m3 -Rabc -N 132')
469      set FOPTIM     = ( '-O0' )      set FOPTIM     = ( '-O0' )
470      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
471      set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
472      breaksw      breaksw
473    case SV1:    case SV1:
474    case sn3002:    case sn3002:
475      set FC         = ( 'f90' )      set FC         = ( 'f90' )
476      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
477      set LN         = ( '/bin/ln -fs' )      set LN         = ( '/bin/ln -s' )
478      set CPP        = ( '/opt/ctl/bin/cpp -N -P' )      set CPP        = ( '/opt/ctl/bin/cpp -N -P' )
479      set DEFINES    = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
480      set FFLAGS     = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')      set FFLAGS     = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
481      set FOPTIM     = ( '-O0' )      set FOPTIM     = ( '-O0' )
482      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
483      set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
484      breaksw      breaksw
485    default:    default:
486      echo "Error: platform not recognized: uname -p = " $platform$USEMPI      echo "Error: platform not recognized: uname -p = " $platform$USEMPI
# Line 254  endsw Line 495  endsw
495  ##                                                                           ##  ##                                                                           ##
496  ###############################################################################  ###############################################################################
497    
 # Create list of files  
 set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[F]$'`  
 if ( $#flist ) then  
  echo -n 'SRCFILES = ' > srclist.inc  
  foreach ff ( ${flist} )  
   set fname = ( ${ff:t}       )  
   echo    ' \'                       >> srclist.inc  
   echo -n "           " ${fname:r}.F >> srclist.inc  
  end  
 else  
  echo No source files found...\!  
  exit  
 endif  
 echo " " >> srclist.inc  
   
 set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[c]$'`  
 if ( $#flist ) then  
  echo -n 'CSRCFILES = ' > csrclist.inc  
  foreach ff ( ${flist} )  
   set fname = ( ${ff:t}       )  
   echo    ' \'                   >> csrclist.inc  
   echo -n "           " ${fname} >> csrclist.inc  
 else  
  echo -n 'CSRCFILES =' > csrclist.inc  
 endif  
 echo " " >> csrclist.inc  
   
498  # Convert lists of directories into command-line options  # Convert lists of directories into command-line options
499  foreach inc ($INCLUDEDIRS)  foreach inc ($INCLUDEDIRS)
500   set INCLUDES = ($INCLUDES -I$inc)   set INCLUDES = ($INCLUDES -I$inc)
501  end  end
502  set SRCSTARS = ( )  
503    # Search for source code
504    rm -rf .links.tmp;mkdir .links.tmp
505    echo "# This section creates symbolic links" > srclinks.tmp
506    echo "" >> srclinks.tmp
507    echo -n 'SRCFILES = ' > srclist.inc
508    echo -n 'CSRCFILES = ' > csrclist.inc
509    #echo -n 'HEADERFILES = ' > hlist.inc
510  foreach dr ($SOURCEDIRS)  foreach dr ($SOURCEDIRS)
511   set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] )   set deplist=( )
512     foreach srcfile (`cd $dr; ls *.[hcF]`)
513      if (! -r .links.tmp/$srcfile) then
514       if (-f $dr/$srcfile) then
515        switch ($srcfile:e)
516        case F:
517         touch .links.tmp/$srcfile
518         set deplist=($deplist $srcfile)
519         echo    ' \'                   >> srclist.inc
520         echo -n "           " $srcfile >> srclist.inc
521         breaksw
522        case c:
523         touch .links.tmp/$srcfile
524         set deplist=($deplist $srcfile)
525         echo    ' \'                   >> csrclist.inc
526         echo -n "           " $srcfile >> csrclist.inc
527         breaksw
528        case h:
529    #     touch .links.tmp/$srcfile
530    #     set deplist=($deplist $srcfile)
531    #     echo    ' \'                   >> hlist.inc
532    #     echo -n "           " $srcfile >> hlist.inc
533         breaksw
534        endsw
535       endif
536      endif
537     end
538     if ($#deplist != 0) then
539      echo "# These files are linked from $dr" >> srclinks.tmp
540      echo $deplist':' >> srclinks.tmp
541      echo '        $(LN) '$dr'/$@ $@' >> srclinks.tmp
542     endif
543  end  end
544    rm -rf .links.tmp
545    echo "" >> srclist.inc
546    echo "" >> csrclist.inc
547    #echo "" >> hlist.inc
548    
549  set THISHOSTNAME = ( `hostname` )  set THISHOSTNAME = ( `hostname` )
550  set THISCWD = ( `pwd` )  set THISCWD = ( `pwd` )
551  set THISDATE = ( `date` )  set THISDATE = ( `date` )
552    
553    if (-r $mfile) mv -f $mfile $mfile.bak
554  ###########################################  ###########################################
555  ## This is the template for the makefile ##  ## This is the template for the makefile ##
556  ###########################################  ###########################################
557  echo Creating makefile: $mfile  echo Creating makefile: $mfile
558  echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}  echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
559  echo "# This makefile was generated automatically pn" >> ${mfile}  echo "# This makefile was generated automatically on" >> ${mfile}
560  echo "#    $THISDATE" >> ${mfile}  echo "#    $THISDATE" >> ${mfile}
561  echo "# by the command:" >> ${mfile}  echo "# by the command:" >> ${mfile}
562  echo "#    ${0} $argv" >> ${mfile}  echo "#    ${0} $argv" >> ${mfile}
# Line 324  cat >> ${mfile} <<EOF Line 581  cat >> ${mfile} <<EOF
581  # LINK         : Command for link editor program  # LINK         : Command for link editor program
582  # LIBS         : Library flags /or/ additional optimization/debugging flags  # LIBS         : Library flags /or/ additional optimization/debugging flags
583    
584  BUILDDIR   = ${BUILDDIR}    ROOTDIR     = ${ROOTDIR}
585  SOURCEDIRS = ${SOURCEDIRS}  BUILDDIR    = ${BUILDDIR}  
586    SOURCEDIRS  = ${SOURCEDIRS}
587  INCLUDEDIRS = ${INCLUDEDIRS}  INCLUDEDIRS = ${INCLUDEDIRS}
588  EXEDIR     = ${EXEDIR}  EXEDIR      = ${EXEDIR}
589  EXECUTABLE = \$(EXEDIR)${EXECUTABLE}  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}
590    TOOLSDIR    = ${TOOLSDIR}
591    
592  EOF  EOF
593    
# Line 339  cat >> ${mfile} <<EOF Line 598  cat >> ${mfile} <<EOF
598  # extra stuff for Hyades ............................................  # extra stuff for Hyades ............................................
599  HYADES_DIR = /u/u0/cnh/jam-lib/software  HYADES_DIR = /u/u0/cnh/jam-lib/software
600  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc  HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
601    HYADES_DIR = /usr/local/jamlib/current/dual_proc
602  WORK_DIR   = \$(HYADES_DIR)  WORK_DIR   = \$(HYADES_DIR)
603  DEPOSIT_DIR = linux_bin  DEPOSIT_DIR = linux_bin
604    
# Line 370  cat >> ${mfile} <<EOF Line 630  cat >> ${mfile} <<EOF
630  # Unix ln (link)  # Unix ln (link)
631  LN = ${LN}  LN = ${LN}
632  # C preprocessor  # C preprocessor
633  CPP = cat \$< | ../tools/set64bitConst.sh | ${CPP}  CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}
634  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
635  KPP = ${KPP}  KPP = ${KPP}
636  # Fortran compiler  # Fortran compiler
# Line 401  cat csrclist.inc >> ${mfile} Line 661  cat csrclist.inc >> ${mfile}
661  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}  echo 'F77FILES =  $(SRCFILES:.F=.f)'                    >> ${mfile}
662  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
663    
664  rm -f srclist.inc  rm -f srclist.inc csrclist.inc flist.tmp clist.tmp
665    
666  cat >> ${mfile} <<EOF  cat >> ${mfile} <<EOF
667    
# Line 411  cat >> ${mfile} <<EOF Line 671  cat >> ${mfile} <<EOF
671  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
672  \$(EXECUTABLE): \$(OBJFILES)  \$(EXECUTABLE): \$(OBJFILES)
673          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
 links:  
         @-\$(LN) $SRCSTARS .  
674  depend:  depend:
675          @make links          @make links
676          makedepend -o .f \$(INCLUDES) \$(SRCFILES)          makedepend -o .f \$(INCLUDES) \$(SRCFILES)
677    
678    links: \$(SRCFILES)
679    
680  small_f: \$(F77FILES)  small_f: \$(F77FILES)
681    
682  clean:  clean:
683          -rm -rf *.o *.f *.p ${RMFILES}          -rm -rf *.o *.f *.p ${RMFILES}
684  Clean:  Clean:
685          @make clean          @make clean
686          -find . -type l -exec rm {} \;          @make cleanlinks
687          -rm Makefile.bak          -rm -f Makefile.bak
688  CLEAN:  CLEAN:
689          @make Clean          @make Clean
690          -find ../verification/ -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
691          -find ../verification/ -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
692          -rm \$(EXECUTABLE)          -rm -f \$(EXECUTABLE)
693    
694    makefile:
695            ${0} $argv
696    cleanlinks:
697            -find . -type l -exec rm {} \;
698    
699  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .f - .o  )
700  .F.f:  .F.f:
# Line 454  foreach sf ($NOOPTFILES) Line 719  foreach sf ($NOOPTFILES)
719   echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}   echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
720   echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}   echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
721  end  end
722  echo >> ${mfile}  echo "" >> ${mfile}
723    
724    # Add rules for links
725    cat srclinks.tmp >> ${mfile}
726    rm -f srclinks.tmp
727    
728    echo "" >> ${mfile}
729  echo "# DO NOT DELETE" >> ${mfile}  echo "# DO NOT DELETE" >> ${mfile}
730    
731  exit  exit

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.22