1 |
cnh |
1.1 |
#!/bin/csh -f |
2 |
|
|
# |
3 |
adcroft |
1.14 |
# $Header: /u/gcmpack/models/MITgcmUV/tools/genmake,v 1.13 2000/03/14 20:29:19 adcroft Exp $ |
4 |
cnh |
1.1 |
# |
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 |
adcroft |
1.9 |
case -makefile: |
15 |
|
|
set mfile = ( Makefile ) |
16 |
|
|
breaksw |
17 |
|
|
case -makefile=*: |
18 |
|
|
set mfile = ( `echo $arg | sed 's/-makefile=//' `) |
19 |
cnh |
1.1 |
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 -mpi: |
30 |
|
|
echo "Enabling MPI options" |
31 |
|
|
set USEMPI |
32 |
|
|
breaksw |
33 |
adcroft |
1.12 |
case -jam: |
34 |
|
|
set include_jam_libs |
35 |
|
|
echo "Including paths to JAM libraries" |
36 |
|
|
breaksw |
37 |
cnh |
1.1 |
case -help: |
38 |
|
|
echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]" |
39 |
|
|
exit |
40 |
|
|
breaksw |
41 |
|
|
default: |
42 |
|
|
echo "Unknown command-line option: " $arg |
43 |
|
|
echo $0 "-help to show usage" |
44 |
|
|
exit |
45 |
|
|
breaksw |
46 |
|
|
endsw |
47 |
|
|
shift allargs |
48 |
|
|
end |
49 |
cnh |
1.6 |
|
50 |
|
|
if ($?platform == 0) then |
51 |
|
|
set platform = (`uname`) |
52 |
|
|
endif |
53 |
cnh |
1.1 |
if ($?mfile == 0) set mfile = ( Makefile.$platform ) |
54 |
|
|
set mach = ( `uname -a` ) |
55 |
|
|
echo Operating system: $mach |
56 |
|
|
|
57 |
|
|
# Directories for source, includes, binaries and executables |
58 |
|
|
# Note |
59 |
|
|
# o If you prefer/need everything under a single directory |
60 |
|
|
# copy everything in ../eesupp/src, ../model/src, |
61 |
|
|
# ../eesupp/inc and ../model/inc into a directory and then |
62 |
|
|
# edit the paths below to ./ |
63 |
|
|
set SOURCEDIRS = ( ../eesupp/src/ ../model/src/ ../diags/src/) |
64 |
|
|
set INCLUDEDIRS = ( ../eesupp/inc/ ../model/inc/ ../diags/inc/) |
65 |
|
|
set BUILDDIR = ( ../bin/ ) |
66 |
|
|
set EXEDIR = ( ../exe/ ) |
67 |
|
|
set EXECUTABLE = ( mitgcmuv ) |
68 |
|
|
|
69 |
|
|
# This is the generic configuration. |
70 |
|
|
# Platform specific options are chosen below |
71 |
|
|
set LN = ( 'ln -sf' ) |
72 |
|
|
set CPP = ( '/lib/cpp -P' ) |
73 |
|
|
set KPP = ( ) |
74 |
|
|
set FC = ( 'f77' ) |
75 |
|
|
set LINK = ( 'f77' ) |
76 |
|
|
set DEFINES = ( ) |
77 |
|
|
set INCLUDES = ( ) |
78 |
|
|
set FFLAGS = ( ) |
79 |
|
|
set FOPTIM = ( ) |
80 |
|
|
set KFLAGS1 = ( ) |
81 |
|
|
set KFLAGS2 = ( ) |
82 |
|
|
set LIBS = ( ) |
83 |
|
|
set KPPFILES = ( ) |
84 |
|
|
set NOOPTFILES = ( ) |
85 |
|
|
set NOOPTFLAGS = ( ) |
86 |
|
|
set RMFILES = ( ) |
87 |
|
|
|
88 |
|
|
# We often want to use different compile/link options is using MPI |
89 |
|
|
if ($?USEMPI) then |
90 |
|
|
set USEMPI = ( '+mpi' ) |
91 |
|
|
set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' ) |
92 |
|
|
else |
93 |
|
|
set USEMPI |
94 |
|
|
# set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' ) |
95 |
|
|
endif |
96 |
|
|
|
97 |
|
|
# Platform specific options |
98 |
|
|
switch ($platform$USEMPI) |
99 |
cnh |
1.6 |
case OSF1: |
100 |
|
|
case OSF1+mpi: |
101 |
cnh |
1.1 |
echo "Configuring for DEC Alpha" |
102 |
|
|
set CPP = ( '/usr/bin/cpp -P' ) |
103 |
adcroft |
1.10 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
104 |
cnh |
1.1 |
set KPP = ( 'kapf' ) |
105 |
cnh |
1.4 |
set KPPFILES = ( 'main.F' ) |
106 |
cnh |
1.1 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
107 |
|
|
set FC = ( 'f77' ) |
108 |
adcroft |
1.2 |
set FFLAGS = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' ) |
109 |
cnh |
1.1 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
110 |
|
|
set NOOPTFLAGS = ( '-O0' ) |
111 |
|
|
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
112 |
|
|
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F') |
113 |
|
|
set RMFILES = ( '*.p.out' ) |
114 |
|
|
breaksw |
115 |
cnh |
1.6 |
case IRIX64+mpi: |
116 |
cnh |
1.1 |
echo "Configuring for SGI Mips with MPI" |
117 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
118 |
cnh |
1.1 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
119 |
|
|
set FC = ( 'mpif77' ) |
120 |
|
|
set LINK = ( 'mpif77' ) |
121 |
adcroft |
1.11 |
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
122 |
cnh |
1.1 |
set FOPTIM = ( '-O3' ) |
123 |
|
|
set RMFILES = ( 'rii_files' ) |
124 |
|
|
breaksw |
125 |
cnh |
1.6 |
case IRIX64: |
126 |
cnh |
1.1 |
echo "Configuring for SGI Mips" |
127 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
128 |
cnh |
1.1 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
129 |
|
|
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
130 |
adcroft |
1.11 |
set FOPTIM = ( '-O3' ) |
131 |
|
|
# set NOOPTFLAGS = ( '-O0' ) |
132 |
|
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
133 |
|
|
# 'load_external_fields.F' ) |
134 |
cnh |
1.1 |
set RMFILES = ( 'rii_files' ) |
135 |
|
|
breaksw |
136 |
cnh |
1.6 |
case SunOS: |
137 |
|
|
set LN = ( '/usr/bin/ln -fs' ) |
138 |
|
|
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
139 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
140 |
cnh |
1.6 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
141 |
adcroft |
1.11 |
set FOPTIM = ( '-fast -O4' ) |
142 |
cnh |
1.6 |
set NOOPTFLAGS = ( '-O0' ) |
143 |
adcroft |
1.11 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F ini_vertical_grid.F') |
144 |
cnh |
1.6 |
breaksw |
145 |
|
|
case SunOS+mpi: |
146 |
cnh |
1.1 |
set LN = ( '/usr/bin/ln -fs' ) |
147 |
|
|
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
148 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
149 |
cnh |
1.1 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
150 |
|
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
151 |
adcroft |
1.11 |
set FOPTIM = ( '-fast -O4' ) |
152 |
cnh |
1.1 |
set NOOPTFLAGS = ( '-O0' ) |
153 |
|
|
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
154 |
cnh |
1.6 |
'-lsocket -lnsl' ) |
155 |
adcroft |
1.11 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F ini_vertical_grid.F') |
156 |
cnh |
1.3 |
breaksw |
157 |
cnh |
1.6 |
case IRIX32: |
158 |
cnh |
1.3 |
echo "Configuring for SGI ONYX running IRIX64" |
159 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
160 |
cnh |
1.3 |
set INCLUDES = ( '-I/usr/include' ) |
161 |
|
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
162 |
|
|
set FOPTIM = ( '-O2' ) |
163 |
|
|
set NOOPTFLAGS = ( '-O0' ) |
164 |
|
|
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
165 |
|
|
'load_external_fields.F' ) |
166 |
|
|
set LIBS = ( '-lmpi' ) |
167 |
|
|
breaksw |
168 |
adcroft |
1.11 |
case HP-UX+mpi: |
169 |
|
|
set FC = ( 'mpif77' ) |
170 |
|
|
set LINK = ( 'mpif77' ) |
171 |
|
|
set INCLUDES = ( '-I/opt/mpi/include' ) |
172 |
cnh |
1.6 |
case HP-UX: |
173 |
cnh |
1.3 |
echo "Configuring for HP Exemplar" |
174 |
|
|
set CPP = ( '/usr/ccs/lbin/cpp -P' ) |
175 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' ) |
176 |
cnh |
1.3 |
set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \ |
177 |
|
|
'+Okernel_threads' ) |
178 |
|
|
set FOPTIM = ( '+O2' ) |
179 |
cnh |
1.6 |
set NOOPTFLAGS = ( '+O0' ) |
180 |
cnh |
1.3 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
181 |
|
|
'load_external_fields.F' ) |
182 |
cnh |
1.1 |
breaksw |
183 |
adcroft |
1.9 |
case Linux+mpi: |
184 |
|
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
185 |
adcroft |
1.14 |
set INCLUDES = ( '-I/usr/local/include' ) |
186 |
cnh |
1.6 |
case Linux: |
187 |
|
|
set LN = ( '/bin/ln -fs' ) |
188 |
adcroft |
1.14 |
set CPP = ( '/lib/cpp -traditional -P' ) |
189 |
adcroft |
1.11 |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
190 |
cnh |
1.6 |
set FC = ( 'g77' ) |
191 |
adcroft |
1.14 |
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
192 |
|
|
set FOPTIM = ( '-O3 -malign-double -funroll-loops ' ) |
193 |
cnh |
1.6 |
set LINK = ( 'g77' ) |
194 |
|
|
breaksw |
195 |
adcroft |
1.14 |
case Linux+pgi+mpi: |
196 |
|
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
197 |
|
|
set INCLUDES = ( '-I/usr/local/include' ) |
198 |
cnh |
1.6 |
case Linux+pgi: |
199 |
|
|
set LN = ( '/bin/ln -fs' ) |
200 |
adcroft |
1.14 |
set CPP = ( '/lib/cpp -traditional -P' ) |
201 |
adcroft |
1.10 |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
202 |
cnh |
1.6 |
set FC = ( 'pgf77' ) |
203 |
|
|
set FFLAGS = ( '-byteswapio' ) |
204 |
|
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
205 |
|
|
set LINK = ( 'pgf77' ) |
206 |
adcroft |
1.13 |
breaksw |
207 |
|
|
case T3E: |
208 |
|
|
case sn6312: |
209 |
|
|
set CPP = ( '/opt/ctl/bin/cpp -P') |
210 |
|
|
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
211 |
|
|
set FC = ( 'f90' ) |
212 |
|
|
set LINK = ( 'f90' ) |
213 |
|
|
set FFLAGS = ( '-O 2,fusion' ) |
214 |
cnh |
1.6 |
breaksw |
215 |
cnh |
1.1 |
default: |
216 |
|
|
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
217 |
|
|
exit |
218 |
|
|
breaksw |
219 |
|
|
endsw |
220 |
|
|
|
221 |
|
|
############################################################################### |
222 |
|
|
## ## |
223 |
|
|
## Everything below here should not need to be changed. Platform specific ## |
224 |
|
|
## changes and code specific changes should be configured above this line. ## |
225 |
|
|
## ## |
226 |
|
|
############################################################################### |
227 |
|
|
|
228 |
|
|
# Create list of files |
229 |
cnh |
1.5 |
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[F]$'` |
230 |
cnh |
1.1 |
if ( $#flist ) then |
231 |
|
|
echo -n "SRCFILES = " > srclist.inc |
232 |
|
|
echo -n "F77FILES = " > f77list.inc |
233 |
|
|
echo -n "OBJFILES = " > objlist.inc |
234 |
|
|
foreach ff ( ${flist} ) |
235 |
|
|
set fname = ( ${ff:t} ) |
236 |
|
|
echo ' \' >> srclist.inc |
237 |
|
|
echo -n " " ${fname:r}.F >> srclist.inc |
238 |
|
|
echo ' \' >> f77list.inc |
239 |
|
|
echo -n " " ${fname:r}.f >> f77list.inc |
240 |
|
|
echo ' \' >> objlist.inc |
241 |
|
|
echo -n " " ${fname:r}.o >> objlist.inc |
242 |
|
|
end |
243 |
|
|
else |
244 |
|
|
echo No source files found...\! |
245 |
|
|
exit |
246 |
|
|
endif |
247 |
cnh |
1.5 |
set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[c]$'` |
248 |
|
|
if ( $#flist ) then |
249 |
|
|
foreach ff ( ${flist} ) |
250 |
|
|
set fname = ( ${ff:t} ) |
251 |
|
|
echo ' \' >> objlist.inc |
252 |
|
|
echo -n " " ${fname:r}.o >> objlist.inc |
253 |
|
|
endif |
254 |
|
|
echo " " >> srclist.inc |
255 |
|
|
echo " " >> f77list.inc |
256 |
|
|
echo " " >> objlist.inc |
257 |
cnh |
1.1 |
|
258 |
|
|
# Convert lists of directories into command-line options |
259 |
|
|
foreach inc ($INCLUDEDIRS) |
260 |
|
|
set INCLUDES = ($INCLUDES -I$inc) |
261 |
|
|
end |
262 |
|
|
set SRCSTARS = ( ) |
263 |
|
|
foreach dr ($SOURCEDIRS) |
264 |
cnh |
1.6 |
set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] ) |
265 |
cnh |
1.1 |
end |
266 |
|
|
|
267 |
|
|
set THISHOSTNAME = ( `hostname` ) |
268 |
|
|
set THISCWD = ( `pwd` ) |
269 |
|
|
set THISDATE = ( `date` ) |
270 |
|
|
|
271 |
|
|
########################################### |
272 |
|
|
## This is the template for the makefile ## |
273 |
|
|
########################################### |
274 |
|
|
echo Creating makefile: $mfile |
275 |
|
|
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
276 |
|
|
echo "# This makefile was generated automatically pn" >> ${mfile} |
277 |
|
|
echo "# $THISDATE" >> ${mfile} |
278 |
|
|
echo "# by the command:" >> ${mfile} |
279 |
|
|
echo "# ${0} $argv" >> ${mfile} |
280 |
|
|
echo "# executed by:" >> ${mfile} |
281 |
|
|
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile} |
282 |
|
|
cat >> ${mfile} <<EOF |
283 |
|
|
# |
284 |
|
|
# BUILDDIR : Directory where object files are written |
285 |
|
|
# SOURCEDIRS : Directories containing the source (.F) files |
286 |
|
|
# INCLUDEDIRS : Directories containing the header-source (.h) files |
287 |
|
|
# EXEDIR : Directory where executable that is generated is written |
288 |
|
|
# EXECUTABLE : Full path of executable binary |
289 |
|
|
# |
290 |
|
|
# CPP : C-preprocessor command |
291 |
|
|
# INCLUDES : Directories searched for header files |
292 |
|
|
# DEFINES : Macro definitions for CPP |
293 |
|
|
# KPP : Special preprocessor command (specific to platform) |
294 |
|
|
# KFLAGS : Flags for KPP |
295 |
|
|
# FC : Fortran compiler command |
296 |
|
|
# FFLAGS : Configuration/debugging options for FC |
297 |
|
|
# FOPTIM : Optimization options for FC |
298 |
|
|
# LINK : Command for link editor program |
299 |
|
|
# LIBS : Library flags /or/ additional optimization/debugging flags |
300 |
|
|
|
301 |
|
|
BUILDDIR = ${BUILDDIR} |
302 |
|
|
SOURCEDIRS = ${SOURCEDIRS} |
303 |
|
|
INCLUDEDIRS = ${INCLUDEDIRS} |
304 |
|
|
EXEDIR = ${EXEDIR} |
305 |
|
|
EXECUTABLE = \$(EXEDIR)${EXECUTABLE} |
306 |
|
|
|
307 |
adcroft |
1.12 |
EOF |
308 |
|
|
|
309 |
|
|
|
310 |
|
|
# JAM libraries on Hyades |
311 |
|
|
if ($?include_jam_libs) then |
312 |
|
|
cat >> ${mfile} <<EOF |
313 |
|
|
# extra stuff for Hyades ............................................ |
314 |
|
|
HYADES_DIR = /u/u0/cnh/jam-lib/software |
315 |
|
|
WORK_DIR = \$(HYADES_DIR) |
316 |
|
|
DEPOSIT_DIR = linux_bin |
317 |
|
|
|
318 |
|
|
STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR) |
319 |
|
|
STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \ |
320 |
|
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \ |
321 |
|
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \ |
322 |
|
|
\$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o |
323 |
|
|
|
324 |
|
|
JAMOBJDIR = jam/\$(DEPOSIT_DIR) |
325 |
|
|
JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \ |
326 |
|
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \ |
327 |
|
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \ |
328 |
|
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \ |
329 |
|
|
\$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o |
330 |
|
|
|
331 |
|
|
JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR) |
332 |
|
|
JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o |
333 |
|
|
|
334 |
|
|
XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ) |
335 |
|
|
|
336 |
|
|
# .................................................................. |
337 |
|
|
|
338 |
|
|
EOF |
339 |
|
|
endif |
340 |
|
|
|
341 |
|
|
|
342 |
|
|
cat >> ${mfile} <<EOF |
343 |
cnh |
1.1 |
# Unix ln (link) |
344 |
|
|
LN = ${LN} |
345 |
|
|
# C preprocessor |
346 |
cnh |
1.6 |
CPP = cat \$< | ../tools/set64bitConst.sh | ${CPP} |
347 |
cnh |
1.1 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
348 |
|
|
KPP = ${KPP} |
349 |
|
|
# Fortran compiler |
350 |
|
|
FC = ${FC} |
351 |
|
|
# Link editor |
352 |
|
|
LINK = ${LINK} |
353 |
|
|
|
354 |
|
|
# Defines for CPP |
355 |
|
|
DEFINES = ${DEFINES} |
356 |
|
|
# Includes for CPP |
357 |
|
|
INCLUDES = ${INCLUDES} |
358 |
|
|
# Flags for KPP |
359 |
|
|
KFLAGS1 = ${KFLAGS1} |
360 |
|
|
KFLAGS2 = ${KFLAGS2} |
361 |
|
|
# Optim./debug for FC |
362 |
|
|
FFLAGS = ${FFLAGS} |
363 |
|
|
FOPTIM = ${FOPTIM} |
364 |
|
|
# Files that should not be optimized |
365 |
|
|
NOOPTFILES = ${NOOPTFILES} |
366 |
|
|
NOOPTFLAGS = ${NOOPTFLAGS} |
367 |
|
|
# Flags and libraries needed for linking |
368 |
|
|
LIBS = ${LIBS} |
369 |
|
|
|
370 |
|
|
EOF |
371 |
|
|
|
372 |
|
|
cat srclist.inc >> ${mfile} |
373 |
|
|
cat f77list.inc >> ${mfile} |
374 |
|
|
cat objlist.inc >> ${mfile} |
375 |
|
|
rm -f srclist.inc f77list.inc objlist.inc |
376 |
|
|
|
377 |
|
|
cat >> ${mfile} <<EOF |
378 |
|
|
|
379 |
|
|
.SUFFIXES: |
380 |
cnh |
1.5 |
.SUFFIXES: .o .f .p .F .c |
381 |
cnh |
1.1 |
|
382 |
|
|
all: \$(EXECUTABLE) |
383 |
|
|
\$(EXECUTABLE): \$(OBJFILES) |
384 |
|
|
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
385 |
|
|
links: |
386 |
|
|
@-\$(LN) $SRCSTARS . |
387 |
|
|
depend: |
388 |
|
|
@make links |
389 |
|
|
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
390 |
|
|
clean: |
391 |
|
|
-rm -rf *.o *.f *.p ${RMFILES} |
392 |
cnh |
1.6 |
Clean: |
393 |
|
|
@make clean |
394 |
adcroft |
1.8 |
-find . -type l -exec rm {} \; |
395 |
|
|
-rm Makefile.bak |
396 |
adcroft |
1.12 |
CLEAN: |
397 |
|
|
@make Clean |
398 |
|
|
-find ../verification/ -name "*.meta" -exec rm {} \; |
399 |
|
|
-find ../verification/ -name "*.data" -exec rm {} \; |
400 |
|
|
-rm \$(EXECUTABLE) |
401 |
cnh |
1.1 |
|
402 |
|
|
# The normal chain of rules is ( .F - .f - .o ) |
403 |
|
|
.F.f: |
404 |
cnh |
1.6 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
405 |
cnh |
1.1 |
.f.o: |
406 |
|
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
407 |
|
|
|
408 |
|
|
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
409 |
|
|
.F.p: |
410 |
cnh |
1.6 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
411 |
cnh |
1.1 |
.p.f: |
412 |
|
|
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
413 |
|
|
EOF |
414 |
|
|
|
415 |
|
|
# Make list of "exceptions" that need ".p" files |
416 |
|
|
foreach sf ($KPPFILES) |
417 |
|
|
set fname=( ${sf:t} ) |
418 |
|
|
echo "${fname:r}.f: ${fname:r}.p" >> ${mfile} |
419 |
|
|
end |
420 |
|
|
foreach sf ($NOOPTFILES) |
421 |
|
|
set fname=( ${sf:t} ) |
422 |
|
|
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
423 |
|
|
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
424 |
|
|
end |
425 |
|
|
echo >> ${mfile} |
426 |
|
|
echo "# DO NOT DELETE" >> ${mfile} |
427 |
|
|
|
428 |
|
|
exit |