/[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.73 - (show annotations) (download)
Thu Dec 5 08:43:03 2002 UTC (21 years, 4 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint47j_post, checkpoint48d_pre, branch-exfmods-tag, checkpoint47e_post, checkpoint47i_post, checkpoint47f_post, checkpoint47c_post, checkpoint47d_post, checkpoint48e_post, checkpoint48d_post, checkpoint48c_post, checkpoint47d_pre, checkpoint48, checkpoint47b_post, checkpoint47h_post, checkpoint47g_post, checkpoint48b_post, checkpoint48c_pre, checkpoint48a_post
Branch point for: branch-exfmods-curt
Changes since 1.72: +13 -7 lines
checkpoint47b_post
Merging from release1_p9:
o pkg/seaice
  - removed GOTO's and added taf directives
  - double precision constants to reduce the g77 (Linux)
    to F77 (SGI) differences reported in release1_p8
o tools/genmake
  - added SGI options
o verification/testscript
  - updated to that of checkpoint47a_post
o verification/global_ocean.90x40x15/input/eedata
  - modified for SGI f77 compatibility
o verification/lab_sea
  - added description of sea-ice model
  - added missing matlab routines
  - added test of thermodynamics parallelization
Modified Files:
   doc/tag-index pkg/seaice/SEAICE_FFIELDS.h
   pkg/seaice/SEAICE_PARAMS.h pkg/seaice/adi.F
   pkg/seaice/advect.F pkg/seaice/budget.F pkg/seaice/diffus.F
   pkg/seaice/dynsolver.F pkg/seaice/groatb.F pkg/seaice/growth.F
   pkg/seaice/lsr.F pkg/seaice/ostres.F
   pkg/seaice/seaice_do_diags.F pkg/seaice/seaice_get_forcing.F
   pkg/seaice/seaice_init.F pkg/seaice/seaice_model.F
   pkg/seaice/seaice_readparms.F tools/genmake
   verification/global_ocean.90x40x15/input/eedata
   verification/lab_sea/README
   verification/lab_sea/matlab/lookat_exp1.m
   verification/lab_sea/matlab/lookat_exp2.m
   verification/lab_sea/matlab/lookat_exp3.m
   verification/lab_sea/matlab/lookat_exp4.m
   verification/lab_sea/matlab/lookat_exp5.m
   verification/lab_sea/matlab/lookat_exp6.m
   verification/lab_sea/results/AREAtave.0000000010.data
   verification/lab_sea/results/HEFFtave.0000000010.data
   verification/lab_sea/results/UICEtave.0000000010.data
   verification/lab_sea/results/VICEtave.0000000010.data
   verification/lab_sea/results/output.txt
Added Files:
   verification/lab_sea/seaice.ps
   verification/lab_sea/matlab/lookat_exp7.m
   verification/lab_sea/matlab/mmax.m
   verification/lab_sea/matlab/mypcolor.m
   verification/lab_sea/matlab/myquiver.m
   verification/lab_sea/matlab/readbin.m
   verification/lab_sea/matlab/wysiwyg.m
Removed Files:
   verification/lab_sea/code/KPP_OPTIONS.h

1 #!/bin/csh -f
2 #
3 # $Header: /u/gcmpack/MITgcm/tools/genmake,v 1.72 2002/11/21 19:36:38 cheisey 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 onyx:
454 case onyx+mpi:
455 echo "Configuring for SGI ONYX running IRIX64"
456 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
457 set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
458 set FOPTIM = ( '-O2' )
459 set NOOPTFLAGS = ( '-O0' )
460 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
461 set LIBS = ( '-lmpi' )
462 breaksw
463 case SunOS:
464 set LN = ( '/usr/bin/ln -s' )
465 set CPP = ( '/usr/ccs/lib/cpp -P' )
466 set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
467 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
468 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
469 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
470 set CFLAGS = ( '-dalign -O3 -xarch=v9' )
471 set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
472 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 ')
473 breaksw
474 case SunOS+mpi:
475 set LN = ( '/usr/bin/ln -s' )
476 set CPP = ( '/usr/ccs/lib/cpp -P' )
477 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
478 set INCLUDES = ( '-I/usr/local/mpi/include' )
479 set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
480 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
481 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
482 set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
483 '-lsocket -lnsl' )
484 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')
485 breaksw
486 case IRIX32:
487 echo "Configuring for SGI ONYX running IRIX64"
488 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
489 set INCLUDES = ( '-I/usr/include' )
490 set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
491 set FOPTIM = ( '-O2' )
492 set NOOPTFLAGS = ( '-O0' )
493 set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
494 'external_fields_load.F' )
495 set LIBS = ( '-lmpi' )
496 breaksw
497 case HP-UX+mpi:
498 set FC = ( 'mpif77' )
499 set LINK = ( 'mpif77' )
500 set INCLUDES = ( '-I/opt/mpi/include' )
501 case HP-UX:
502 echo "Configuring for HP Exemplar"
503 set CPP = ( '/usr/ccs/lbin/cpp -P' )
504 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
505 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
506 '+Okernel_threads' )
507 set FOPTIM = ( '+O2' )
508 set NOOPTFLAGS = ( '+O0' )
509 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
510 'external_fields_load.F' )
511 breaksw
512 case Linux-alpha+mpi:
513 echo "Configuring with MPI"
514 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
515 set INCLUDES = ( '-I/usr/local/include' )
516 case Linux-alpha:
517 echo "Configuring for " $platform
518 set LN = ( '/bin/ln -s' )
519 set CPP = ( '/lib/cpp -traditional -P' )
520 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
521 set FC = ( 'g77' )
522 set FFLAGS = ( ' ' )
523 if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
524 set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
525 set LINK = ( 'g77' )
526 breaksw
527 case Linux*+pgi+mpi:
528 if ($?include_jam_libs) then
529 set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
530 set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
531 else
532 set INCLUDES = ( '-I/usr/local/include' )
533 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
534 endif
535 case Linux*+pgi:
536 echo "Configuring for " $platform
537 set LN = ( '/bin/ln -s' )
538 set CPP = ( '/lib/cpp -traditional -P' )
539 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
540 set FC = ( 'pgf77' )
541 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
542 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
543 set LINK = ( 'pgf77' )
544 breaksw
545 case Linux*+mpi:
546 set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
547 set INCLUDES = ( '-I/usr/local/include' )
548 case Linux*:
549 echo "Configuring for " $platform
550 set LN = ( '/bin/ln -s' )
551 set CPP = ( '/lib/cpp -traditional -P' )
552 switch ($FC)
553 case g77:
554 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
555 set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
556 if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
557 set FOPTIM = ( '-O3 -malign-double -funroll-loops' )
558 breaksw
559 case pgf77:
560 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
561 set FC = ( 'pgf77' )
562 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
563 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
564 breaksw
565 case ifc:
566 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
567 set FFLAGS = ( '-132 -r8 -i4 -w95 -W0 -WB' )
568 if ($?IEEE) set FFLAGS = ( $FFLAGS '-mp' )
569 set FOPTIM = ( '-O3 -align' )
570 #P3 set FOPTIM = ( $FOPTIM '-tpp6 -xWKM' )
571 #P4 set FOPTIM = ( $FOPTIM '-tpp7 -xWKM' )
572 set LIBS = ( '-lPEPCF90' )
573 breaksw
574 default:
575 echo Error: Linux compiler not recognized: \$FC=$FC
576 exit
577 breaksw
578 endsw
579 breaksw
580 case T3E:
581 case sn6312:
582 echo "Configuring for T3E"
583 set CPP = ( '/opt/ctl/bin/cpp -P')
584 set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
585 set FC = ( 'f90' )
586 set LINK = ( 'f90' )
587 set FFLAGS = ( '-O 2,fusion' )
588 breaksw
589 case T90:
590 case sn7113:
591 echo "Configuring for T90"
592 set FC = ( 'f90' )
593 set LINK = ( 'f90' )
594 set LN = ( '/bin/ln -s' )
595 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
596 set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
597 set FFLAGS = ( '-m3 -Rabc -N 132')
598 set FOPTIM = ( '-O0' )
599 set NOOPTFLAGS = ( '-O0' )
600 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
601 breaksw
602 case SV1:
603 case sn3002:
604 set FC = ( 'f90' )
605 set LINK = ( 'f90' )
606 set LN = ( '/bin/ln -s' )
607 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
608 set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
609 set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
610 set FOPTIM = ( '-O0' )
611 set NOOPTFLAGS = ( '-O0' )
612 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
613 breaksw
614 case cg01+pgi:
615 set LN = ( '/bin/ln -s' )
616 set CPP = ( '/lib/cpp -traditional -P' )
617 set INCLUDES = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' )
618 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
619 set FC = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
620 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
621 # set LIBS = ( '-L/home/cnh/src/gm-1.4/libgm')
622 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
623 set LINK = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
624 breaksw
625 case SP3:
626 # originally from A. Biastoch, SIO.
627 echo "Configuring for IBM SP POWER3"
628 set SOURCEDIRS = ( ./ $SOURCEDIRS )
629 set LN = ( 'ln -s' )
630 set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
631 set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' )
632 # set CPP = ( '/lib/cpp' )
633 set FC = ( 'mpxlf95' )
634 set LINK = ( 'mpxlf95' )
635 set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
636 '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
637 set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
638 '-bmaxdata:0x80000000 ' )
639 set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
640 '-bmaxdata:0x80000000' )
641 set LIBS = ( ' -L/usr/local/apps/mass -lmass' )
642 # set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
643 # set FOPTIM = ( '-O3' )
644 # set NOOPTFLAGS = ( '-O0' )
645 # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
646 # 'external_fields_load.F' )
647 set RMFILES = ( 'rii_files' )
648 breaksw
649 default:
650 echo "Error: platform not recognized: uname -p = " $platform$USEMPI
651 exit
652 breaksw
653 endsw
654
655 ###############################################################################
656 ## ##
657 ## Everything below here should not need to be changed. Platform specific ##
658 ## changes and code specific changes should be configured above this line. ##
659 ## ##
660 ###############################################################################
661
662 # Convert lists of directories into command-line options
663 foreach inc ($INCLUDEDIRS)
664 set INCLUDES = ($INCLUDES -I$inc)
665 end
666
667 # Search for source code
668 rm -rf .links.tmp;mkdir .links.tmp
669 echo "# This section creates symbolic links" > srclinks.tmp
670 echo "" >> srclinks.tmp
671 echo -n 'SRCFILES = ' > srclist.inc
672 echo -n 'CSRCFILES = ' > csrclist.inc
673 echo -n 'HEADERFILES = ' > hlist.inc
674 foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
675 set deplist=( )
676 foreach srcfile (`cd $dr; ls *.[hcF]`)
677 if (! -r .links.tmp/$srcfile) then
678 if (-f $dr/$srcfile) then
679 switch ($srcfile:e)
680 case F:
681 touch .links.tmp/$srcfile
682 set deplist=($deplist $srcfile)
683 echo ' \' >> srclist.inc
684 echo -n " " $srcfile >> srclist.inc
685 breaksw
686 case c:
687 touch .links.tmp/$srcfile
688 set deplist=($deplist $srcfile)
689 echo ' \' >> csrclist.inc
690 echo -n " " $srcfile >> csrclist.inc
691 breaksw
692 case h:
693 touch .links.tmp/$srcfile
694 set deplist=($deplist $srcfile)
695 echo ' \' >> hlist.inc
696 echo -n " " $srcfile >> hlist.inc
697 breaksw
698 endsw
699 endif
700 endif
701 end
702 if ($#deplist != 0) then
703 echo "# These files are linked from $dr" >> srclinks.tmp
704 echo $deplist':' >> srclinks.tmp
705 echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp
706 endif
707 end
708 rm -rf .links.tmp
709 echo "" >> srclist.inc
710 echo "" >> csrclist.inc
711 echo "" >> hlist.inc
712
713 set THISHOSTNAME = ( `hostname` )
714 set THISCWD = ( `pwd` )
715 set THISDATE = ( `date` )
716
717 if (-r $mfile) mv -f $mfile $mfile.bak
718 ###########################################
719 ## This is the template for the makefile ##
720 ###########################################
721 echo Creating makefile: $mfile
722 echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
723 echo "# This makefile was generated automatically on" >> ${mfile}
724 echo "# $THISDATE" >> ${mfile}
725 echo "# by the command:" >> ${mfile}
726 echo "# ${0} $argv" >> ${mfile}
727 echo "# executed by:" >> ${mfile}
728 echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
729 cat >> ${mfile} <<EOF
730 #
731 # BUILDDIR : Directory where object files are written
732 # SOURCEDIRS : Directories containing the source (.F) files
733 # INCLUDEDIRS : Directories containing the header-source (.h) files
734 # EXEDIR : Directory where executable that is generated is written
735 # EXECUTABLE : Full path of executable binary
736 #
737 # CPP : C-preprocessor command
738 # INCLUDES : Directories searched for header files
739 # DEFINES : Macro definitions for CPP
740 # MAKEDEPEND : Dependency generator
741 # KPP : Special preprocessor command (specific to platform)
742 # KFLAGS : Flags for KPP
743 # FC : Fortran compiler command
744 # FFLAGS : Configuration/debugging options for FC
745 # FOPTIM : Optimization options for FC
746 # LINK : Command for link editor program
747 # LIBS : Library flags /or/ additional optimization/debugging flags
748
749 ROOTDIR = ${ROOTDIR}
750 BUILDDIR = ${BUILDDIR}
751 SOURCEDIRS = ${SOURCEDIRS}
752 INCLUDEDIRS = ${INCLUDEDIRS}
753 EXEDIR = ${EXEDIR}
754 EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
755 TOOLSDIR = ${TOOLSDIR}
756
757 EOF
758
759
760 # JAM libraries on Hyades
761 if ($?include_jam_libs) then
762 cat >> ${mfile} <<EOF
763 # extra stuff for Hyades ............................................
764 HYADES_DIR = /u/u0/cnh/jam-lib/software
765 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
766 HYADES_DIR = /usr/local/jamlib/current/dual_proc
767 WORK_DIR = \$(HYADES_DIR)
768 DEPOSIT_DIR = linux_bin
769
770 STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
771 STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
772 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
773 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
774 \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
775
776 JAMOBJDIR = jam/\$(DEPOSIT_DIR)
777 JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
778 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
779 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
780 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
781 \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
782
783 JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
784 JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
785
786 XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
787
788 # ..................................................................
789
790 EOF
791 endif
792
793
794 cat >> ${mfile} <<EOF
795 # Unix ln (link)
796 LN = ${LN}
797 # C preprocessor
798 CPP = cat \$< | ${S64} | ${CPP}
799 # Dependency generator
800 MAKEDEPEND = ${MAKEDEPEND}
801 # Special preprocessor (KAP on DECs, FPP on Crays)
802 KPP = ${KPP}
803 # Fortran compiler
804 FC = ${FC}
805 # Link editor
806 LINK = ${LINK}
807
808 # Defines for CPP
809 DEFINES = ${DEFINES}
810 # Includes for CPP
811 INCLUDES = ${INCLUDES}
812 # Flags for KPP
813 KFLAGS1 = ${KFLAGS1}
814 KFLAGS2 = ${KFLAGS2}
815 # Optim./debug for FC
816 FFLAGS = ${FFLAGS}
817 FOPTIM = ${FOPTIM}
818 # Flags for CC
819 CFLAGS = ${CFLAGS}
820 # Files that should not be optimized
821 NOOPTFILES = ${NOOPTFILES}
822 NOOPTFLAGS = ${NOOPTFLAGS}
823 # Flags and libraries needed for linking
824 LIBS = ${LIBS} \$(XLIBS)
825
826 EOF
827
828 cat srclist.inc >> ${mfile}
829 cat csrclist.inc >> ${mfile}
830 cat hlist.inc >> ${mfile}
831 echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
832 echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
833
834 rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
835
836 cat >> ${mfile} <<EOF
837
838 .SUFFIXES:
839 .SUFFIXES: .o .f .p .F .c
840
841 all: \$(EXECUTABLE)
842 \$(EXECUTABLE): \$(OBJFILES)
843 \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
844 depend:
845 @make links
846 \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
847
848 links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
849
850 small_f: \$(F77FILES)
851
852 output.txt: \$(EXECUTABLE)
853 @printf 'running ... '
854 @\$(EXECUTABLE) > \$@
855
856 clean:
857 -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
858 Clean:
859 @make clean
860 @make cleanlinks
861 -rm -f Makefile.bak
862 CLEAN:
863 @make Clean
864 -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
865 -find \$(EXEDIR) -name "*.data" -exec rm {} \;
866 -rm -f \$(EXECUTABLE)
867
868 makefile:
869 ${0} $argv
870 cleanlinks:
871 -find . -type l -exec rm {} \;
872
873 # The normal chain of rules is ( .F - .f - .o )
874 .F.f:
875 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
876 .f.o:
877 \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
878 .c.o:
879 \$(CC) \$(CFLAGS) -c \$<
880
881 # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
882 .F.p:
883 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
884 .p.f:
885 \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
886 EOF
887
888 # Make list of "exceptions" that need ".p" files
889 foreach sf ($KPPFILES)
890 set fname=( ${sf:t} )
891 echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
892 end
893 foreach sf ($NOOPTFILES)
894 set fname=( ${sf:t} )
895 echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
896 echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
897 end
898 echo "" >> ${mfile}
899
900 # Add rules for links
901 cat srclinks.tmp >> ${mfile}
902 rm -f srclinks.tmp
903
904 echo "" >> ${mfile}
905 echo "# DO NOT DELETE" >> ${mfile}
906
907 exit

  ViewVC Help
Powered by ViewVC 1.1.22