/[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.56.4.5 - (show annotations) (download)
Fri Feb 28 09:34:05 2003 UTC (21 years, 1 month ago) by dimitri
Branch: ecco-branch
CVS Tags: ecco_c44_e27, icebear5, icebear4, ecco_c50_e30, ecco_c50_e29, ecco_c50_e28
Branch point for: icebear
Changes since 1.56.4.4: +2 -1 lines
o Reduced derivative singularities in pkg/seaice.

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

  ViewVC Help
Powered by ViewVC 1.1.22