1 |
#!/bin/csh -f |
2 |
# |
3 |
# $Header: /u/gcmpack/models/MITgcmUV/tools/genmake,v 1.22 2000/11/30 19:58:13 adcroft Exp $ |
4 |
# |
5 |
# Makefile generator for MITgcm UV codes |
6 |
# created by cnh 03/98 |
7 |
# adapted by aja 06/98 |
8 |
|
9 |
# Process command-line arguments |
10 |
set allargs=( $argv ) |
11 |
while ($#allargs) |
12 |
set arg = $allargs[1] |
13 |
switch ($arg) |
14 |
case -makefile: |
15 |
set mfile = ( Makefile ) |
16 |
breaksw |
17 |
case -makefile=*: |
18 |
set mfile = ( `echo $arg | sed 's/-makefile=//' `) |
19 |
breaksw |
20 |
case -platform: |
21 |
case -platform=: |
22 |
echo "To change platform you must specify one with -platform=" |
23 |
echo "eg. -platform=sparc or -platform=mips" |
24 |
exit |
25 |
breaksw |
26 |
case -platform*: |
27 |
set platform = ( `echo $arg | sed 's/-platform=//' `) |
28 |
breaksw |
29 |
case -rootdir=*: |
30 |
set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `) |
31 |
breaksw |
32 |
case -mymods=*: |
33 |
set MYMODS = ( `echo $arg | sed 's/-mymods=//' `) |
34 |
breaksw |
35 |
case -mpi: |
36 |
echo "Enabling MPI options" |
37 |
set USEMPI |
38 |
breaksw |
39 |
case -jam: |
40 |
set include_jam_libs |
41 |
echo "Including paths to JAM libraries" |
42 |
breaksw |
43 |
case -help: |
44 |
echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]" |
45 |
exit |
46 |
breaksw |
47 |
default: |
48 |
echo "Unknown command-line option: " $arg |
49 |
echo $0 "-help to show usage" |
50 |
exit |
51 |
breaksw |
52 |
endsw |
53 |
shift allargs |
54 |
end |
55 |
|
56 |
# Default actions/options |
57 |
|
58 |
# If platform wasn't specified then determine platform type of the host |
59 |
if ($?platform == 0) then |
60 |
set platform = (`uname`) |
61 |
endif |
62 |
# If name of makefile wasn't specified then use default "Makefile" |
63 |
if ($?mfile == 0) set mfile = ( Makefile ) |
64 |
|
65 |
set mach = ( `uname -a` ) |
66 |
echo Operating system: $mach |
67 |
|
68 |
|
69 |
# Directories for source, includes, binaries and executables |
70 |
# Note |
71 |
# o If you prefer/need everything under a single directory |
72 |
# copy everything in ../eesupp/src, ../model/src, |
73 |
# ../eesupp/inc and ../model/inc into a directory and then |
74 |
# edit the paths below to ./ |
75 |
# |
76 |
# If -rootdir wasn't specified then assume script is being run from bin |
77 |
# but if it was supplied then we should place the executable in the build dir |
78 |
if ($?ROOTDIR == 0) then |
79 |
set ROOTDIR = ( .. ) |
80 |
else |
81 |
if ($?EXEDIR == 0) set EXEDIR = ( ./ ) |
82 |
endif |
83 |
if ($?MYMODS == 0) then |
84 |
set SOURCEDIRS = ( $ROOTDIR/{eesupp,model,diags}/src/ $ROOTDIR/pkg/[a-z]*/ ) |
85 |
set INCLUDEDIRS = ( ./ $ROOTDIR/{eesupp,model,diags}/inc/ $ROOTDIR/pkg/[a-z]*/ ) |
86 |
else |
87 |
set SOURCEDIRS = ( $ROOTDIR/{eesupp,model,diags}/src/ $ROOTDIR/pkg/[a-z]*/ $MYMODS/ ) |
88 |
set INCLUDEDIRS = ( ./ $MYMODS/ $ROOTDIR/{eesupp,model,diags}/inc/ $ROOTDIR/pkg/[a-z]*/ ) |
89 |
endif |
90 |
if ($?BUILDDIR == 0) set BUILDDIR = ( ./ ) |
91 |
if ($?EXEDIR == 0) set EXEDIR = ( $ROOTDIR/exe/ ) |
92 |
if ($?EXECUTABLE == 0) set EXECUTABLE = ( mitgcmuv ) |
93 |
if ($?TOOLSDIR == 0) set TOOLSDIR = ( $ROOTDIR/tools/ ) |
94 |
|
95 |
# This is the generic configuration. |
96 |
# Platform specific options are chosen below |
97 |
set LN = ( 'ln -s' ) |
98 |
set CPP = ( '/lib/cpp -P' ) |
99 |
set KPP = ( ) |
100 |
set FC = ( 'f77' ) |
101 |
set LINK = ( 'f77' ) |
102 |
set DEFINES = ( ) |
103 |
set INCLUDES = ( ) |
104 |
set FFLAGS = ( ) |
105 |
set FOPTIM = ( ) |
106 |
set KFLAGS1 = ( ) |
107 |
set KFLAGS2 = ( ) |
108 |
set LIBS = ( ) |
109 |
set KPPFILES = ( ) |
110 |
set NOOPTFILES = ( ) |
111 |
set NOOPTFLAGS = ( ) |
112 |
set RMFILES = ( ) |
113 |
|
114 |
# We often want to use different compile/link options is using MPI |
115 |
if ($?USEMPI) then |
116 |
set USEMPI = ( '+mpi' ) |
117 |
set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' ) |
118 |
else |
119 |
set USEMPI |
120 |
# set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' ) |
121 |
endif |
122 |
|
123 |
# Platform specific options |
124 |
switch ($platform$USEMPI) |
125 |
case OSF1: |
126 |
case OSF1+mpi: |
127 |
echo "Configuring for DEC Alpha" |
128 |
set CPP = ( '/usr/bin/cpp -P' ) |
129 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
130 |
set KPP = ( 'kapf' ) |
131 |
set KPPFILES = ( 'main.F' ) |
132 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
133 |
set FC = ( 'f77' ) |
134 |
set FFLAGS = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' ) |
135 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
136 |
set NOOPTFLAGS = ( '-O0' ) |
137 |
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
138 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
139 |
set RMFILES = ( '*.p.out' ) |
140 |
breaksw |
141 |
case IRIX64+mpi: |
142 |
echo "Configuring for SGI Mips with MPI" |
143 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
144 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
145 |
set FC = ( 'mpif77' ) |
146 |
set LINK = ( 'mpif77' ) |
147 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
148 |
set FOPTIM = ( '-O3' ) |
149 |
set RMFILES = ( 'rii_files' ) |
150 |
breaksw |
151 |
case IRIX64: |
152 |
echo "Configuring for SGI Mips" |
153 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
154 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
155 |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
156 |
set FOPTIM = ( '-O3' ) |
157 |
# set NOOPTFLAGS = ( '-O0' ) |
158 |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
159 |
# 'external_fields_load.F' ) |
160 |
set RMFILES = ( 'rii_files' ) |
161 |
breaksw |
162 |
case o2: |
163 |
case IRIX: |
164 |
echo "Configuring for SGI O2 running IRIX 6.5" |
165 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
166 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
167 |
set FOPTIM = ( '-O2' ) |
168 |
set NOOPTFLAGS = ( '-O0' ) |
169 |
breaksw |
170 |
case o2+mpi: |
171 |
case IRIX+mpi: |
172 |
echo "Configuring for SGI O2 running IRIX 6.5 with MPI" |
173 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
174 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
175 |
set FOPTIM = ( '-O2' ) |
176 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
177 |
set NOOPTFLAGS = ( '-O0' ) |
178 |
set LIBS = ( '-lmpi' ) |
179 |
breaksw |
180 |
case o2k+mpi: |
181 |
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
182 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
183 |
set INCLUDES = ( '-I/usr/include' ) |
184 |
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
185 |
set FOPTIM = ( '-O2' ) |
186 |
set NOOPTFILES = ( 'calc_mom_rhs.F' ) |
187 |
set NOOPTFLAGS = ( '-O1' ) |
188 |
set LIBS = ( '-lmpi -lscs' ) |
189 |
breaksw |
190 |
case onyx: |
191 |
case onyx+mpi: |
192 |
echo "Configuring for SGI ONYX running IRIX64" |
193 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
194 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
195 |
set FOPTIM = ( '-O2' ) |
196 |
set NOOPTFLAGS = ( '-O0' ) |
197 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
198 |
set LIBS = ( '-lmpi' ) |
199 |
breaksw |
200 |
case SunOS: |
201 |
set LN = ( '/usr/bin/ln -s' ) |
202 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
203 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
204 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
205 |
set FOPTIM = ( '-fast -O3' ) |
206 |
set NOOPTFLAGS = ( '-O0' ) |
207 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') |
208 |
breaksw |
209 |
case SunOS+mpi: |
210 |
set LN = ( '/usr/bin/ln -s' ) |
211 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
212 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
213 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
214 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
215 |
set FOPTIM = ( '-fast -O3' ) |
216 |
set NOOPTFLAGS = ( '-O0' ) |
217 |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
218 |
'-lsocket -lnsl' ) |
219 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') |
220 |
breaksw |
221 |
case IRIX32: |
222 |
echo "Configuring for SGI ONYX running IRIX64" |
223 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
224 |
set INCLUDES = ( '-I/usr/include' ) |
225 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
226 |
set FOPTIM = ( '-O2' ) |
227 |
set NOOPTFLAGS = ( '-O0' ) |
228 |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
229 |
'external_fields_load.F' ) |
230 |
set LIBS = ( '-lmpi' ) |
231 |
breaksw |
232 |
case HP-UX+mpi: |
233 |
set FC = ( 'mpif77' ) |
234 |
set LINK = ( 'mpif77' ) |
235 |
set INCLUDES = ( '-I/opt/mpi/include' ) |
236 |
case HP-UX: |
237 |
echo "Configuring for HP Exemplar" |
238 |
set CPP = ( '/usr/ccs/lbin/cpp -P' ) |
239 |
set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' ) |
240 |
set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \ |
241 |
'+Okernel_threads' ) |
242 |
set FOPTIM = ( '+O2' ) |
243 |
set NOOPTFLAGS = ( '+O0' ) |
244 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
245 |
'external_fields_load.F' ) |
246 |
breaksw |
247 |
case Linux+mpi: |
248 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
249 |
set INCLUDES = ( '-I/usr/local/include' ) |
250 |
case Linux: |
251 |
set LN = ( '/bin/ln -s' ) |
252 |
set CPP = ( '/lib/cpp -traditional -P' ) |
253 |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
254 |
set FC = ( 'g77' ) |
255 |
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
256 |
set FOPTIM = ( '-O3 -malign-double -funroll-loops ' ) |
257 |
set LINK = ( 'g77' ) |
258 |
breaksw |
259 |
case Linux+pgi+mpi: |
260 |
if ($?include_jam_libs) then |
261 |
set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' ) |
262 |
set LIBS = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
263 |
else |
264 |
set INCLUDES = ( '-I/usr/local/include' ) |
265 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
266 |
endif |
267 |
case Linux+pgi: |
268 |
set LN = ( '/bin/ln -s' ) |
269 |
set CPP = ( '/lib/cpp -traditional -P' ) |
270 |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
271 |
set FC = ( 'pgf77' ) |
272 |
set FFLAGS = ( '-byteswapio' ) |
273 |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
274 |
set LINK = ( 'pgf77' ) |
275 |
breaksw |
276 |
case T3E: |
277 |
case sn6312: |
278 |
set CPP = ( '/opt/ctl/bin/cpp -P') |
279 |
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
280 |
set FC = ( 'f90' ) |
281 |
set LINK = ( 'f90' ) |
282 |
set FFLAGS = ( '-O 2,fusion' ) |
283 |
breaksw |
284 |
case T90: |
285 |
case sn7113: |
286 |
set FC = ( 'f90' ) |
287 |
set LINK = ( 'f90' ) |
288 |
set LN = ( '/bin/ln -s' ) |
289 |
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
290 |
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
291 |
set FFLAGS = ( '-m3 -Rabc -N 132') |
292 |
set FOPTIM = ( '-O0' ) |
293 |
set NOOPTFLAGS = ( '-O0' ) |
294 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
295 |
breaksw |
296 |
case SV1: |
297 |
case sn3002: |
298 |
set FC = ( 'f90' ) |
299 |
set LINK = ( 'f90' ) |
300 |
set LN = ( '/bin/ln -s' ) |
301 |
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
302 |
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
303 |
set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132') |
304 |
set FOPTIM = ( '-O0' ) |
305 |
set NOOPTFLAGS = ( '-O0' ) |
306 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
307 |
breaksw |
308 |
default: |
309 |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
310 |
exit |
311 |
breaksw |
312 |
endsw |
313 |
|
314 |
############################################################################### |
315 |
## ## |
316 |
## Everything below here should not need to be changed. Platform specific ## |
317 |
## changes and code specific changes should be configured above this line. ## |
318 |
## ## |
319 |
############################################################################### |
320 |
|
321 |
# Create list of files |
322 |
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[F]$'` |
323 |
if ( $#flist ) then |
324 |
echo -n 'SRCFILES = ' > srclist.inc |
325 |
foreach ff ( ${flist} ) |
326 |
set fname = ( ${ff:t} ) |
327 |
echo ' \' >> srclist.inc |
328 |
echo -n " " ${fname:r}.F >> srclist.inc |
329 |
end |
330 |
else |
331 |
echo No source files found...\! |
332 |
exit |
333 |
endif |
334 |
echo " " >> srclist.inc |
335 |
|
336 |
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[c]$'` |
337 |
if ( $#flist ) then |
338 |
echo -n 'CSRCFILES = ' > csrclist.inc |
339 |
foreach ff ( ${flist} ) |
340 |
set fname = ( ${ff:t} ) |
341 |
echo ' \' >> csrclist.inc |
342 |
echo -n " " ${fname} >> csrclist.inc |
343 |
else |
344 |
echo -n 'CSRCFILES =' > csrclist.inc |
345 |
endif |
346 |
echo " " >> csrclist.inc |
347 |
|
348 |
# Convert lists of directories into command-line options |
349 |
foreach inc ($INCLUDEDIRS) |
350 |
set INCLUDES = ($INCLUDES -I$inc) |
351 |
end |
352 |
set SRCSTARS = ( ) |
353 |
foreach dr ($SOURCEDIRS) |
354 |
set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] ) |
355 |
end |
356 |
|
357 |
set THISHOSTNAME = ( `hostname` ) |
358 |
set THISCWD = ( `pwd` ) |
359 |
set THISDATE = ( `date` ) |
360 |
|
361 |
########################################### |
362 |
## This is the template for the makefile ## |
363 |
########################################### |
364 |
echo Creating makefile: $mfile |
365 |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
366 |
echo "# This makefile was generated automatically pn" >> ${mfile} |
367 |
echo "# $THISDATE" >> ${mfile} |
368 |
echo "# by the command:" >> ${mfile} |
369 |
echo "# ${0} $argv" >> ${mfile} |
370 |
echo "# executed by:" >> ${mfile} |
371 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile} |
372 |
cat >> ${mfile} <<EOF |
373 |
# |
374 |
# BUILDDIR : Directory where object files are written |
375 |
# SOURCEDIRS : Directories containing the source (.F) files |
376 |
# INCLUDEDIRS : Directories containing the header-source (.h) files |
377 |
# EXEDIR : Directory where executable that is generated is written |
378 |
# EXECUTABLE : Full path of executable binary |
379 |
# |
380 |
# CPP : C-preprocessor command |
381 |
# INCLUDES : Directories searched for header files |
382 |
# DEFINES : Macro definitions for CPP |
383 |
# KPP : Special preprocessor command (specific to platform) |
384 |
# KFLAGS : Flags for KPP |
385 |
# FC : Fortran compiler command |
386 |
# FFLAGS : Configuration/debugging options for FC |
387 |
# FOPTIM : Optimization options for FC |
388 |
# LINK : Command for link editor program |
389 |
# LIBS : Library flags /or/ additional optimization/debugging flags |
390 |
|
391 |
ROOTDIR = ${ROOTDIR} |
392 |
BUILDDIR = ${BUILDDIR} |
393 |
SOURCEDIRS = ${SOURCEDIRS} |
394 |
INCLUDEDIRS = ${INCLUDEDIRS} |
395 |
EXEDIR = ${EXEDIR} |
396 |
EXECUTABLE = \$(EXEDIR)${EXECUTABLE} |
397 |
TOOLSDIR = ${TOOLSDIR} |
398 |
|
399 |
EOF |
400 |
|
401 |
|
402 |
# JAM libraries on Hyades |
403 |
if ($?include_jam_libs) then |
404 |
cat >> ${mfile} <<EOF |
405 |
# extra stuff for Hyades ............................................ |
406 |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
407 |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
408 |
WORK_DIR = \$(HYADES_DIR) |
409 |
DEPOSIT_DIR = linux_bin |
410 |
|
411 |
STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR) |
412 |
STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \ |
413 |
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \ |
414 |
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \ |
415 |
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o |
416 |
|
417 |
JAMOBJDIR = jam/\$(DEPOSIT_DIR) |
418 |
JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \ |
419 |
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \ |
420 |
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \ |
421 |
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \ |
422 |
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o |
423 |
|
424 |
JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR) |
425 |
JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o |
426 |
|
427 |
XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ) |
428 |
|
429 |
# .................................................................. |
430 |
|
431 |
EOF |
432 |
endif |
433 |
|
434 |
|
435 |
cat >> ${mfile} <<EOF |
436 |
# Unix ln (link) |
437 |
LN = ${LN} |
438 |
# C preprocessor |
439 |
CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP} |
440 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
441 |
KPP = ${KPP} |
442 |
# Fortran compiler |
443 |
FC = ${FC} |
444 |
# Link editor |
445 |
LINK = ${LINK} |
446 |
|
447 |
# Defines for CPP |
448 |
DEFINES = ${DEFINES} |
449 |
# Includes for CPP |
450 |
INCLUDES = ${INCLUDES} |
451 |
# Flags for KPP |
452 |
KFLAGS1 = ${KFLAGS1} |
453 |
KFLAGS2 = ${KFLAGS2} |
454 |
# Optim./debug for FC |
455 |
FFLAGS = ${FFLAGS} |
456 |
FOPTIM = ${FOPTIM} |
457 |
# Files that should not be optimized |
458 |
NOOPTFILES = ${NOOPTFILES} |
459 |
NOOPTFLAGS = ${NOOPTFLAGS} |
460 |
# Flags and libraries needed for linking |
461 |
LIBS = ${LIBS} \$(XLIBS) |
462 |
|
463 |
EOF |
464 |
|
465 |
cat srclist.inc >> ${mfile} |
466 |
cat csrclist.inc >> ${mfile} |
467 |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
468 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
469 |
|
470 |
rm -f srclist.inc csrclist.inc |
471 |
|
472 |
cat >> ${mfile} <<EOF |
473 |
|
474 |
.SUFFIXES: |
475 |
.SUFFIXES: .o .f .p .F .c |
476 |
|
477 |
all: \$(EXECUTABLE) |
478 |
\$(EXECUTABLE): \$(OBJFILES) |
479 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
480 |
links: \$(SRCFILES) |
481 |
# @-\$(LN) $SRCSTARS . |
482 |
depend: |
483 |
@make links |
484 |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
485 |
|
486 |
small_f: \$(F77FILES) |
487 |
|
488 |
clean: |
489 |
-rm -rf *.o *.f *.p ${RMFILES} |
490 |
Clean: |
491 |
@make clean |
492 |
-find . -type l -exec rm {} \; |
493 |
-rm Makefile.bak |
494 |
CLEAN: |
495 |
@make Clean |
496 |
-find \$(ROOTDIR)/verification/*/input/ -name "*.meta" -exec rm {} \; |
497 |
-find \$(ROOTDIR)/verification/*/input/ -name "*.data" -exec rm {} \; |
498 |
-rm \$(EXECUTABLE) |
499 |
|
500 |
# The normal chain of rules is ( .F - .f - .o ) |
501 |
.F.f: |
502 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
503 |
.f.o: |
504 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
505 |
|
506 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
507 |
.F.p: |
508 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
509 |
.p.f: |
510 |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
511 |
EOF |
512 |
|
513 |
# Make list of "exceptions" that need ".p" files |
514 |
foreach sf ($KPPFILES) |
515 |
set fname=( ${sf:t} ) |
516 |
echo "${fname:r}.f: ${fname:r}.p" >> ${mfile} |
517 |
end |
518 |
foreach sf ($NOOPTFILES) |
519 |
set fname=( ${sf:t} ) |
520 |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
521 |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
522 |
end |
523 |
echo "" >> ${mfile} |
524 |
|
525 |
foreach dr ($SOURCEDIRS) |
526 |
set srcfiles=(`cd $dr; ls *.[cF]`:) |
527 |
echo "# These are the rules for creating the links from $dr" >> ${mfile} |
528 |
echo $srcfiles >> ${mfile} |
529 |
echo '\t$(LN) '$dr'$@ $@' >> ${mfile} |
530 |
end |
531 |
|
532 |
echo "" >> ${mfile} |
533 |
echo "# DO NOT DELETE" >> ${mfile} |
534 |
|
535 |
exit |