1 |
#!/bin/csh -f |
#!/bin/csh -f |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
# Makefile generator for MITgcm UV codes |
# Makefile generator for MITgcm UV codes |
7 |
# created by cnh 03/98 |
# created by cnh 03/98 |
8 |
# adapted by aja 06/98 |
# 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 |
# Process command-line arguments |
21 |
set allargs=( $argv ) |
set allargs=( $argv ) |
35 |
exit |
exit |
36 |
breaksw |
breaksw |
37 |
case -platform*: |
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=//' `) |
set platform = ( `echo $arg | sed 's/-platform=//' `) |
42 |
breaksw |
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: |
case -mpi: |
96 |
echo "Enabling MPI options" |
echo "Enabling MPI options" |
97 |
set USEMPI |
set USEMPI |
100 |
set include_jam_libs |
set include_jam_libs |
101 |
echo "Including paths to JAM libraries" |
echo "Including paths to JAM libraries" |
102 |
breaksw |
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: |
case -help: |
116 |
echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]" |
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 |
exit |
141 |
breaksw |
breaksw |
142 |
default: |
default: |
148 |
shift allargs |
shift allargs |
149 |
end |
end |
150 |
|
|
151 |
if ($?platform == 0) then |
# 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`) |
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 |
endif |
162 |
if ($?mfile == 0) set mfile = ( Makefile.$platform ) |
# If name of makefile wasn't specified then use default "Makefile" |
163 |
|
if (! $?mfile) set mfile = ( Makefile ) |
164 |
|
|
165 |
set mach = ( `uname -a` ) |
set mach = ( `uname -a` ) |
166 |
echo Operating system: $mach |
echo Operating system: $mach |
167 |
|
|
168 |
# Directories for source, includes, binaries and executables |
# Directories for source, includes, binaries and executables |
169 |
# Note |
# |
170 |
# o If you prefer/need everything under a single directory |
# If -rootdir wasn't specified then assume script is being run from bin |
171 |
# copy everything in ../eesupp/src, ../model/src, |
# but if it was supplied then we should place the executable in the build dir |
172 |
# ../eesupp/inc and ../model/inc into a directory and then |
if (! $?ROOTDIR) then |
173 |
# edit the paths below to ./ |
set pwd=`pwd` |
174 |
set SOURCEDIRS = ( ../eesupp/src/ ../model/src/ ../diags/src/) |
if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then |
175 |
set INCLUDEDIRS = ( ../eesupp/inc/ ../model/inc/ ../diags/inc/) |
set ROOTDIR = ( .. ) |
176 |
set BUILDDIR = ( ../bin/ ) |
endif |
177 |
set EXEDIR = ( ../exe/ ) |
endif |
178 |
set EXECUTABLE = ( mitgcmuv ) |
# 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. |
# This is the generic configuration. |
350 |
# Platform specific options are chosen below |
# Platform specific options are chosen below |
351 |
set LN = ( 'ln -sf' ) |
set LN = ( 'ln -s' ) |
352 |
set CPP = ( '/lib/cpp -P' ) |
set CPP = ( '/lib/cpp -P' ) |
353 |
|
set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' ) |
354 |
set KPP = ( ) |
set KPP = ( ) |
355 |
set FC = ( 'f77' ) |
#set FC = ( 'f77' ) |
356 |
set LINK = ( 'f77' ) |
set LINK = $FC |
357 |
set DEFINES = ( ) |
set MAKEDEPEND = ( 'makedepend' ) |
358 |
set INCLUDES = ( ) |
set INCLUDES = ( -I. ) |
359 |
set FFLAGS = ( ) |
set FFLAGS = ( ) |
360 |
set FOPTIM = ( ) |
set FOPTIM = ( ) |
361 |
|
set CFLAGS = ( ) |
362 |
set KFLAGS1 = ( ) |
set KFLAGS1 = ( ) |
363 |
set KFLAGS2 = ( ) |
set KFLAGS2 = ( ) |
364 |
set LIBS = ( ) |
set LIBS = ( ) |
365 |
set KPPFILES = ( ) |
set KPPFILES = ( ) |
366 |
set NOOPTFILES = ( ) |
if (! $?NOOPTFILES ) set NOOPTFILES = ( ) |
367 |
set NOOPTFLAGS = ( ) |
if (! $?NOOPTFLAGS ) set NOOPTFLAGS = ( ) |
368 |
set RMFILES = ( ) |
set RMFILES = ( ) |
369 |
|
|
370 |
# We often want to use different compile/link options is using MPI |
# We often want to use different compile/link options is using MPI |
378 |
|
|
379 |
# Platform specific options |
# Platform specific options |
380 |
switch ($platform$USEMPI) |
switch ($platform$USEMPI) |
|
case OSF1: |
|
381 |
case OSF1+mpi: |
case OSF1+mpi: |
382 |
|
#ph: e.g. halem.gsfc.nasa.gov |
383 |
|
echo "Configuring for DEC Alpha with MPI" |
384 |
|
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
385 |
|
#ph: -lkmp_osfp10 not needed on some/many platforms |
386 |
|
case OSF1: |
387 |
echo "Configuring for DEC Alpha" |
echo "Configuring for DEC Alpha" |
388 |
set CPP = ( '/usr/bin/cpp -P' ) |
set CPP = ( '/usr/bin/cpp -P' ) |
389 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
390 |
set KPP = ( 'kapf' ) |
set MAKEDEPEND = ( mkdep -f depend.out ) |
391 |
set KPPFILES = ( 'main.F' ) |
#ph: makedepend not available on some/many DEC Alpha's; use mkdep instead |
392 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
set KPP = ( ) |
393 |
|
set KPPFILES = ( ) |
394 |
|
set KFLAGS1 = ( ) |
395 |
set FC = ( 'f77' ) |
set FC = ( 'f77' ) |
396 |
set FFLAGS = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' ) |
set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' ) |
397 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
398 |
|
#ph: -O5 probably too aggressive in conjunction with adjoint code |
399 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
400 |
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F') |
|
401 |
set RMFILES = ( '*.p.out' ) |
set RMFILES = ( '*.p.out' ) |
402 |
breaksw |
breaksw |
403 |
case IRIX64+mpi: |
case IRIX64+mpi: |
414 |
echo "Configuring for SGI Mips" |
echo "Configuring for SGI Mips" |
415 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
416 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
417 |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' ) |
418 |
set FOPTIM = ( '-O3' ) |
set FOPTIM = ( '-O3' ) |
419 |
# set NOOPTFLAGS = ( '-O0' ) |
if ($?IEEE) set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -static' ) |
420 |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
if ($?IEEE) set FOPTIM = ( '-O0 -OPT:IEEE_arithmetic=1 -OPT:IEEE_NaN_inf=ON' ) |
|
# 'load_external_fields.F' ) |
|
421 |
set RMFILES = ( 'rii_files' ) |
set RMFILES = ( 'rii_files' ) |
422 |
breaksw |
breaksw |
423 |
|
case o2: |
424 |
|
case IRIX: |
425 |
|
echo "Configuring for SGI O2 running IRIX 6.5" |
426 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
427 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
428 |
|
set FOPTIM = ( '-O2' ) |
429 |
|
set NOOPTFLAGS = ( '-O0' ) |
430 |
|
breaksw |
431 |
|
case o2+mpi: |
432 |
|
case IRIX+mpi: |
433 |
|
echo "Configuring for SGI O2 running IRIX 6.5 with MPI" |
434 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
435 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
436 |
|
set FOPTIM = ( '-O2' ) |
437 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
438 |
|
set NOOPTFLAGS = ( '-O0' ) |
439 |
|
set LIBS = ( '-lmpi' ) |
440 |
|
breaksw |
441 |
|
case o2k+mpi: |
442 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
443 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
444 |
|
set INCLUDES = ( '-I/usr/include' ) |
445 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
446 |
|
set FOPTIM = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' ) |
447 |
|
set LIBS = ( '-lmpi -lscs' ) |
448 |
|
breaksw |
449 |
|
case o2k_noopt: |
450 |
|
case o2k_noopt+mpi: |
451 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
452 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
453 |
|
set INCLUDES = ( '-I/usr/include' ) |
454 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
455 |
|
set FOPTIM = ( '-O0' ) |
456 |
|
set LIBS = ( '-lmpi' ) |
457 |
|
breaksw |
458 |
|
case ames_dbg+mpi: |
459 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
460 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
461 |
|
set INCLUDES = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' ) |
462 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
463 |
|
set LIBS = ( '-lmpi -lscs' ) |
464 |
|
set FC = ( 'f90' ) |
465 |
|
set LINK = ( 'f90' ) |
466 |
|
breaksw |
467 |
|
case ames_opt+mpi: |
468 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
469 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
470 |
|
set INCLUDES = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' ) |
471 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
472 |
|
set FOPTIM = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' ) |
473 |
|
set LIBS = ( '-lmpi -lscs' ) |
474 |
|
set FC = ( 'f90' ) |
475 |
|
set LINK = ( 'f90' ) |
476 |
|
breaksw |
477 |
|
case onyx: |
478 |
|
case onyx+mpi: |
479 |
|
echo "Configuring for SGI ONYX running IRIX64" |
480 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
481 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
482 |
|
set FOPTIM = ( '-O2' ) |
483 |
|
set NOOPTFLAGS = ( '-O0' ) |
484 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
485 |
|
set LIBS = ( '-lmpi' ) |
486 |
|
breaksw |
487 |
case SunOS: |
case SunOS: |
488 |
set LN = ( '/usr/bin/ln -fs' ) |
set LN = ( '/usr/bin/ln -s' ) |
489 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
490 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend ) |
491 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
492 |
set FOPTIM = ( '-fast -O4' ) |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
493 |
set NOOPTFLAGS = ( '-O0' ) |
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
494 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F ini_vertical_grid.F') |
set CFLAGS = ( '-dalign -O3 -xarch=v9' ) |
495 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
496 |
|
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 ') |
497 |
breaksw |
breaksw |
498 |
case SunOS+mpi: |
case SunOS+mpi: |
499 |
set LN = ( '/usr/bin/ln -fs' ) |
set LN = ( '/usr/bin/ln -s' ) |
500 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
501 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
502 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
|
|
set FOPTIM = ( '-fast -O4' ) |
|
|
set NOOPTFLAGS = ( '-O0' ) |
|
503 |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
504 |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
505 |
|
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
506 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
507 |
'-lsocket -lnsl' ) |
'-lsocket -lnsl' ) |
508 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F ini_vertical_grid.F') |
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') |
509 |
breaksw |
breaksw |
510 |
case IRIX32: |
case IRIX32: |
511 |
echo "Configuring for SGI ONYX running IRIX64" |
echo "Configuring for SGI ONYX running IRIX64" |
515 |
set FOPTIM = ( '-O2' ) |
set FOPTIM = ( '-O2' ) |
516 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
517 |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
518 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
519 |
set LIBS = ( '-lmpi' ) |
set LIBS = ( '-lmpi' ) |
520 |
breaksw |
breaksw |
521 |
case HP-UX+mpi: |
case HP-UX+mpi: |
531 |
set FOPTIM = ( '+O2' ) |
set FOPTIM = ( '+O2' ) |
532 |
set NOOPTFLAGS = ( '+O0' ) |
set NOOPTFLAGS = ( '+O0' ) |
533 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
534 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
535 |
breaksw |
breaksw |
536 |
case Linux+mpi: |
case Linux-alpha+mpi: |
537 |
|
echo "Configuring with MPI" |
538 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
539 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
540 |
case Linux: |
case Linux-alpha: |
541 |
set LN = ( '/bin/ln -fs' ) |
echo "Configuring for " $platform |
542 |
|
set LN = ( '/bin/ln -s' ) |
543 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
544 |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
545 |
set FC = ( 'g77' ) |
set FC = ( 'g77' ) |
546 |
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
set FFLAGS = ( ' ' ) |
547 |
set FOPTIM = ( '-O3 -malign-double -funroll-loops ' ) |
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
548 |
|
set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' ) |
549 |
set LINK = ( 'g77' ) |
set LINK = ( 'g77' ) |
550 |
breaksw |
breaksw |
551 |
case Linux+pgi+mpi: |
case Linux*+pgi+mpi: |
552 |
if ($?include_jam_libs) then |
if ($?include_jam_libs) then |
553 |
set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' ) |
set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' ) |
554 |
set LIBS = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' ) |
555 |
else |
else |
556 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
557 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
558 |
endif |
endif |
559 |
case Linux+pgi: |
case Linux*+pgi: |
560 |
set LN = ( '/bin/ln -fs' ) |
echo "Configuring for " $platform |
561 |
|
set LN = ( '/bin/ln -s' ) |
562 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
563 |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
564 |
set FC = ( 'pgf77' ) |
set FC = ( 'pgf77' ) |
565 |
set FFLAGS = ( '-byteswapio' ) |
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
566 |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
567 |
set LINK = ( 'pgf77' ) |
set LINK = ( 'pgf77' ) |
568 |
breaksw |
breaksw |
569 |
|
case Linux*+mpi: |
570 |
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
571 |
|
set INCLUDES = ( '-I/usr/local/include' ) |
572 |
|
case Linux*: |
573 |
|
echo "Configuring for " $platform |
574 |
|
set LN = ( '/bin/ln -s' ) |
575 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
576 |
|
switch ($FC) |
577 |
|
case g77: |
578 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
579 |
|
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
580 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
581 |
|
set FOPTIM = ( '-O3 -malign-double -funroll-loops' ) |
582 |
|
set NOOPTFLAGS = ( '-O0' ) |
583 |
|
breaksw |
584 |
|
case pgf77: |
585 |
|
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
586 |
|
set FC = ( 'pgf77' ) |
587 |
|
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
588 |
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
589 |
|
breaksw |
590 |
|
case ifc: |
591 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
592 |
|
set FFLAGS = ( '-132 -r8 -i4 -w95 -W0 -WB' ) |
593 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-mp' ) |
594 |
|
set FOPTIM = ( '-O3 -align' ) |
595 |
|
#P3 set FOPTIM = ( $FOPTIM '-tpp6 -xWKM' ) |
596 |
|
#P4 set FOPTIM = ( $FOPTIM '-tpp7 -xWKM' ) |
597 |
|
set LIBS = ( '-lPEPCF90' ) |
598 |
|
breaksw |
599 |
|
default: |
600 |
|
echo Error: Linux compiler not recognized: \$FC=$FC |
601 |
|
exit |
602 |
|
breaksw |
603 |
|
endsw |
604 |
|
breaksw |
605 |
case T3E: |
case T3E: |
606 |
case sn6312: |
case sn6312: |
607 |
|
echo "Configuring for T3E" |
608 |
set CPP = ( '/opt/ctl/bin/cpp -P') |
set CPP = ( '/opt/ctl/bin/cpp -P') |
609 |
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
610 |
set FC = ( 'f90' ) |
set FC = ( 'f90' ) |
611 |
set LINK = ( 'f90' ) |
set LINK = ( 'f90' ) |
612 |
set FFLAGS = ( '-O 2,fusion' ) |
set FFLAGS = ( '-O 2,fusion' ) |
613 |
breaksw |
breaksw |
614 |
|
case T90: |
615 |
|
case sn7113: |
616 |
|
echo "Configuring for T90" |
617 |
|
set FC = ( 'f90' ) |
618 |
|
set LINK = ( 'f90' ) |
619 |
|
set LN = ( '/bin/ln -s' ) |
620 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
621 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
622 |
|
set FFLAGS = ( '-m3 -Rabc -N 132') |
623 |
|
set FOPTIM = ( '-O0' ) |
624 |
|
set NOOPTFLAGS = ( '-O0' ) |
625 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
626 |
|
breaksw |
627 |
|
case SV1: |
628 |
|
case sn3002: |
629 |
|
set FC = ( 'f90' ) |
630 |
|
set LINK = ( 'f90' ) |
631 |
|
set LN = ( '/bin/ln -s' ) |
632 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
633 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
634 |
|
set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132') |
635 |
|
set FOPTIM = ( '-O0' ) |
636 |
|
set NOOPTFLAGS = ( '-O0' ) |
637 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
638 |
|
breaksw |
639 |
|
case cg01+pgi: |
640 |
|
set LN = ( '/bin/ln -s' ) |
641 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
642 |
|
set INCLUDES = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' ) |
643 |
|
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
644 |
|
set FC = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' ) |
645 |
|
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
646 |
|
# set LIBS = ( '-L/home/cnh/src/gm-1.4/libgm') |
647 |
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
648 |
|
set LINK = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' ) |
649 |
|
breaksw |
650 |
|
case SP3: |
651 |
|
# originally from A. Biastoch, SIO. |
652 |
|
# e.g. horizon.npaci.edu |
653 |
|
echo "Configuring for IBM SP POWER3" |
654 |
|
set SOURCEDIRS = ( ./ $SOURCEDIRS ) |
655 |
|
set LN = ( 'ln -s' ) |
656 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' ) |
657 |
|
set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' ) |
658 |
|
# set CPP = ( '/lib/cpp' ) |
659 |
|
set FC = ( 'mpxlf95' ) |
660 |
|
set LINK = ( 'mpxlf95' ) |
661 |
|
set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
662 |
|
'-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' ) |
663 |
|
set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
664 |
|
'-bmaxdata:0x80000000 ' ) |
665 |
|
set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
666 |
|
'-bmaxdata:0x80000000' ) |
667 |
|
set LIBS = ( ' -L/usr/local/apps/mass -lmass' ) |
668 |
|
# set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
669 |
|
# set FOPTIM = ( '-O3' ) |
670 |
|
# set NOOPTFLAGS = ( '-O0' ) |
671 |
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
672 |
|
# 'external_fields_load.F' ) |
673 |
|
set RMFILES = ( 'rii_files' ) |
674 |
|
breaksw |
675 |
|
case SP4: |
676 |
|
#ph: e.g. bluesky.ucar.edu, marcellus.navo.hpc.mil |
677 |
|
echo "Configuring for IBM SP POWER4" |
678 |
|
set SOURCEDIRS = ( ./ $SOURCEDIRS ) |
679 |
|
set LN = ( 'ln -s' ) |
680 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' ) |
681 |
|
set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' ) |
682 |
|
# set CPP = ( '/lib/cpp' ) |
683 |
|
set FC = ( 'mpxlf95' ) |
684 |
|
set LINK = ( 'mpxlf95' ) |
685 |
|
set FLAGS = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \ |
686 |
|
'-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' ) |
687 |
|
set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \ |
688 |
|
'-bmaxdata:0x80000000 ' ) |
689 |
|
set LDFLAGS = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \ |
690 |
|
'-bmaxdata:0x80000000' ) |
691 |
|
set LIBS = ( ' -L/usr/local/apps/mass -lmass' ) |
692 |
|
# set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
693 |
|
# set FOPTIM = ( '-O3' ) |
694 |
|
# set NOOPTFLAGS = ( '-O0' ) |
695 |
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
696 |
|
# 'external_fields_load.F' ) |
697 |
|
set RMFILES = ( 'rii_files' ) |
698 |
|
breaksw |
699 |
default: |
default: |
700 |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
701 |
exit |
exit |
709 |
## ## |
## ## |
710 |
############################################################################### |
############################################################################### |
711 |
|
|
|
# Create list of files |
|
|
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[F]$'` |
|
|
if ( $#flist ) then |
|
|
echo -n "SRCFILES = " > srclist.inc |
|
|
echo -n "F77FILES = " > f77list.inc |
|
|
echo -n "OBJFILES = " > objlist.inc |
|
|
foreach ff ( ${flist} ) |
|
|
set fname = ( ${ff:t} ) |
|
|
echo ' \' >> srclist.inc |
|
|
echo -n " " ${fname:r}.F >> srclist.inc |
|
|
echo ' \' >> f77list.inc |
|
|
echo -n " " ${fname:r}.f >> f77list.inc |
|
|
echo ' \' >> objlist.inc |
|
|
echo -n " " ${fname:r}.o >> objlist.inc |
|
|
end |
|
|
else |
|
|
echo No source files found...\! |
|
|
exit |
|
|
endif |
|
|
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[c]$'` |
|
|
if ( $#flist ) then |
|
|
foreach ff ( ${flist} ) |
|
|
set fname = ( ${ff:t} ) |
|
|
echo ' \' >> objlist.inc |
|
|
echo -n " " ${fname:r}.o >> objlist.inc |
|
|
endif |
|
|
echo " " >> srclist.inc |
|
|
echo " " >> f77list.inc |
|
|
echo " " >> objlist.inc |
|
|
|
|
712 |
# Convert lists of directories into command-line options |
# Convert lists of directories into command-line options |
713 |
foreach inc ($INCLUDEDIRS) |
foreach inc ($INCLUDEDIRS) |
714 |
set INCLUDES = ($INCLUDES -I$inc) |
set INCLUDES = ($INCLUDES -I$inc) |
715 |
end |
end |
716 |
set SRCSTARS = ( ) |
|
717 |
foreach dr ($SOURCEDIRS) |
# Search for source code |
718 |
set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] ) |
rm -rf .links.tmp;mkdir .links.tmp |
719 |
|
echo "# This section creates symbolic links" > srclinks.tmp |
720 |
|
echo "" >> srclinks.tmp |
721 |
|
echo -n 'SRCFILES = ' > srclist.inc |
722 |
|
echo -n 'CSRCFILES = ' > csrclist.inc |
723 |
|
echo -n 'HEADERFILES = ' > hlist.inc |
724 |
|
foreach dr ($SOURCEDIRS $INCLUDEDIRS .) |
725 |
|
set deplist=( ) |
726 |
|
foreach srcfile (`cd $dr; ls *.[hcF]`) |
727 |
|
if (! -r .links.tmp/$srcfile) then |
728 |
|
if (-f $dr/$srcfile) then |
729 |
|
switch ($srcfile:e) |
730 |
|
case F: |
731 |
|
touch .links.tmp/$srcfile |
732 |
|
set deplist=($deplist $srcfile) |
733 |
|
echo ' \' >> srclist.inc |
734 |
|
echo -n " " $srcfile >> srclist.inc |
735 |
|
breaksw |
736 |
|
case c: |
737 |
|
touch .links.tmp/$srcfile |
738 |
|
set deplist=($deplist $srcfile) |
739 |
|
echo ' \' >> csrclist.inc |
740 |
|
echo -n " " $srcfile >> csrclist.inc |
741 |
|
breaksw |
742 |
|
case h: |
743 |
|
touch .links.tmp/$srcfile |
744 |
|
set deplist=($deplist $srcfile) |
745 |
|
echo ' \' >> hlist.inc |
746 |
|
echo -n " " $srcfile >> hlist.inc |
747 |
|
breaksw |
748 |
|
endsw |
749 |
|
endif |
750 |
|
endif |
751 |
|
end |
752 |
|
if ($#deplist != 0) then |
753 |
|
echo "# These files are linked from $dr" >> srclinks.tmp |
754 |
|
echo $deplist':' >> srclinks.tmp |
755 |
|
echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp |
756 |
|
endif |
757 |
end |
end |
758 |
|
rm -rf .links.tmp |
759 |
|
echo "" >> srclist.inc |
760 |
|
echo "" >> csrclist.inc |
761 |
|
echo "" >> hlist.inc |
762 |
|
|
763 |
set THISHOSTNAME = ( `hostname` ) |
set THISHOSTNAME = ( `hostname` ) |
764 |
set THISCWD = ( `pwd` ) |
set THISCWD = ( `pwd` ) |
765 |
set THISDATE = ( `date` ) |
set THISDATE = ( `date` ) |
766 |
|
|
767 |
|
if (-r $mfile) mv -f $mfile $mfile.bak |
768 |
########################################### |
########################################### |
769 |
## This is the template for the makefile ## |
## This is the template for the makefile ## |
770 |
########################################### |
########################################### |
771 |
echo Creating makefile: $mfile |
echo Creating makefile: $mfile |
772 |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
773 |
echo "# This makefile was generated automatically pn" >> ${mfile} |
echo "# This makefile was generated automatically on" >> ${mfile} |
774 |
echo "# $THISDATE" >> ${mfile} |
echo "# $THISDATE" >> ${mfile} |
775 |
echo "# by the command:" >> ${mfile} |
echo "# by the command:" >> ${mfile} |
776 |
echo "# ${0} $argv" >> ${mfile} |
echo "# ${0} $argv" >> ${mfile} |
787 |
# CPP : C-preprocessor command |
# CPP : C-preprocessor command |
788 |
# INCLUDES : Directories searched for header files |
# INCLUDES : Directories searched for header files |
789 |
# DEFINES : Macro definitions for CPP |
# DEFINES : Macro definitions for CPP |
790 |
|
# MAKEDEPEND : Dependency generator |
791 |
# KPP : Special preprocessor command (specific to platform) |
# KPP : Special preprocessor command (specific to platform) |
792 |
# KFLAGS : Flags for KPP |
# KFLAGS : Flags for KPP |
793 |
# FC : Fortran compiler command |
# FC : Fortran compiler command |
796 |
# LINK : Command for link editor program |
# LINK : Command for link editor program |
797 |
# LIBS : Library flags /or/ additional optimization/debugging flags |
# LIBS : Library flags /or/ additional optimization/debugging flags |
798 |
|
|
799 |
BUILDDIR = ${BUILDDIR} |
ROOTDIR = ${ROOTDIR} |
800 |
SOURCEDIRS = ${SOURCEDIRS} |
BUILDDIR = ${BUILDDIR} |
801 |
|
SOURCEDIRS = ${SOURCEDIRS} |
802 |
INCLUDEDIRS = ${INCLUDEDIRS} |
INCLUDEDIRS = ${INCLUDEDIRS} |
803 |
EXEDIR = ${EXEDIR} |
EXEDIR = ${EXEDIR} |
804 |
EXECUTABLE = \$(EXEDIR)${EXECUTABLE} |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
805 |
|
TOOLSDIR = ${TOOLSDIR} |
806 |
|
|
807 |
EOF |
EOF |
808 |
|
|
813 |
# extra stuff for Hyades ............................................ |
# extra stuff for Hyades ............................................ |
814 |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
815 |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
816 |
|
HYADES_DIR = /usr/local/jamlib/current/dual_proc |
817 |
WORK_DIR = \$(HYADES_DIR) |
WORK_DIR = \$(HYADES_DIR) |
818 |
DEPOSIT_DIR = linux_bin |
DEPOSIT_DIR = linux_bin |
819 |
|
|
845 |
# Unix ln (link) |
# Unix ln (link) |
846 |
LN = ${LN} |
LN = ${LN} |
847 |
# C preprocessor |
# C preprocessor |
848 |
CPP = cat \$< | ../tools/set64bitConst.sh | ${CPP} |
CPP = cat \$< | ${S64} | ${CPP} |
849 |
|
# Dependency generator |
850 |
|
MAKEDEPEND = ${MAKEDEPEND} |
851 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
852 |
KPP = ${KPP} |
KPP = ${KPP} |
853 |
# Fortran compiler |
# Fortran compiler |
865 |
# Optim./debug for FC |
# Optim./debug for FC |
866 |
FFLAGS = ${FFLAGS} |
FFLAGS = ${FFLAGS} |
867 |
FOPTIM = ${FOPTIM} |
FOPTIM = ${FOPTIM} |
868 |
|
# Flags for CC |
869 |
|
CFLAGS = ${CFLAGS} |
870 |
# Files that should not be optimized |
# Files that should not be optimized |
871 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
872 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
875 |
|
|
876 |
EOF |
EOF |
877 |
|
|
878 |
cat srclist.inc >> ${mfile} |
cat srclist.inc >> ${mfile} |
879 |
cat f77list.inc >> ${mfile} |
cat csrclist.inc >> ${mfile} |
880 |
cat objlist.inc >> ${mfile} |
cat hlist.inc >> ${mfile} |
881 |
rm -f srclist.inc f77list.inc objlist.inc |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
882 |
|
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
883 |
|
|
884 |
|
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp |
885 |
|
|
886 |
cat >> ${mfile} <<EOF |
cat >> ${mfile} <<EOF |
887 |
|
|
891 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
892 |
\$(EXECUTABLE): \$(OBJFILES) |
\$(EXECUTABLE): \$(OBJFILES) |
893 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
|
links: |
|
|
@-\$(LN) $SRCSTARS . |
|
894 |
depend: |
depend: |
895 |
@make links |
@make links |
896 |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
897 |
|
|
898 |
|
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) |
899 |
|
|
900 |
|
small_f: \$(F77FILES) |
901 |
|
|
902 |
|
output.txt: \$(EXECUTABLE) |
903 |
|
@printf 'running ... ' |
904 |
|
@\$(EXECUTABLE) > \$@ |
905 |
|
|
906 |
clean: |
clean: |
907 |
-rm -rf *.o *.f *.p ${RMFILES} |
-rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl} |
908 |
Clean: |
Clean: |
909 |
@make clean |
@make clean |
910 |
-find . -type l -exec rm {} \; |
@make cleanlinks |
911 |
-rm Makefile.bak |
-rm -f Makefile.bak |
912 |
CLEAN: |
CLEAN: |
913 |
@make Clean |
@make Clean |
914 |
-find ../verification/ -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
915 |
-find ../verification/ -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
916 |
-rm \$(EXECUTABLE) |
-rm -f \$(EXECUTABLE) |
917 |
|
|
918 |
|
makefile: |
919 |
|
${0} $argv |
920 |
|
cleanlinks: |
921 |
|
-find . -type l -exec rm {} \; |
922 |
|
|
923 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .f - .o ) |
924 |
.F.f: |
.F.f: |
925 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
926 |
.f.o: |
.f.o: |
927 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
928 |
|
.c.o: |
929 |
|
\$(CC) \$(CFLAGS) -c \$< |
930 |
|
|
931 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
932 |
.F.p: |
.F.p: |
945 |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
946 |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
947 |
end |
end |
948 |
echo >> ${mfile} |
echo "" >> ${mfile} |
949 |
|
|
950 |
|
# Add rules for links |
951 |
|
cat srclinks.tmp >> ${mfile} |
952 |
|
rm -f srclinks.tmp |
953 |
|
|
954 |
|
echo "" >> ${mfile} |
955 |
echo "# DO NOT DELETE" >> ${mfile} |
echo "# DO NOT DELETE" >> ${mfile} |
956 |
|
|
957 |
exit |
exit |