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

Annotation of /MITgcm/tools/genmake

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


Revision 1.62 - (hide annotations) (download)
Mon Mar 4 17:26:41 2002 UTC (22 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46b_post, checkpoint44h_pre, checkpoint44g_post, checkpoint44h_post, checkpoint45d_post, checkpoint45b_post, checkpoint45, checkpoint44f_post, checkpoint46a_post, checkpoint46a_pre, checkpoint45c_post, checkpoint46b_pre, checkpoint45a_post, checkpoint46
Changes since 1.61: +8 -2 lines
Added PTRACERS package

This allows an arbitrary number of passive tracers to be integrated
forward simultaneously with the dynamicaly model.
 + Implemented so far:
    - basic forward algorithm (time-stepping, advection, diffusion, convection)
    - I/O and checkpointing
    - GM/Redi  *but*  using the GM/Redi coefficient of Salt
 + Not implemented so far:
    - KPP
    - OBCS
 + No specific example supplied (yet) but global_ocean.90x40x15 has the
   necessary data.ptracer file. Simply use -enable=ptracers and uncomment
   line in data.pkg. PTRACER01 then reproduces Salt exactly.
 + This package is disabled by default since it increases storage.

1 cnh 1.1 #!/bin/csh -f
2     #
3 adcroft 1.62 # $Header: /u/gcmpack/models/MITgcmUV/tools/genmake,v 1.61 2002/02/15 21:26:37 heimbach Exp $
4 adcroft 1.58 # $Name: $
5 cnh 1.1 #
6     # Makefile generator for MITgcm UV codes
7 adcroft 1.23 # created by cnh 03/98
8     # adapted by aja 06/98
9     # modified by aja 01/00
10    
11     # Default lists
12 adcroft 1.62 set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk flt ptracers )
13 adcroft 1.44 set DEFINES = ( )
14 adcroft 1.23 set ENABLE = ( )
15     set MODS = ( )
16    
17     # Grab variables/lists from .genmakerc
18     if (-r .genmakerc) source .genmakerc
19 cnh 1.1
20     # Process command-line arguments
21     set allargs=( $argv )
22     while ($#allargs)
23     set arg = $allargs[1]
24     switch ($arg)
25 adcroft 1.9 case -makefile:
26     set mfile = ( Makefile )
27     breaksw
28     case -makefile=*:
29     set mfile = ( `echo $arg | sed 's/-makefile=//' `)
30 cnh 1.1 breaksw
31     case -platform:
32     case -platform=:
33     echo "To change platform you must specify one with -platform="
34     echo "eg. -platform=sparc or -platform=mips"
35     exit
36     breaksw
37     case -platform*:
38 adcroft 1.23 if ($?platform) then
39     echo Option -platform=dir can only be specified once.; exit 1
40     endif
41 cnh 1.1 set platform = ( `echo $arg | sed 's/-platform=//' `)
42     breaksw
43 adcroft 1.23 case -rootdir:
44     case -rootdir=:
45     echo "To specify root directory you must specify one with -rootdir=dir"
46     echo "with NO space eg. -rootdir=../../.. or -rootdir=/usr/people/joe/src"
47     exit
48     breaksw
49     case -rootdir=*:
50     if ($?ROOTDIR) then
51     echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
52     echo "***" Command line \"$arg\" will override this.
53     endif
54     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
55     breaksw
56     case -mods:
57     case -mods=:
58     echo "To specify an additional source directory you must specify one with -mods=dir"
59     echo "with NO space eg. -mods=../code or -mods=/usr/people/joe/src"
60     exit
61     breaksw
62     case -mods=*:
63 adcroft 1.24 set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `)
64 adcroft 1.23 breaksw
65     case -disable:
66     case -disable=:
67     echo "To disable packages from compilation use -disable=pkg1,pkg2"
68     echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)"
69     exit
70     breaksw
71     case -disable=*:
72 adcroft 1.24 set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `)
73 adcroft 1.23 breaksw
74     case -enable:
75     case -enable=:
76     echo "To enable packages from compilation use -enable=pkg1,pkg2"
77     echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)"
78     echo "-enable overrides -disable, ie. a package listed in both is enabled"
79     exit
80     breaksw
81 adcroft 1.40 case -ieee:
82     set IEEE
83     breaksw
84 adcroft 1.23 case -enable=*:
85 adcroft 1.24 set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
86 adcroft 1.23 breaksw
87 cnh 1.1 case -mpi:
88     echo "Enabling MPI options"
89     set USEMPI
90     breaksw
91 adcroft 1.12 case -jam:
92     set include_jam_libs
93     echo "Including paths to JAM libraries"
94     breaksw
95 cnh 1.1 case -help:
96 adcroft 1.35 echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
97     cat << EOF
98    
99     $0 is used to generate the Makefile in the current directory.
100    
101     Typical invocations are:
102     o from "bin": ../tools/genmake
103     o from "verification/expt/code": ../../../tools/genmake
104     o from "verification/expt/input": ../../../tools/genmake -mods=../code
105     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
106     or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
107    
108     Packages (collected modules of code) can be disabled to avoid unnecessary
109     compilation of unused code. For instance if you know you will not
110     use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
111     configuration:
112     .../tools/genmake -disable=gmredi,kpp,obcs
113    
114     If you add some source files you can re-call the previous instance of
115     genmake with "make makefile".
116    
117     genmake also reads the file .genmakerc which can be used to configure
118     options (primarily the command-line options above) for particular experiments.
119     EOF
120 cnh 1.1 exit
121     breaksw
122     default:
123     echo "Unknown command-line option: " $arg
124     echo $0 "-help to show usage"
125     exit
126     breaksw
127     endsw
128     shift allargs
129     end
130 cnh 1.6
131 adcroft 1.23 # Default actions/options
132    
133     # If platform wasn't specified then determine platform type of the host
134     if (! $?platform) then
135 cnh 1.6 set platform = (`uname`)
136 adcroft 1.55 # This let's us distinguish between different Linux platforms
137     if ($platform == Linux) then
138     set machine = (`uname -m`)
139     set platform = ($platform'-'$machine)
140     endif
141 cnh 1.6 endif
142 adcroft 1.23 # If name of makefile wasn't specified then use default "Makefile"
143     if (! $?mfile) set mfile = ( Makefile )
144    
145 cnh 1.1 set mach = ( `uname -a` )
146     echo Operating system: $mach
147    
148     # Directories for source, includes, binaries and executables
149 adcroft 1.23 #
150     # If -rootdir wasn't specified then assume script is being run from bin
151     # but if it was supplied then we should place the executable in the build dir
152     if (! $?ROOTDIR) then
153 adcroft 1.26 set pwd=`pwd`
154 adcroft 1.29 if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
155     set ROOTDIR = ( .. )
156 adcroft 1.26 endif
157     endif
158     # Scan for logical ROOTDIR
159     if (! $?ROOTDIR) then
160     foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)
161     if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then
162     set ROOTDIR = $dr
163     echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"
164     break
165     endif
166     end
167     endif
168     if (! $?ROOTDIR) then
169     echo Root directory was not specified and could not be determined.
170     echo Specify the root location of the model source with -rootdir=dir
171     exit 1
172 adcroft 1.23 endif
173     if (! -d $ROOTDIR) then
174     echo Root directory $ROOTDIR not found.;exit 1
175     endif
176     # If -mods wasn't specified then we will assume that we can find all the
177     # source code in the standard directories
178     if (! $?MODS) then
179     set SOURCEDIRS = ( )
180 adcroft 1.42 set INCLUDEDIRS = ( )
181 adcroft 1.23 else
182     set SOURCEDIRS = ( $MODS )
183 adcroft 1.42 set INCLUDEDIRS = ( $MODS )
184 adcroft 1.23 endif
185     if (! $?BUILDDIR) set BUILDDIR = ( . )
186     if (! -d $BUILDDIR) then
187     echo Build directory $BUILDDIR not found.;exit 1
188 adcroft 1.29 endif
189     if (! $?EXEDIR) then
190     set pwd=`pwd`
191     if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then
192     set EXEDIR = ( ../exe )
193     else
194     set EXEDIR = ( . )
195     endif
196 adcroft 1.23 endif
197     if (! -d $EXEDIR) then
198     echo Executable directory $EXEDIR not found.;exit 1
199     endif
200     if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools )
201     if (! -d $TOOLSDIR) then
202     echo Tools directory $TOOLSDIR not found.;exit 1
203     endif
204     if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv )
205    
206 adcroft 1.35 # We have a special set of source files in eesupp/src which
207     # are generated from some template source files. We'll make them
208     # first so the appear as regular source code
209     if (-r $ROOTDIR/eesupp/src/Makefile) then
210     echo Making source files in eesupp from templates...
211     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
212     if ($status == 0) then
213     rm -f make_eesupp.errs
214     else
215     cat make_eesupp.errs
216     exit 2
217     endif
218     endif
219    
220 adcroft 1.23 # Now scan the standard source code tree
221     foreach dr ($SOURCEDIRS)
222     set adr=$dr
223     if (! -d $adr) then
224     echo mods directory $adr not found.; exit 1
225     endif
226 adcroft 1.35 echo Adding mods dir: $adr
227 adcroft 1.23 end
228     if (! $?PACKAGES) then
229 adcroft 1.35 set PACKAGES=()
230     foreach pkg (`cd $ROOTDIR/pkg; find . -type d | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
231     if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
232     end
233 adcroft 1.23 endif
234     foreach dr ($PACKAGES)
235     set enable
236     foreach p ($DISABLE)
237 adcroft 1.31 if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
238 adcroft 1.30 echo Specified package \"$p\" does not exist.
239     exit 1
240     endif
241 adcroft 1.23 if ($dr == $p) unset enable
242     if ($p == 'all') unset enable
243 adcroft 1.35 # The following allows entire trees to be disabled
244     if ($dr:h == $p) unset enable
245     if ($dr:h:h == $p) unset enable
246     if ($dr:h:h:h == $p) unset enable
247     if ($dr:h:h:h:h == $p) unset enable
248 adcroft 1.23 end
249     foreach p ($ENABLE)
250     if ($dr == $p) set enable
251     end
252     if ($?enable) then
253     set adr=$ROOTDIR/pkg/$dr
254     if (! -d $adr) then
255     echo Source directory $adr not found.; exit 1
256     endif
257 adcroft 1.35 echo Adding pkg dir: $adr
258 adcroft 1.23 set SOURCEDIRS = ($SOURCEDIRS $adr)
259     set INCLUDEDIRS = ($INCLUDEDIRS $adr)
260 adcroft 1.62 switch ($dr)
261     case ptracers:
262     set DEFINES = ($DEFINES '-DALLOW_PTRACERS'); breaksw
263     default:
264     breaksw
265     endsw
266 adcroft 1.23 else
267 adcroft 1.35 echo " *" Package \"$dr\" NOT enabled.
268 adcroft 1.44 switch ($dr)
269     case mom_fluxform:
270     set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
271     case mom_vecinv:
272 adcroft 1.50 set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
273 adcroft 1.54 case generic_advdiff:
274     set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
275 adcroft 1.44 default:
276     breaksw
277     endsw
278 adcroft 1.23 endif
279 adcroft 1.30 end
280 jmc 1.33 if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
281 adcroft 1.30 foreach dr ($STANDARDDIRS)
282     set adr=$ROOTDIR/$dr/src
283     if (! -d $adr) then
284     echo Source directory $adr not found.; exit 1
285     endif
286 adcroft 1.35 echo Adding src dir: $adr
287 adcroft 1.30 set SOURCEDIRS = ($SOURCEDIRS $adr)
288     set idr = `echo $adr | sed 's/src/inc/'`
289     set INCLUDEDIRS = ($INCLUDEDIRS $idr)
290 adcroft 1.23 end
291 cnh 1.1
292     # This is the generic configuration.
293     # Platform specific options are chosen below
294 adcroft 1.23 set LN = ( 'ln -s' )
295 cnh 1.1 set CPP = ( '/lib/cpp -P' )
296 cnh 1.53 set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' )
297 cnh 1.1 set KPP = ( )
298     set FC = ( 'f77' )
299     set LINK = ( 'f77' )
300 heimbach 1.61 set MAKEDEPEND = ( 'makedepend' )
301 adcroft 1.42 set INCLUDES = ( -I. )
302 cnh 1.1 set FFLAGS = ( )
303     set FOPTIM = ( )
304 adcroft 1.51 set CFLAGS = ( )
305 cnh 1.1 set KFLAGS1 = ( )
306     set KFLAGS2 = ( )
307     set LIBS = ( )
308     set KPPFILES = ( )
309     set NOOPTFILES = ( )
310     set NOOPTFLAGS = ( )
311     set RMFILES = ( )
312    
313     # We often want to use different compile/link options is using MPI
314     if ($?USEMPI) then
315     set USEMPI = ( '+mpi' )
316     set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' )
317     else
318     set USEMPI
319     # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
320     endif
321    
322     # Platform specific options
323     switch ($platform$USEMPI)
324 adcroft 1.39 case OSF1+mpi:
325     echo "Configuring for DEC Alpha with MPI"
326     set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
327 cnh 1.6 case OSF1:
328 cnh 1.1 echo "Configuring for DEC Alpha"
329     set CPP = ( '/usr/bin/cpp -P' )
330 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' )
331 adcroft 1.39 set KPP = ( )
332     set KPPFILES = ( )
333     set KFLAGS1 = ( )
334 cnh 1.1 set FC = ( 'f77' )
335 cnh 1.25 set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
336 cnh 1.1 set FOPTIM = ( '-O5 -fast -tune host -inline all' )
337     set NOOPTFLAGS = ( '-O0' )
338 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
339 cnh 1.1 set RMFILES = ( '*.p.out' )
340     breaksw
341 cnh 1.6 case IRIX64+mpi:
342 cnh 1.1 echo "Configuring for SGI Mips with MPI"
343 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
344 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
345     set FC = ( 'mpif77' )
346     set LINK = ( 'mpif77' )
347 adcroft 1.11 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
348 cnh 1.1 set FOPTIM = ( '-O3' )
349     set RMFILES = ( 'rii_files' )
350     breaksw
351 cnh 1.6 case IRIX64:
352 cnh 1.1 echo "Configuring for SGI Mips"
353 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
354 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
355 adcroft 1.35 set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
356 adcroft 1.11 set FOPTIM = ( '-O3' )
357     # set NOOPTFLAGS = ( '-O0' )
358     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
359 heimbach 1.20 # 'external_fields_load.F' )
360 cnh 1.1 set RMFILES = ( 'rii_files' )
361     breaksw
362 heimbach 1.20 case o2:
363     case IRIX:
364     echo "Configuring for SGI O2 running IRIX 6.5"
365     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
366     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
367     set FOPTIM = ( '-O2' )
368     set NOOPTFLAGS = ( '-O0' )
369     breaksw
370     case o2+mpi:
371     case IRIX+mpi:
372     echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
373     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
374     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
375     set FOPTIM = ( '-O2' )
376     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
377     set NOOPTFLAGS = ( '-O0' )
378     set LIBS = ( '-lmpi' )
379     breaksw
380     case o2k+mpi:
381     echo "Configuring for SGI Origin2000 running IRIX 6.5"
382     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
383     set INCLUDES = ( '-I/usr/include' )
384     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
385     set FOPTIM = ( '-O2' )
386     set NOOPTFILES = ( 'calc_mom_rhs.F' )
387     set NOOPTFLAGS = ( '-O1' )
388     set LIBS = ( '-lmpi -lscs' )
389     breaksw
390     case onyx:
391     case onyx+mpi:
392     echo "Configuring for SGI ONYX running IRIX64"
393     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
394     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
395     set FOPTIM = ( '-O2' )
396     set NOOPTFLAGS = ( '-O0' )
397     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
398     set LIBS = ( '-lmpi' )
399     breaksw
400 cnh 1.6 case SunOS:
401 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
402 cnh 1.6 set CPP = ( '/usr/ccs/lib/cpp -P' )
403 heimbach 1.61 set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
404 cnh 1.52 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
405 heimbach 1.60 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
406 adcroft 1.51 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
407     set CFLAGS = ( '-dalign -O3 -xarch=v9' )
408     set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
409     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 ')
410 cnh 1.6 breaksw
411     case SunOS+mpi:
412 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
413 cnh 1.1 set CPP = ( '/usr/ccs/lib/cpp -P' )
414 cnh 1.52 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
415 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
416     set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
417 heimbach 1.60 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
418 adcroft 1.51 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
419     set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
420 cnh 1.6 '-lsocket -lnsl' )
421 heimbach 1.47 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')
422 cnh 1.3 breaksw
423 cnh 1.6 case IRIX32:
424 cnh 1.3 echo "Configuring for SGI ONYX running IRIX64"
425 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
426 cnh 1.3 set INCLUDES = ( '-I/usr/include' )
427     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
428     set FOPTIM = ( '-O2' )
429     set NOOPTFLAGS = ( '-O0' )
430     set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
431 heimbach 1.20 'external_fields_load.F' )
432 cnh 1.3 set LIBS = ( '-lmpi' )
433     breaksw
434 adcroft 1.11 case HP-UX+mpi:
435     set FC = ( 'mpif77' )
436     set LINK = ( 'mpif77' )
437     set INCLUDES = ( '-I/opt/mpi/include' )
438 cnh 1.6 case HP-UX:
439 cnh 1.3 echo "Configuring for HP Exemplar"
440     set CPP = ( '/usr/ccs/lbin/cpp -P' )
441 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
442 cnh 1.3 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
443     '+Okernel_threads' )
444     set FOPTIM = ( '+O2' )
445 cnh 1.6 set NOOPTFLAGS = ( '+O0' )
446 cnh 1.3 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
447 heimbach 1.20 'external_fields_load.F' )
448 cnh 1.1 breaksw
449 adcroft 1.55 case Linux-alpha+mpi:
450     echo "Configuring with MPI"
451     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
452     set INCLUDES = ( '-I/usr/local/include' )
453     case Linux-alpha:
454     echo "Configuring for " $platform
455     set LN = ( '/bin/ln -s' )
456     set CPP = ( '/lib/cpp -traditional -P' )
457     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
458     set FC = ( 'g77' )
459     set FFLAGS = ( ' ' )
460     if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
461     set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
462     set LINK = ( 'g77' )
463     breaksw
464     case Linux*+pgi+mpi:
465 adcroft 1.15 if ($?include_jam_libs) then
466 adcroft 1.35 set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
467     set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
468 adcroft 1.15 else
469     set INCLUDES = ( '-I/usr/local/include' )
470     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
471     endif
472 adcroft 1.55 case Linux*+pgi:
473     echo "Configuring for " $platform
474 adcroft 1.23 set LN = ( '/bin/ln -s' )
475 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
476 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
477 cnh 1.6 set FC = ( 'pgf77' )
478 adcroft 1.23 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
479 cnh 1.6 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
480     set LINK = ( 'pgf77' )
481 adcroft 1.56 breaksw
482     case Linux*+mpi:
483     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
484     set INCLUDES = ( '-I/usr/local/include' )
485     case Linux*:
486     echo "Configuring for " $platform
487     set LN = ( '/bin/ln -s' )
488     set CPP = ( '/lib/cpp -traditional -P' )
489     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
490     set FC = ( 'g77' )
491     set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
492     if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
493     set FOPTIM = ( '-O3 -malign-double -funroll-loops' )
494     set LINK = ( 'g77' )
495 adcroft 1.13 breaksw
496     case T3E:
497     case sn6312:
498 adcroft 1.55 echo "Configuring for T3E"
499 adcroft 1.13 set CPP = ( '/opt/ctl/bin/cpp -P')
500     set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
501     set FC = ( 'f90' )
502     set LINK = ( 'f90' )
503     set FFLAGS = ( '-O 2,fusion' )
504 heimbach 1.18 breaksw
505     case T90:
506     case sn7113:
507 adcroft 1.55 echo "Configuring for T90"
508 heimbach 1.18 set FC = ( 'f90' )
509     set LINK = ( 'f90' )
510 adcroft 1.23 set LN = ( '/bin/ln -s' )
511 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
512     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
513     set FFLAGS = ( '-m3 -Rabc -N 132')
514 heimbach 1.18 set FOPTIM = ( '-O0' )
515     set NOOPTFLAGS = ( '-O0' )
516 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
517 heimbach 1.18 breaksw
518     case SV1:
519     case sn3002:
520     set FC = ( 'f90' )
521     set LINK = ( 'f90' )
522 adcroft 1.23 set LN = ( '/bin/ln -s' )
523 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
524     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
525     set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
526 heimbach 1.18 set FOPTIM = ( '-O0' )
527     set NOOPTFLAGS = ( '-O0' )
528 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
529 heimbach 1.57 breaksw
530     case SP3:
531     # originally from A. Biastoch, SIO.
532     echo "Configuring for IBM SP POWER3"
533     set SOURCEDIRS = ( ./ $SOURCEDIRS )
534     set LN = ( 'ln -s' )
535     set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
536     set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' )
537     # set CPP = ( '/lib/cpp' )
538     set FC = ( 'mpxlf95' )
539     set LINK = ( 'mpxlf95' )
540     set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
541     '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
542     set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
543     '-bmaxdata:0x80000000 ' )
544     set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
545     '-bmaxdata:0x80000000' )
546 heimbach 1.61 set LIBS = ( ' -L/usr/local/apps/mass -lmass' )
547 heimbach 1.57 # set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
548     # set FOPTIM = ( '-O3' )
549     # set NOOPTFLAGS = ( '-O0' )
550     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
551     # 'external_fields_load.F' )
552     set RMFILES = ( 'rii_files' )
553 cnh 1.6 breaksw
554 cnh 1.1 default:
555     echo "Error: platform not recognized: uname -p = " $platform$USEMPI
556     exit
557     breaksw
558     endsw
559    
560     ###############################################################################
561     ## ##
562     ## Everything below here should not need to be changed. Platform specific ##
563     ## changes and code specific changes should be configured above this line. ##
564     ## ##
565     ###############################################################################
566    
567     # Convert lists of directories into command-line options
568     foreach inc ($INCLUDEDIRS)
569     set INCLUDES = ($INCLUDES -I$inc)
570     end
571 adcroft 1.23
572     # Search for source code
573     rm -rf .links.tmp;mkdir .links.tmp
574     echo "# This section creates symbolic links" > srclinks.tmp
575     echo "" >> srclinks.tmp
576     echo -n 'SRCFILES = ' > srclist.inc
577     echo -n 'CSRCFILES = ' > csrclist.inc
578 adcroft 1.41 echo -n 'HEADERFILES = ' > hlist.inc
579 adcroft 1.42 foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
580 adcroft 1.23 set deplist=( )
581     foreach srcfile (`cd $dr; ls *.[hcF]`)
582     if (! -r .links.tmp/$srcfile) then
583     if (-f $dr/$srcfile) then
584     switch ($srcfile:e)
585     case F:
586     touch .links.tmp/$srcfile
587     set deplist=($deplist $srcfile)
588     echo ' \' >> srclist.inc
589     echo -n " " $srcfile >> srclist.inc
590     breaksw
591     case c:
592     touch .links.tmp/$srcfile
593     set deplist=($deplist $srcfile)
594     echo ' \' >> csrclist.inc
595     echo -n " " $srcfile >> csrclist.inc
596     breaksw
597     case h:
598 adcroft 1.41 touch .links.tmp/$srcfile
599     set deplist=($deplist $srcfile)
600     echo ' \' >> hlist.inc
601     echo -n " " $srcfile >> hlist.inc
602 adcroft 1.23 breaksw
603     endsw
604     endif
605     endif
606     end
607     if ($#deplist != 0) then
608     echo "# These files are linked from $dr" >> srclinks.tmp
609     echo $deplist':' >> srclinks.tmp
610     echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp
611     endif
612 cnh 1.1 end
613 adcroft 1.23 rm -rf .links.tmp
614     echo "" >> srclist.inc
615     echo "" >> csrclist.inc
616 adcroft 1.41 echo "" >> hlist.inc
617 cnh 1.1
618     set THISHOSTNAME = ( `hostname` )
619     set THISCWD = ( `pwd` )
620     set THISDATE = ( `date` )
621    
622 adcroft 1.23 if (-r $mfile) mv -f $mfile $mfile.bak
623 cnh 1.1 ###########################################
624     ## This is the template for the makefile ##
625     ###########################################
626     echo Creating makefile: $mfile
627     echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
628 adcroft 1.23 echo "# This makefile was generated automatically on" >> ${mfile}
629 cnh 1.1 echo "# $THISDATE" >> ${mfile}
630     echo "# by the command:" >> ${mfile}
631     echo "# ${0} $argv" >> ${mfile}
632     echo "# executed by:" >> ${mfile}
633     echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
634     cat >> ${mfile} <<EOF
635     #
636     # BUILDDIR : Directory where object files are written
637     # SOURCEDIRS : Directories containing the source (.F) files
638     # INCLUDEDIRS : Directories containing the header-source (.h) files
639     # EXEDIR : Directory where executable that is generated is written
640     # EXECUTABLE : Full path of executable binary
641     #
642     # CPP : C-preprocessor command
643     # INCLUDES : Directories searched for header files
644     # DEFINES : Macro definitions for CPP
645 heimbach 1.61 # MAKEDEPEND : Dependency generator
646 cnh 1.1 # KPP : Special preprocessor command (specific to platform)
647     # KFLAGS : Flags for KPP
648     # FC : Fortran compiler command
649     # FFLAGS : Configuration/debugging options for FC
650     # FOPTIM : Optimization options for FC
651     # LINK : Command for link editor program
652     # LIBS : Library flags /or/ additional optimization/debugging flags
653    
654 adcroft 1.23 ROOTDIR = ${ROOTDIR}
655     BUILDDIR = ${BUILDDIR}
656     SOURCEDIRS = ${SOURCEDIRS}
657 cnh 1.1 INCLUDEDIRS = ${INCLUDEDIRS}
658 adcroft 1.23 EXEDIR = ${EXEDIR}
659     EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
660     TOOLSDIR = ${TOOLSDIR}
661 cnh 1.1
662 adcroft 1.12 EOF
663    
664    
665     # JAM libraries on Hyades
666     if ($?include_jam_libs) then
667     cat >> ${mfile} <<EOF
668     # extra stuff for Hyades ............................................
669     HYADES_DIR = /u/u0/cnh/jam-lib/software
670 adcroft 1.16 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
671 adcroft 1.35 HYADES_DIR = /usr/local/jamlib/current/dual_proc
672 adcroft 1.12 WORK_DIR = \$(HYADES_DIR)
673     DEPOSIT_DIR = linux_bin
674    
675     STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
676     STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
677     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
678     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
679     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
680    
681     JAMOBJDIR = jam/\$(DEPOSIT_DIR)
682     JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
683     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
684     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
685     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
686     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
687    
688     JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
689     JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
690    
691     XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
692    
693     # ..................................................................
694    
695     EOF
696     endif
697    
698    
699     cat >> ${mfile} <<EOF
700 cnh 1.1 # Unix ln (link)
701     LN = ${LN}
702     # C preprocessor
703 cnh 1.52 CPP = cat \$< | ${S64} | ${CPP}
704 heimbach 1.61 # Dependency generator
705     MAKEDEPEND = ${MAKEDEPEND}
706 cnh 1.1 # Special preprocessor (KAP on DECs, FPP on Crays)
707     KPP = ${KPP}
708     # Fortran compiler
709     FC = ${FC}
710     # Link editor
711     LINK = ${LINK}
712    
713     # Defines for CPP
714     DEFINES = ${DEFINES}
715     # Includes for CPP
716     INCLUDES = ${INCLUDES}
717     # Flags for KPP
718     KFLAGS1 = ${KFLAGS1}
719     KFLAGS2 = ${KFLAGS2}
720     # Optim./debug for FC
721     FFLAGS = ${FFLAGS}
722     FOPTIM = ${FOPTIM}
723 adcroft 1.51 # Flags for CC
724     CFLAGS = ${CFLAGS}
725 cnh 1.1 # Files that should not be optimized
726     NOOPTFILES = ${NOOPTFILES}
727     NOOPTFLAGS = ${NOOPTFLAGS}
728     # Flags and libraries needed for linking
729 adcroft 1.15 LIBS = ${LIBS} \$(XLIBS)
730 cnh 1.1
731     EOF
732    
733 heimbach 1.19 cat srclist.inc >> ${mfile}
734     cat csrclist.inc >> ${mfile}
735 adcroft 1.41 cat hlist.inc >> ${mfile}
736 heimbach 1.19 echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
737     echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
738    
739 adcroft 1.43 rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
740 cnh 1.1
741     cat >> ${mfile} <<EOF
742    
743     .SUFFIXES:
744 cnh 1.5 .SUFFIXES: .o .f .p .F .c
745 cnh 1.1
746     all: \$(EXECUTABLE)
747     \$(EXECUTABLE): \$(OBJFILES)
748     \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
749     depend:
750     @make links
751 heimbach 1.61 \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
752 adcroft 1.32
753 adcroft 1.41 links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
754 heimbach 1.46
755     small_f: \$(F77FILES)
756 heimbach 1.19
757 adcroft 1.45 output.txt: \$(EXECUTABLE)
758 adcroft 1.48 @printf 'running ... '
759 adcroft 1.45 @\$(EXECUTABLE) > \$@
760 heimbach 1.19
761 cnh 1.1 clean:
762     -rm -rf *.o *.f *.p ${RMFILES}
763 cnh 1.6 Clean:
764     @make clean
765 adcroft 1.32 @make cleanlinks
766 adcroft 1.23 -rm -f Makefile.bak
767 adcroft 1.12 CLEAN:
768     @make Clean
769 adcroft 1.28 -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
770     -find \$(EXEDIR) -name "*.data" -exec rm {} \;
771 adcroft 1.23 -rm -f \$(EXECUTABLE)
772 adcroft 1.32
773     makefile:
774     ${0} $argv
775     cleanlinks:
776     -find . -type l -exec rm {} \;
777 cnh 1.1
778     # The normal chain of rules is ( .F - .f - .o )
779     .F.f:
780 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
781 cnh 1.1 .f.o:
782     \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
783 adcroft 1.51 .c.o:
784     \$(CC) \$(CFLAGS) -c \$<
785 cnh 1.1
786     # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
787     .F.p:
788 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
789 cnh 1.1 .p.f:
790     \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
791     EOF
792    
793     # Make list of "exceptions" that need ".p" files
794     foreach sf ($KPPFILES)
795     set fname=( ${sf:t} )
796     echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
797     end
798     foreach sf ($NOOPTFILES)
799     set fname=( ${sf:t} )
800     echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
801     echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
802     end
803 adcroft 1.23 echo "" >> ${mfile}
804    
805     # Add rules for links
806     cat srclinks.tmp >> ${mfile}
807     rm -f srclinks.tmp
808    
809     echo "" >> ${mfile}
810 cnh 1.1 echo "# DO NOT DELETE" >> ${mfile}
811    
812     exit

  ViewVC Help
Powered by ViewVC 1.1.22