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

Contents of /MITgcm/tools/genmake

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


Revision 1.59 - (show annotations) (download)
Thu Feb 7 20:00:09 2002 UTC (22 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint44b_post, chkpt44c_pre, chkpt44c_post
Changes since 1.58: +1 -3 lines
o merge of relevant stuff from the ecco-branch:
  - genmake: removed $S64 overwrite for case SunOS
  - pkg/exf: update and corrections for field swapping and obcs
  - pkg/ecco: parameter lists for the_model_main, the_main_loop
              harmonized between ECCO and MITgcm
  - pkg/autodiff: added flow directives for obcs, mdsio_gl_slice
                  updated checkpointing_lev... lists for obcs
  - model/src: minor changes in forward_step, plot_field
               added directive for divided adjoint in the_main_loop
  - pkg/mdsio: added mdsio_gl_slice

1 #!/bin/csh -f
2 #
3 # $Header: /u/gcmpack/MITgcm/tools/genmake,v 1.56.4.2 2002/02/06 23:19:41 heimbach Exp $
4 # $Name: $
5 #
6 # Makefile generator for MITgcm UV codes
7 # created by cnh 03/98
8 # 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 flt )
13 set DEFINES = ( )
14 set ENABLE = ( )
15 set MODS = ( )
16
17 # Grab variables/lists from .genmakerc
18 if (-r .genmakerc) source .genmakerc
19
20 # Process command-line arguments
21 set allargs=( $argv )
22 while ($#allargs)
23 set arg = $allargs[1]
24 switch ($arg)
25 case -makefile:
26 set mfile = ( Makefile )
27 breaksw
28 case -makefile=*:
29 set mfile = ( `echo $arg | sed 's/-makefile=//' `)
30 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 if ($?platform) then
39 echo Option -platform=dir can only be specified once.; exit 1
40 endif
41 set platform = ( `echo $arg | sed 's/-platform=//' `)
42 breaksw
43 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 set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `)
64 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 set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `)
73 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 case -ieee:
82 set IEEE
83 breaksw
84 case -enable=*:
85 set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
86 breaksw
87 case -mpi:
88 echo "Enabling MPI options"
89 set USEMPI
90 breaksw
91 case -jam:
92 set include_jam_libs
93 echo "Including paths to JAM libraries"
94 breaksw
95 case -help:
96 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 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
131 # Default actions/options
132
133 # If platform wasn't specified then determine platform type of the host
134 if (! $?platform) then
135 set platform = (`uname`)
136 # 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 endif
142 # If name of makefile wasn't specified then use default "Makefile"
143 if (! $?mfile) set mfile = ( Makefile )
144
145 set mach = ( `uname -a` )
146 echo Operating system: $mach
147
148 # Directories for source, includes, binaries and executables
149 #
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 set pwd=`pwd`
154 if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
155 set ROOTDIR = ( .. )
156 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 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 set INCLUDEDIRS = ( )
181 else
182 set SOURCEDIRS = ( $MODS )
183 set INCLUDEDIRS = ( $MODS )
184 endif
185 if (! $?BUILDDIR) set BUILDDIR = ( . )
186 if (! -d $BUILDDIR) then
187 echo Build directory $BUILDDIR not found.;exit 1
188 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 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 # 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 # 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 echo Adding mods dir: $adr
227 end
228 if (! $?PACKAGES) then
229 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 endif
234 foreach dr ($PACKAGES)
235 set enable
236 foreach p ($DISABLE)
237 if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
238 echo Specified package \"$p\" does not exist.
239 exit 1
240 endif
241 if ($dr == $p) unset enable
242 if ($p == 'all') unset enable
243 # 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 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 echo Adding pkg dir: $adr
258 set SOURCEDIRS = ($SOURCEDIRS $adr)
259 set INCLUDEDIRS = ($INCLUDEDIRS $adr)
260 else
261 echo " *" Package \"$dr\" NOT enabled.
262 switch ($dr)
263 case mom_fluxform:
264 set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
265 case mom_vecinv:
266 set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
267 case generic_advdiff:
268 set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
269 default:
270 breaksw
271 endsw
272 endif
273 end
274 if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
275 foreach dr ($STANDARDDIRS)
276 set adr=$ROOTDIR/$dr/src
277 if (! -d $adr) then
278 echo Source directory $adr not found.; exit 1
279 endif
280 echo Adding src dir: $adr
281 set SOURCEDIRS = ($SOURCEDIRS $adr)
282 set idr = `echo $adr | sed 's/src/inc/'`
283 set INCLUDEDIRS = ($INCLUDEDIRS $idr)
284 end
285
286 # This is the generic configuration.
287 # Platform specific options are chosen below
288 set LN = ( 'ln -s' )
289 set CPP = ( '/lib/cpp -P' )
290 set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' )
291 set KPP = ( )
292 set FC = ( 'f77' )
293 set LINK = ( 'f77' )
294 set INCLUDES = ( -I. )
295 set FFLAGS = ( )
296 set FOPTIM = ( )
297 set CFLAGS = ( )
298 set KFLAGS1 = ( )
299 set KFLAGS2 = ( )
300 set LIBS = ( )
301 set KPPFILES = ( )
302 set NOOPTFILES = ( )
303 set NOOPTFLAGS = ( )
304 set RMFILES = ( )
305
306 # We often want to use different compile/link options is using MPI
307 if ($?USEMPI) then
308 set USEMPI = ( '+mpi' )
309 set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' )
310 else
311 set USEMPI
312 # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
313 endif
314
315 # Platform specific options
316 switch ($platform$USEMPI)
317 case OSF1+mpi:
318 echo "Configuring for DEC Alpha with MPI"
319 set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
320 case OSF1:
321 echo "Configuring for DEC Alpha"
322 set CPP = ( '/usr/bin/cpp -P' )
323 set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' )
324 set KPP = ( )
325 set KPPFILES = ( )
326 set KFLAGS1 = ( )
327 set FC = ( 'f77' )
328 set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
329 set FOPTIM = ( '-O5 -fast -tune host -inline all' )
330 set NOOPTFLAGS = ( '-O0' )
331 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
332 set RMFILES = ( '*.p.out' )
333 breaksw
334 case IRIX64+mpi:
335 echo "Configuring for SGI Mips with MPI"
336 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
337 set INCLUDES = ( '-I/usr/local/mpi/include' )
338 set FC = ( 'mpif77' )
339 set LINK = ( 'mpif77' )
340 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
341 set FOPTIM = ( '-O3' )
342 set RMFILES = ( 'rii_files' )
343 breaksw
344 case IRIX64:
345 echo "Configuring for SGI Mips"
346 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
347 set INCLUDES = ( '-I/usr/local/mpi/include' )
348 set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
349 set FOPTIM = ( '-O3' )
350 # set NOOPTFLAGS = ( '-O0' )
351 # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
352 # 'external_fields_load.F' )
353 set RMFILES = ( 'rii_files' )
354 breaksw
355 case o2:
356 case IRIX:
357 echo "Configuring for SGI O2 running IRIX 6.5"
358 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
359 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
360 set FOPTIM = ( '-O2' )
361 set NOOPTFLAGS = ( '-O0' )
362 breaksw
363 case o2+mpi:
364 case IRIX+mpi:
365 echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
366 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
367 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
368 set FOPTIM = ( '-O2' )
369 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
370 set NOOPTFLAGS = ( '-O0' )
371 set LIBS = ( '-lmpi' )
372 breaksw
373 case o2k+mpi:
374 echo "Configuring for SGI Origin2000 running IRIX 6.5"
375 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
376 set INCLUDES = ( '-I/usr/include' )
377 set FFLAGS = ( '-n32 -extend_source -bytereclen' )
378 set FOPTIM = ( '-O2' )
379 set NOOPTFILES = ( 'calc_mom_rhs.F' )
380 set NOOPTFLAGS = ( '-O1' )
381 set LIBS = ( '-lmpi -lscs' )
382 breaksw
383 case onyx:
384 case onyx+mpi:
385 echo "Configuring for SGI ONYX running IRIX64"
386 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
387 set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
388 set FOPTIM = ( '-O2' )
389 set NOOPTFLAGS = ( '-O0' )
390 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
391 set LIBS = ( '-lmpi' )
392 breaksw
393 case SunOS:
394 set LN = ( '/usr/bin/ln -s' )
395 set CPP = ( '/usr/ccs/lib/cpp -P' )
396 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
397 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -r8 -i4 -fsimple=0' )
398 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
399 set CFLAGS = ( '-dalign -O3 -xarch=v9' )
400 set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
401 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 ')
402 breaksw
403 case SunOS+mpi:
404 set LN = ( '/usr/bin/ln -s' )
405 set CPP = ( '/usr/ccs/lib/cpp -P' )
406 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
407 set INCLUDES = ( '-I/usr/local/mpi/include' )
408 set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
409 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -r8 -i4 -fsimple=0' )
410 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
411 set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
412 '-lsocket -lnsl' )
413 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')
414 breaksw
415 case IRIX32:
416 echo "Configuring for SGI ONYX running IRIX64"
417 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
418 set INCLUDES = ( '-I/usr/include' )
419 set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
420 set FOPTIM = ( '-O2' )
421 set NOOPTFLAGS = ( '-O0' )
422 set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
423 'external_fields_load.F' )
424 set LIBS = ( '-lmpi' )
425 breaksw
426 case HP-UX+mpi:
427 set FC = ( 'mpif77' )
428 set LINK = ( 'mpif77' )
429 set INCLUDES = ( '-I/opt/mpi/include' )
430 case HP-UX:
431 echo "Configuring for HP Exemplar"
432 set CPP = ( '/usr/ccs/lbin/cpp -P' )
433 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
434 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
435 '+Okernel_threads' )
436 set FOPTIM = ( '+O2' )
437 set NOOPTFLAGS = ( '+O0' )
438 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
439 'external_fields_load.F' )
440 breaksw
441 case Linux-alpha+mpi:
442 echo "Configuring with MPI"
443 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
444 set INCLUDES = ( '-I/usr/local/include' )
445 case Linux-alpha:
446 echo "Configuring for " $platform
447 set LN = ( '/bin/ln -s' )
448 set CPP = ( '/lib/cpp -traditional -P' )
449 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
450 set FC = ( 'g77' )
451 set FFLAGS = ( ' ' )
452 if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
453 set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
454 set LINK = ( 'g77' )
455 breaksw
456 case Linux*+pgi+mpi:
457 if ($?include_jam_libs) then
458 set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
459 set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
460 else
461 set INCLUDES = ( '-I/usr/local/include' )
462 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
463 endif
464 case Linux*+pgi:
465 echo "Configuring for " $platform
466 set LN = ( '/bin/ln -s' )
467 set CPP = ( '/lib/cpp -traditional -P' )
468 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
469 set FC = ( 'pgf77' )
470 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
471 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
472 set LINK = ( 'pgf77' )
473 breaksw
474 case Linux*+mpi:
475 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
476 set INCLUDES = ( '-I/usr/local/include' )
477 case Linux*:
478 echo "Configuring for " $platform
479 set LN = ( '/bin/ln -s' )
480 set CPP = ( '/lib/cpp -traditional -P' )
481 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
482 set FC = ( 'g77' )
483 set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
484 if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
485 set FOPTIM = ( '-O3 -malign-double -funroll-loops' )
486 set LINK = ( 'g77' )
487 breaksw
488 case T3E:
489 case sn6312:
490 echo "Configuring for T3E"
491 set CPP = ( '/opt/ctl/bin/cpp -P')
492 set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
493 set FC = ( 'f90' )
494 set LINK = ( 'f90' )
495 set FFLAGS = ( '-O 2,fusion' )
496 breaksw
497 case T90:
498 case sn7113:
499 echo "Configuring for T90"
500 set FC = ( 'f90' )
501 set LINK = ( 'f90' )
502 set LN = ( '/bin/ln -s' )
503 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
504 set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
505 set FFLAGS = ( '-m3 -Rabc -N 132')
506 set FOPTIM = ( '-O0' )
507 set NOOPTFLAGS = ( '-O0' )
508 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
509 breaksw
510 case SV1:
511 case sn3002:
512 set FC = ( 'f90' )
513 set LINK = ( 'f90' )
514 set LN = ( '/bin/ln -s' )
515 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
516 set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
517 set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
518 set FOPTIM = ( '-O0' )
519 set NOOPTFLAGS = ( '-O0' )
520 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
521 breaksw
522 case SP3:
523 # originally from A. Biastoch, SIO.
524 echo "Configuring for IBM SP POWER3"
525 set SOURCEDIRS = ( ./ $SOURCEDIRS )
526 set LN = ( 'ln -s' )
527 set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
528 set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' )
529 # set CPP = ( '/lib/cpp' )
530 set FC = ( 'mpxlf95' )
531 set LINK = ( 'mpxlf95' )
532 set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
533 '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
534 set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
535 '-bmaxdata:0x80000000 ' )
536 set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
537 '-bmaxdata:0x80000000' )
538 set LIBS = ( ' timer_stats.o -L/usr/local/apps/mass -lmass' )
539 # set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
540 # set FOPTIM = ( '-O3' )
541 # set NOOPTFLAGS = ( '-O0' )
542 # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
543 # 'external_fields_load.F' )
544 set RMFILES = ( 'rii_files' )
545 breaksw
546 default:
547 echo "Error: platform not recognized: uname -p = " $platform$USEMPI
548 exit
549 breaksw
550 endsw
551
552 ###############################################################################
553 ## ##
554 ## Everything below here should not need to be changed. Platform specific ##
555 ## changes and code specific changes should be configured above this line. ##
556 ## ##
557 ###############################################################################
558
559 # Convert lists of directories into command-line options
560 foreach inc ($INCLUDEDIRS)
561 set INCLUDES = ($INCLUDES -I$inc)
562 end
563
564 # Search for source code
565 rm -rf .links.tmp;mkdir .links.tmp
566 echo "# This section creates symbolic links" > srclinks.tmp
567 echo "" >> srclinks.tmp
568 echo -n 'SRCFILES = ' > srclist.inc
569 echo -n 'CSRCFILES = ' > csrclist.inc
570 echo -n 'HEADERFILES = ' > hlist.inc
571 foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
572 set deplist=( )
573 foreach srcfile (`cd $dr; ls *.[hcF]`)
574 if (! -r .links.tmp/$srcfile) then
575 if (-f $dr/$srcfile) then
576 switch ($srcfile:e)
577 case F:
578 touch .links.tmp/$srcfile
579 set deplist=($deplist $srcfile)
580 echo ' \' >> srclist.inc
581 echo -n " " $srcfile >> srclist.inc
582 breaksw
583 case c:
584 touch .links.tmp/$srcfile
585 set deplist=($deplist $srcfile)
586 echo ' \' >> csrclist.inc
587 echo -n " " $srcfile >> csrclist.inc
588 breaksw
589 case h:
590 touch .links.tmp/$srcfile
591 set deplist=($deplist $srcfile)
592 echo ' \' >> hlist.inc
593 echo -n " " $srcfile >> hlist.inc
594 breaksw
595 endsw
596 endif
597 endif
598 end
599 if ($#deplist != 0) then
600 echo "# These files are linked from $dr" >> srclinks.tmp
601 echo $deplist':' >> srclinks.tmp
602 echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp
603 endif
604 end
605 rm -rf .links.tmp
606 echo "" >> srclist.inc
607 echo "" >> csrclist.inc
608 echo "" >> hlist.inc
609
610 set THISHOSTNAME = ( `hostname` )
611 set THISCWD = ( `pwd` )
612 set THISDATE = ( `date` )
613
614 if (-r $mfile) mv -f $mfile $mfile.bak
615 ###########################################
616 ## This is the template for the makefile ##
617 ###########################################
618 echo Creating makefile: $mfile
619 echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
620 echo "# This makefile was generated automatically on" >> ${mfile}
621 echo "# $THISDATE" >> ${mfile}
622 echo "# by the command:" >> ${mfile}
623 echo "# ${0} $argv" >> ${mfile}
624 echo "# executed by:" >> ${mfile}
625 echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
626 cat >> ${mfile} <<EOF
627 #
628 # BUILDDIR : Directory where object files are written
629 # SOURCEDIRS : Directories containing the source (.F) files
630 # INCLUDEDIRS : Directories containing the header-source (.h) files
631 # EXEDIR : Directory where executable that is generated is written
632 # EXECUTABLE : Full path of executable binary
633 #
634 # CPP : C-preprocessor command
635 # INCLUDES : Directories searched for header files
636 # DEFINES : Macro definitions for CPP
637 # KPP : Special preprocessor command (specific to platform)
638 # KFLAGS : Flags for KPP
639 # FC : Fortran compiler command
640 # FFLAGS : Configuration/debugging options for FC
641 # FOPTIM : Optimization options for FC
642 # LINK : Command for link editor program
643 # LIBS : Library flags /or/ additional optimization/debugging flags
644
645 ROOTDIR = ${ROOTDIR}
646 BUILDDIR = ${BUILDDIR}
647 SOURCEDIRS = ${SOURCEDIRS}
648 INCLUDEDIRS = ${INCLUDEDIRS}
649 EXEDIR = ${EXEDIR}
650 EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
651 TOOLSDIR = ${TOOLSDIR}
652
653 EOF
654
655
656 # JAM libraries on Hyades
657 if ($?include_jam_libs) then
658 cat >> ${mfile} <<EOF
659 # extra stuff for Hyades ............................................
660 HYADES_DIR = /u/u0/cnh/jam-lib/software
661 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
662 HYADES_DIR = /usr/local/jamlib/current/dual_proc
663 WORK_DIR = \$(HYADES_DIR)
664 DEPOSIT_DIR = linux_bin
665
666 STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
667 STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
668 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
669 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
670 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
671
672 JAMOBJDIR = jam/\$(DEPOSIT_DIR)
673 JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
674 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
675 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
676 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
677 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
678
679 JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
680 JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
681
682 XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
683
684 # ..................................................................
685
686 EOF
687 endif
688
689
690 cat >> ${mfile} <<EOF
691 # Unix ln (link)
692 LN = ${LN}
693 # C preprocessor
694 CPP = cat \$< | ${S64} | ${CPP}
695 # Special preprocessor (KAP on DECs, FPP on Crays)
696 KPP = ${KPP}
697 # Fortran compiler
698 FC = ${FC}
699 # Link editor
700 LINK = ${LINK}
701
702 # Defines for CPP
703 DEFINES = ${DEFINES}
704 # Includes for CPP
705 INCLUDES = ${INCLUDES}
706 # Flags for KPP
707 KFLAGS1 = ${KFLAGS1}
708 KFLAGS2 = ${KFLAGS2}
709 # Optim./debug for FC
710 FFLAGS = ${FFLAGS}
711 FOPTIM = ${FOPTIM}
712 # Flags for CC
713 CFLAGS = ${CFLAGS}
714 # Files that should not be optimized
715 NOOPTFILES = ${NOOPTFILES}
716 NOOPTFLAGS = ${NOOPTFLAGS}
717 # Flags and libraries needed for linking
718 LIBS = ${LIBS} \$(XLIBS)
719
720 EOF
721
722 cat srclist.inc >> ${mfile}
723 cat csrclist.inc >> ${mfile}
724 cat hlist.inc >> ${mfile}
725 echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
726 echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
727
728 rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
729
730 cat >> ${mfile} <<EOF
731
732 .SUFFIXES:
733 .SUFFIXES: .o .f .p .F .c
734
735 all: \$(EXECUTABLE)
736 \$(EXECUTABLE): \$(OBJFILES)
737 \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
738 depend:
739 @make links
740 makedepend -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
741
742 links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
743
744 small_f: \$(F77FILES)
745
746 output.txt: \$(EXECUTABLE)
747 @printf 'running ... '
748 @\$(EXECUTABLE) > \$@
749
750 clean:
751 -rm -rf *.o *.f *.p ${RMFILES}
752 Clean:
753 @make clean
754 @make cleanlinks
755 -rm -f Makefile.bak
756 CLEAN:
757 @make Clean
758 -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
759 -find \$(EXEDIR) -name "*.data" -exec rm {} \;
760 -rm -f \$(EXECUTABLE)
761
762 makefile:
763 ${0} $argv
764 cleanlinks:
765 -find . -type l -exec rm {} \;
766
767 # The normal chain of rules is ( .F - .f - .o )
768 .F.f:
769 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
770 .f.o:
771 \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
772 .c.o:
773 \$(CC) \$(CFLAGS) -c \$<
774
775 # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
776 .F.p:
777 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
778 .p.f:
779 \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
780 EOF
781
782 # Make list of "exceptions" that need ".p" files
783 foreach sf ($KPPFILES)
784 set fname=( ${sf:t} )
785 echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
786 end
787 foreach sf ($NOOPTFILES)
788 set fname=( ${sf:t} )
789 echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
790 echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
791 end
792 echo "" >> ${mfile}
793
794 # Add rules for links
795 cat srclinks.tmp >> ${mfile}
796 rm -f srclinks.tmp
797
798 echo "" >> ${mfile}
799 echo "# DO NOT DELETE" >> ${mfile}
800
801 exit

  ViewVC Help
Powered by ViewVC 1.1.22