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 ) |
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 ) |
22 |
while ($#allargs) |
while ($#allargs) |
23 |
set arg = $allargs[1] |
set arg = $allargs[1] |
24 |
switch ($arg) |
switch ($arg) |
25 |
case -makefile*: |
case -makefile: |
26 |
if ($arg == "-makefile") then |
set mfile = ( Makefile ) |
27 |
set mfile = ( Makefile ) |
breaksw |
28 |
else |
case -makefile=*: |
29 |
set mfile = ( `echo $arg | sed 's/-makefile=//' `) |
set mfile = ( `echo $arg | sed 's/-makefile=//' `) |
|
endif |
|
30 |
breaksw |
breaksw |
31 |
case -platform: |
case -platform: |
32 |
case -platform=: |
case -platform=: |
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 |
98 |
breaksw |
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: |
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: |
147 |
endsw |
endsw |
148 |
shift allargs |
shift allargs |
149 |
end |
end |
150 |
|
|
151 |
if ($?platform == 0) set platform = (`uname -p`) |
# Default actions/options |
152 |
if ($?mfile == 0) set mfile = ( Makefile.$platform ) |
|
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` ) |
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 | 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=(ifc g77 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 = ( ) |
378 |
|
|
379 |
# Platform specific options |
# Platform specific options |
380 |
switch ($platform$USEMPI) |
switch ($platform$USEMPI) |
381 |
case alpha: |
case OSF1+mpi: |
382 |
case alpha+mpi: |
echo "Configuring for DEC Alpha with MPI" |
383 |
|
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
384 |
|
case OSF1: |
385 |
echo "Configuring for DEC Alpha" |
echo "Configuring for DEC Alpha" |
386 |
set CPP = ( '/usr/bin/cpp -P' ) |
set CPP = ( '/usr/bin/cpp -P' ) |
387 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
388 |
set KPP = ( 'kapf' ) |
set KPP = ( ) |
389 |
set KPPFILES = ( 'main.F' ) |
set KPPFILES = ( ) |
390 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
set KFLAGS1 = ( ) |
391 |
set FC = ( 'f77' ) |
set FC = ( 'f77' ) |
392 |
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' ) |
393 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
394 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
395 |
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') |
|
396 |
set RMFILES = ( '*.p.out' ) |
set RMFILES = ( '*.p.out' ) |
397 |
breaksw |
breaksw |
398 |
case mips+mpi: |
case IRIX64+mpi: |
399 |
echo "Configuring for SGI Mips with MPI" |
echo "Configuring for SGI Mips with MPI" |
400 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
401 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
402 |
set FC = ( 'mpif77' ) |
set FC = ( 'mpif77' ) |
403 |
set LINK = ( 'mpif77' ) |
set LINK = ( 'mpif77' ) |
404 |
set FFLAGS = ( '-extend_source -bytereclen -r10000' ) |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
405 |
set FOPTIM = ( '-O3' ) |
set FOPTIM = ( '-O3' ) |
406 |
set RMFILES = ( 'rii_files' ) |
set RMFILES = ( 'rii_files' ) |
407 |
breaksw |
breaksw |
408 |
case mips: |
case IRIX64: |
409 |
echo "Configuring for SGI Mips" |
echo "Configuring for SGI Mips" |
410 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
411 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
412 |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' ) |
413 |
|
set FOPTIM = ( '-O3' ) |
414 |
|
# set NOOPTFLAGS = ( '-O0' ) |
415 |
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
416 |
|
# 'external_fields_load.F' ) |
417 |
|
set RMFILES = ( 'rii_files' ) |
418 |
|
breaksw |
419 |
|
case o2: |
420 |
|
case IRIX: |
421 |
|
echo "Configuring for SGI O2 running IRIX 6.5" |
422 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
423 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
424 |
set FOPTIM = ( '-O2' ) |
set FOPTIM = ( '-O2' ) |
425 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
|
|
'load_external_fields.F' ) |
|
|
set RMFILES = ( 'rii_files' ) |
|
426 |
breaksw |
breaksw |
427 |
case sparc: |
case o2+mpi: |
428 |
set LN = ( '/usr/bin/ln -fs' ) |
case IRIX+mpi: |
429 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
echo "Configuring for SGI O2 running IRIX 6.5 with MPI" |
430 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
431 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
432 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
set FOPTIM = ( '-O2' ) |
433 |
set FOPTIM = ( '-O5' ) |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
434 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
435 |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
set LIBS = ( '-lmpi' ) |
436 |
'-lsocket -lnsl -fast' ) |
breaksw |
437 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F') |
case o2k+mpi: |
438 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
439 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
440 |
|
set INCLUDES = ( '-I/usr/include' ) |
441 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
442 |
|
set FOPTIM = ( '-O2' ) |
443 |
|
set NOOPTFILES = ( 'calc_mom_rhs.F' ) |
444 |
|
set NOOPTFLAGS = ( '-O1' ) |
445 |
|
set LIBS = ( '-lmpi -lscs' ) |
446 |
breaksw |
breaksw |
447 |
case onyx: |
case onyx: |
448 |
case onyx+mpi: |
case onyx+mpi: |
449 |
echo "Configuring for SGI ONYX running IRIX64" |
echo "Configuring for SGI ONYX running IRIX64" |
450 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
451 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
452 |
|
set FOPTIM = ( '-O2' ) |
453 |
|
set NOOPTFLAGS = ( '-O0' ) |
454 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
455 |
|
set LIBS = ( '-lmpi' ) |
456 |
|
breaksw |
457 |
|
case SunOS: |
458 |
|
set LN = ( '/usr/bin/ln -s' ) |
459 |
|
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
460 |
|
set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend ) |
461 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
462 |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
463 |
|
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
464 |
|
set CFLAGS = ( '-dalign -O3 -xarch=v9' ) |
465 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
466 |
|
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 ') |
467 |
|
breaksw |
468 |
|
case SunOS+mpi: |
469 |
|
set LN = ( '/usr/bin/ln -s' ) |
470 |
|
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
471 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
472 |
|
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
473 |
|
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
474 |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
475 |
|
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
476 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
477 |
|
'-lsocket -lnsl' ) |
478 |
|
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') |
479 |
|
breaksw |
480 |
|
case IRIX32: |
481 |
|
echo "Configuring for SGI ONYX running IRIX64" |
482 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
483 |
set INCLUDES = ( '-I/usr/include' ) |
set INCLUDES = ( '-I/usr/include' ) |
484 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
485 |
set FOPTIM = ( '-O2' ) |
set FOPTIM = ( '-O2' ) |
486 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
487 |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
488 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
489 |
set LIBS = ( '-lmpi' ) |
set LIBS = ( '-lmpi' ) |
490 |
breaksw |
breaksw |
491 |
case exemplar: |
case HP-UX+mpi: |
|
case exemplar+mpi: |
|
|
echo "Configuring for HP Exemplar" |
|
|
set CPP = ( '/usr/ccs/lbin/cpp -P' ) |
|
|
set DEFINES = ( ${DEFINES} '-DTARGET_HP' ) |
|
|
set INCLUDES = ( '-I/opt/mpi/include' ) |
|
492 |
set FC = ( 'mpif77' ) |
set FC = ( 'mpif77' ) |
493 |
set LINK = ( 'mpif77' ) |
set LINK = ( 'mpif77' ) |
494 |
|
set INCLUDES = ( '-I/opt/mpi/include' ) |
495 |
|
case HP-UX: |
496 |
|
echo "Configuring for HP Exemplar" |
497 |
|
set CPP = ( '/usr/ccs/lbin/cpp -P' ) |
498 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' ) |
499 |
set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \ |
set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \ |
500 |
'+Okernel_threads' ) |
'+Okernel_threads' ) |
501 |
set FOPTIM = ( '+O2' ) |
set FOPTIM = ( '+O2' ) |
502 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '+O0' ) |
503 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
504 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
505 |
|
breaksw |
506 |
|
case Linux-alpha+mpi: |
507 |
|
echo "Configuring with MPI" |
508 |
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
509 |
|
set INCLUDES = ( '-I/usr/local/include' ) |
510 |
|
case Linux-alpha: |
511 |
|
echo "Configuring for " $platform |
512 |
|
set LN = ( '/bin/ln -s' ) |
513 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
514 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
515 |
|
set FC = ( 'g77' ) |
516 |
|
set FFLAGS = ( ' ' ) |
517 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
518 |
|
set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' ) |
519 |
|
set LINK = ( 'g77' ) |
520 |
|
breaksw |
521 |
|
case Linux*+pgi+mpi: |
522 |
|
if ($?include_jam_libs) then |
523 |
|
set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' ) |
524 |
|
set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' ) |
525 |
|
else |
526 |
|
set INCLUDES = ( '-I/usr/local/include' ) |
527 |
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
528 |
|
endif |
529 |
|
case Linux*+pgi: |
530 |
|
echo "Configuring for " $platform |
531 |
|
set LN = ( '/bin/ln -s' ) |
532 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
533 |
|
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
534 |
|
set FC = ( 'pgf77' ) |
535 |
|
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
536 |
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
537 |
|
set LINK = ( 'pgf77' ) |
538 |
|
breaksw |
539 |
|
case Linux*+mpi: |
540 |
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
541 |
|
set INCLUDES = ( '-I/usr/local/include' ) |
542 |
|
case Linux*: |
543 |
|
echo "Configuring for " $platform |
544 |
|
set LN = ( '/bin/ln -s' ) |
545 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
546 |
|
switch ($FC) |
547 |
|
case g77: |
548 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
549 |
|
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
550 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
551 |
|
set FOPTIM = ( '-O3 -malign-double -funroll-loops' ) |
552 |
|
breaksw |
553 |
|
case pgf77: |
554 |
|
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
555 |
|
set FC = ( 'pgf77' ) |
556 |
|
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
557 |
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
558 |
|
breaksw |
559 |
|
case ifc: |
560 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
561 |
|
set FFLAGS = ( '-132 -r8 -i4 -w95 -W0 -WB' ) |
562 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-mp' ) |
563 |
|
set FOPTIM = ( '-O3 -align' ) |
564 |
|
#P3 set FOPTIM = ( $FOPTIM '-tpp6 -xWKM' ) |
565 |
|
#P4 set FOPTIM = ( $FOPTIM '-tpp7 -xWKM' ) |
566 |
|
set LIBS = ( '-lPEPCF90' ) |
567 |
|
breaksw |
568 |
|
default: |
569 |
|
echo Error: Linux compiler not recognized: \$FC=$FC |
570 |
|
exit |
571 |
|
breaksw |
572 |
|
endsw |
573 |
|
breaksw |
574 |
|
case T3E: |
575 |
|
case sn6312: |
576 |
|
echo "Configuring for T3E" |
577 |
|
set CPP = ( '/opt/ctl/bin/cpp -P') |
578 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
579 |
|
set FC = ( 'f90' ) |
580 |
|
set LINK = ( 'f90' ) |
581 |
|
set FFLAGS = ( '-O 2,fusion' ) |
582 |
|
breaksw |
583 |
|
case T90: |
584 |
|
case sn7113: |
585 |
|
echo "Configuring for T90" |
586 |
|
set FC = ( 'f90' ) |
587 |
|
set LINK = ( 'f90' ) |
588 |
|
set LN = ( '/bin/ln -s' ) |
589 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
590 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
591 |
|
set FFLAGS = ( '-m3 -Rabc -N 132') |
592 |
|
set FOPTIM = ( '-O0' ) |
593 |
|
set NOOPTFLAGS = ( '-O0' ) |
594 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
595 |
|
breaksw |
596 |
|
case SV1: |
597 |
|
case sn3002: |
598 |
|
set FC = ( 'f90' ) |
599 |
|
set LINK = ( 'f90' ) |
600 |
|
set LN = ( '/bin/ln -s' ) |
601 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
602 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
603 |
|
set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132') |
604 |
|
set FOPTIM = ( '-O0' ) |
605 |
|
set NOOPTFLAGS = ( '-O0' ) |
606 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
607 |
|
breaksw |
608 |
|
case SP3: |
609 |
|
# originally from A. Biastoch, SIO. |
610 |
|
echo "Configuring for IBM SP POWER3" |
611 |
|
set SOURCEDIRS = ( ./ $SOURCEDIRS ) |
612 |
|
set LN = ( 'ln -s' ) |
613 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' ) |
614 |
|
set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' ) |
615 |
|
# set CPP = ( '/lib/cpp' ) |
616 |
|
set FC = ( 'mpxlf95' ) |
617 |
|
set LINK = ( 'mpxlf95' ) |
618 |
|
set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
619 |
|
'-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' ) |
620 |
|
set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
621 |
|
'-bmaxdata:0x80000000 ' ) |
622 |
|
set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
623 |
|
'-bmaxdata:0x80000000' ) |
624 |
|
set LIBS = ( ' -L/usr/local/apps/mass -lmass' ) |
625 |
|
# set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
626 |
|
# set FOPTIM = ( '-O3' ) |
627 |
|
# set NOOPTFLAGS = ( '-O0' ) |
628 |
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
629 |
|
# 'external_fields_load.F' ) |
630 |
|
set RMFILES = ( 'rii_files' ) |
631 |
breaksw |
breaksw |
632 |
default: |
default: |
633 |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
642 |
## ## |
## ## |
643 |
############################################################################### |
############################################################################### |
644 |
|
|
|
# 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 |
|
|
|
|
645 |
# Convert lists of directories into command-line options |
# Convert lists of directories into command-line options |
646 |
foreach inc ($INCLUDEDIRS) |
foreach inc ($INCLUDEDIRS) |
647 |
set INCLUDES = ($INCLUDES -I$inc) |
set INCLUDES = ($INCLUDES -I$inc) |
648 |
end |
end |
649 |
set SRCSTARS = ( ) |
|
650 |
foreach dr ($SOURCEDIRS) |
# Search for source code |
651 |
set SRCSTARS = ("${SRCSTARS}" $dr\*.F $dr\*.c ) |
rm -rf .links.tmp;mkdir .links.tmp |
652 |
|
echo "# This section creates symbolic links" > srclinks.tmp |
653 |
|
echo "" >> srclinks.tmp |
654 |
|
echo -n 'SRCFILES = ' > srclist.inc |
655 |
|
echo -n 'CSRCFILES = ' > csrclist.inc |
656 |
|
echo -n 'HEADERFILES = ' > hlist.inc |
657 |
|
foreach dr ($SOURCEDIRS $INCLUDEDIRS .) |
658 |
|
set deplist=( ) |
659 |
|
foreach srcfile (`cd $dr; ls *.[hcF]`) |
660 |
|
if (! -r .links.tmp/$srcfile) then |
661 |
|
if (-f $dr/$srcfile) then |
662 |
|
switch ($srcfile:e) |
663 |
|
case F: |
664 |
|
touch .links.tmp/$srcfile |
665 |
|
set deplist=($deplist $srcfile) |
666 |
|
echo ' \' >> srclist.inc |
667 |
|
echo -n " " $srcfile >> srclist.inc |
668 |
|
breaksw |
669 |
|
case c: |
670 |
|
touch .links.tmp/$srcfile |
671 |
|
set deplist=($deplist $srcfile) |
672 |
|
echo ' \' >> csrclist.inc |
673 |
|
echo -n " " $srcfile >> csrclist.inc |
674 |
|
breaksw |
675 |
|
case h: |
676 |
|
touch .links.tmp/$srcfile |
677 |
|
set deplist=($deplist $srcfile) |
678 |
|
echo ' \' >> hlist.inc |
679 |
|
echo -n " " $srcfile >> hlist.inc |
680 |
|
breaksw |
681 |
|
endsw |
682 |
|
endif |
683 |
|
endif |
684 |
|
end |
685 |
|
if ($#deplist != 0) then |
686 |
|
echo "# These files are linked from $dr" >> srclinks.tmp |
687 |
|
echo $deplist':' >> srclinks.tmp |
688 |
|
echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp |
689 |
|
endif |
690 |
end |
end |
691 |
|
rm -rf .links.tmp |
692 |
|
echo "" >> srclist.inc |
693 |
|
echo "" >> csrclist.inc |
694 |
|
echo "" >> hlist.inc |
695 |
|
|
696 |
set THISHOSTNAME = ( `hostname` ) |
set THISHOSTNAME = ( `hostname` ) |
697 |
set THISCWD = ( `pwd` ) |
set THISCWD = ( `pwd` ) |
698 |
set THISDATE = ( `date` ) |
set THISDATE = ( `date` ) |
699 |
|
|
700 |
|
if (-r $mfile) mv -f $mfile $mfile.bak |
701 |
########################################### |
########################################### |
702 |
## This is the template for the makefile ## |
## This is the template for the makefile ## |
703 |
########################################### |
########################################### |
704 |
echo Creating makefile: $mfile |
echo Creating makefile: $mfile |
705 |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
706 |
echo "# This makefile was generated automatically pn" >> ${mfile} |
echo "# This makefile was generated automatically on" >> ${mfile} |
707 |
echo "# $THISDATE" >> ${mfile} |
echo "# $THISDATE" >> ${mfile} |
708 |
echo "# by the command:" >> ${mfile} |
echo "# by the command:" >> ${mfile} |
709 |
echo "# ${0} $argv" >> ${mfile} |
echo "# ${0} $argv" >> ${mfile} |
720 |
# CPP : C-preprocessor command |
# CPP : C-preprocessor command |
721 |
# INCLUDES : Directories searched for header files |
# INCLUDES : Directories searched for header files |
722 |
# DEFINES : Macro definitions for CPP |
# DEFINES : Macro definitions for CPP |
723 |
|
# MAKEDEPEND : Dependency generator |
724 |
# KPP : Special preprocessor command (specific to platform) |
# KPP : Special preprocessor command (specific to platform) |
725 |
# KFLAGS : Flags for KPP |
# KFLAGS : Flags for KPP |
726 |
# FC : Fortran compiler command |
# FC : Fortran compiler command |
729 |
# LINK : Command for link editor program |
# LINK : Command for link editor program |
730 |
# LIBS : Library flags /or/ additional optimization/debugging flags |
# LIBS : Library flags /or/ additional optimization/debugging flags |
731 |
|
|
732 |
BUILDDIR = ${BUILDDIR} |
ROOTDIR = ${ROOTDIR} |
733 |
SOURCEDIRS = ${SOURCEDIRS} |
BUILDDIR = ${BUILDDIR} |
734 |
|
SOURCEDIRS = ${SOURCEDIRS} |
735 |
INCLUDEDIRS = ${INCLUDEDIRS} |
INCLUDEDIRS = ${INCLUDEDIRS} |
736 |
EXEDIR = ${EXEDIR} |
EXEDIR = ${EXEDIR} |
737 |
EXECUTABLE = \$(EXEDIR)${EXECUTABLE} |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
738 |
|
TOOLSDIR = ${TOOLSDIR} |
739 |
|
|
740 |
|
EOF |
741 |
|
|
742 |
|
|
743 |
|
# JAM libraries on Hyades |
744 |
|
if ($?include_jam_libs) then |
745 |
|
cat >> ${mfile} <<EOF |
746 |
|
# extra stuff for Hyades ............................................ |
747 |
|
HYADES_DIR = /u/u0/cnh/jam-lib/software |
748 |
|
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
749 |
|
HYADES_DIR = /usr/local/jamlib/current/dual_proc |
750 |
|
WORK_DIR = \$(HYADES_DIR) |
751 |
|
DEPOSIT_DIR = linux_bin |
752 |
|
|
753 |
|
STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR) |
754 |
|
STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \ |
755 |
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \ |
756 |
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \ |
757 |
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o |
758 |
|
|
759 |
|
JAMOBJDIR = jam/\$(DEPOSIT_DIR) |
760 |
|
JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \ |
761 |
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \ |
762 |
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \ |
763 |
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \ |
764 |
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o |
765 |
|
|
766 |
|
JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR) |
767 |
|
JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o |
768 |
|
|
769 |
|
XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ) |
770 |
|
|
771 |
|
# .................................................................. |
772 |
|
|
773 |
|
EOF |
774 |
|
endif |
775 |
|
|
776 |
|
|
777 |
|
cat >> ${mfile} <<EOF |
778 |
# Unix ln (link) |
# Unix ln (link) |
779 |
LN = ${LN} |
LN = ${LN} |
780 |
# C preprocessor |
# C preprocessor |
781 |
CPP = ${CPP} |
CPP = cat \$< | ${S64} | ${CPP} |
782 |
|
# Dependency generator |
783 |
|
MAKEDEPEND = ${MAKEDEPEND} |
784 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
785 |
KPP = ${KPP} |
KPP = ${KPP} |
786 |
# Fortran compiler |
# Fortran compiler |
798 |
# Optim./debug for FC |
# Optim./debug for FC |
799 |
FFLAGS = ${FFLAGS} |
FFLAGS = ${FFLAGS} |
800 |
FOPTIM = ${FOPTIM} |
FOPTIM = ${FOPTIM} |
801 |
|
# Flags for CC |
802 |
|
CFLAGS = ${CFLAGS} |
803 |
# Files that should not be optimized |
# Files that should not be optimized |
804 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
805 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
806 |
# Flags and libraries needed for linking |
# Flags and libraries needed for linking |
807 |
LIBS = ${LIBS} |
LIBS = ${LIBS} \$(XLIBS) |
808 |
|
|
809 |
EOF |
EOF |
810 |
|
|
811 |
cat srclist.inc >> ${mfile} |
cat srclist.inc >> ${mfile} |
812 |
cat f77list.inc >> ${mfile} |
cat csrclist.inc >> ${mfile} |
813 |
cat objlist.inc >> ${mfile} |
cat hlist.inc >> ${mfile} |
814 |
rm -f srclist.inc f77list.inc objlist.inc |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
815 |
|
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
816 |
|
|
817 |
|
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp |
818 |
|
|
819 |
cat >> ${mfile} <<EOF |
cat >> ${mfile} <<EOF |
820 |
|
|
824 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
825 |
\$(EXECUTABLE): \$(OBJFILES) |
\$(EXECUTABLE): \$(OBJFILES) |
826 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
|
links: |
|
|
@-\$(LN) $SRCSTARS . |
|
827 |
depend: |
depend: |
828 |
@make links |
@make links |
829 |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
830 |
|
|
831 |
|
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) |
832 |
|
|
833 |
|
small_f: \$(F77FILES) |
834 |
|
|
835 |
|
output.txt: \$(EXECUTABLE) |
836 |
|
@printf 'running ... ' |
837 |
|
@\$(EXECUTABLE) > \$@ |
838 |
|
|
839 |
clean: |
clean: |
840 |
-rm -rf *.o *.f *.p ${RMFILES} |
-rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl} |
841 |
|
Clean: |
842 |
|
@make clean |
843 |
|
@make cleanlinks |
844 |
|
-rm -f Makefile.bak |
845 |
|
CLEAN: |
846 |
|
@make Clean |
847 |
|
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
848 |
|
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
849 |
|
-rm -f \$(EXECUTABLE) |
850 |
|
|
851 |
|
makefile: |
852 |
|
${0} $argv |
853 |
|
cleanlinks: |
854 |
|
-find . -type l -exec rm {} \; |
855 |
|
|
856 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .f - .o ) |
857 |
.F.f: |
.F.f: |
858 |
\$(CPP) \$(DEFINES) \$(INCLUDES) \$< > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
859 |
.f.o: |
.f.o: |
860 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
861 |
|
.c.o: |
862 |
|
\$(CC) \$(CFLAGS) -c \$< |
863 |
|
|
864 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
865 |
.F.p: |
.F.p: |
866 |
\$(CPP) \$(DEFINES) \$(INCLUDES) \$< > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
867 |
.p.f: |
.p.f: |
868 |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
869 |
EOF |
EOF |
878 |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
879 |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
880 |
end |
end |
881 |
echo >> ${mfile} |
echo "" >> ${mfile} |
882 |
|
|
883 |
|
# Add rules for links |
884 |
|
cat srclinks.tmp >> ${mfile} |
885 |
|
rm -f srclinks.tmp |
886 |
|
|
887 |
|
echo "" >> ${mfile} |
888 |
echo "# DO NOT DELETE" >> ${mfile} |
echo "# DO NOT DELETE" >> ${mfile} |
889 |
|
|
890 |
exit |
exit |