/[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.74 - (show annotations) (download)
Tue Feb 18 05:33:55 2003 UTC (21 years, 2 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint48f_post, checkpoint48h_post, checkpoint48g_post
Changes since 1.73: +20 -1 lines
Merging from release1_p12:
o Modifications for using pkg/exf with pkg/seaice
  - improved description of the various forcing configurations
  - added basic radiation bulk formulae to pkg/exf
  - units/sign fix for evap computation in exf_getffields.F
  - updated verification/global_with_exf/results/output.txt
o Added pkg/sbo for computing IERS Special Bureau for the Oceans
  (SBO) core products, including oceanic mass, center-of-mass,
  angular, and bottom pressure (see pkg/sbo/README.sbo).
o Lower bound for viscosity/diffusivity in pkg/kpp/kpp_routines.F
  to avoid negative values in shallow regions.
  - updated verification/natl_box/results/output.txt
  - updated verification/lab_sea/results/output.txt
o MPI gather, scatter: eesupp/src/gather_2d.F and scatter_2d.F
o Added useSingleCpuIO option (see PARAMS.h).
o Updated useSingleCpuIO option in mdsio_writefield.F to
  work with multi-field files, e.g., for single-file pickup.
o pkg/seaice:
  - bug fix in growth.F: QNET for no shortwave case
  - added HeffFile for specifying initial sea-ice thickness
  - changed SEAICE_EXTERNAL_FLUXES wind stress implementation
o Added missing /* */ to CPP comments in pkg/seaice, pkg/exf,
  kpp_transport_t.F, forward_step.F, and the_main_loop.F
o pkg/seaice:
  - adjoint-friendly modifications
  - added a SEAICE_WRITE_PICKUP at end of the_model_main.F

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

  ViewVC Help
Powered by ViewVC 1.1.22