3 |
# $Header$ |
# $Header$ |
4 |
# |
# |
5 |
# Makefile generator for MITgcm UV codes |
# Makefile generator for MITgcm UV codes |
6 |
# created by cnh 03/98 |
# created by cnh 03/98 |
7 |
# adapted by aja 06/98 |
# adapted by aja 06/98 |
8 |
|
# modified by aja 01/00 |
9 |
|
|
10 |
|
# Default lists |
11 |
|
set DISABLE = ( aim autodiff cal cost ctrl ecco exf ) |
12 |
|
set ENABLE = ( ) |
13 |
|
set MODS = ( ) |
14 |
|
|
15 |
|
# Grab variables/lists from .genmakerc |
16 |
|
if (-r .genmakerc) source .genmakerc |
17 |
|
|
18 |
# Process command-line arguments |
# Process command-line arguments |
19 |
set allargs=( $argv ) |
set allargs=( $argv ) |
33 |
exit |
exit |
34 |
breaksw |
breaksw |
35 |
case -platform*: |
case -platform*: |
36 |
|
if ($?platform) then |
37 |
|
echo Option -platform=dir can only be specified once.; exit 1 |
38 |
|
endif |
39 |
set platform = ( `echo $arg | sed 's/-platform=//' `) |
set platform = ( `echo $arg | sed 's/-platform=//' `) |
40 |
breaksw |
breaksw |
41 |
|
case -rootdir: |
42 |
|
case -rootdir=: |
43 |
|
echo "To specify root directory you must specify one with -rootdir=dir" |
44 |
|
echo "with NO space eg. -rootdir=../../.. or -rootdir=/usr/people/joe/src" |
45 |
|
exit |
46 |
|
breaksw |
47 |
|
case -rootdir=*: |
48 |
|
if ($?ROOTDIR) then |
49 |
|
echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR |
50 |
|
echo "***" Command line \"$arg\" will override this. |
51 |
|
endif |
52 |
|
set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `) |
53 |
|
breaksw |
54 |
|
case -mods: |
55 |
|
case -mods=: |
56 |
|
echo "To specify an additional source directory you must specify one with -mods=dir" |
57 |
|
echo "with NO space eg. -mods=../code or -mods=/usr/people/joe/src" |
58 |
|
exit |
59 |
|
breaksw |
60 |
|
case -mods=*: |
61 |
|
set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `) |
62 |
|
breaksw |
63 |
|
case -disable: |
64 |
|
case -disable=: |
65 |
|
echo "To disable packages from compilation use -disable=pkg1,pkg2" |
66 |
|
echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)" |
67 |
|
exit |
68 |
|
breaksw |
69 |
|
case -disable=*: |
70 |
|
set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `) |
71 |
|
breaksw |
72 |
|
case -enable: |
73 |
|
case -enable=: |
74 |
|
echo "To enable packages from compilation use -enable=pkg1,pkg2" |
75 |
|
echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)" |
76 |
|
echo "-enable overrides -disable, ie. a package listed in both is enabled" |
77 |
|
exit |
78 |
|
breaksw |
79 |
|
case -enable=*: |
80 |
|
set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `) |
81 |
|
breaksw |
82 |
case -mpi: |
case -mpi: |
83 |
echo "Enabling MPI options" |
echo "Enabling MPI options" |
84 |
set USEMPI |
set USEMPI |
100 |
shift allargs |
shift allargs |
101 |
end |
end |
102 |
|
|
103 |
if ($?platform == 0) then |
# Default actions/options |
104 |
|
|
105 |
|
# If platform wasn't specified then determine platform type of the host |
106 |
|
if (! $?platform) then |
107 |
set platform = (`uname`) |
set platform = (`uname`) |
108 |
endif |
endif |
109 |
if ($?mfile == 0) set mfile = ( Makefile.$platform ) |
# If name of makefile wasn't specified then use default "Makefile" |
110 |
|
if (! $?mfile) set mfile = ( Makefile ) |
111 |
|
|
112 |
set mach = ( `uname -a` ) |
set mach = ( `uname -a` ) |
113 |
echo Operating system: $mach |
echo Operating system: $mach |
114 |
|
|
115 |
|
|
116 |
# Directories for source, includes, binaries and executables |
# Directories for source, includes, binaries and executables |
117 |
# Note |
# |
118 |
# o If you prefer/need everything under a single directory |
# If -rootdir wasn't specified then assume script is being run from bin |
119 |
# copy everything in ../eesupp/src, ../model/src, |
# but if it was supplied then we should place the executable in the build dir |
120 |
# ../eesupp/inc and ../model/inc into a directory and then |
if (! $?ROOTDIR) then |
121 |
# edit the paths below to ./ |
set pwd=`pwd` |
122 |
set SOURCEDIRS = ( ../eesupp/src/ ../model/src/ ../diags/src/ ../pkg/*/) |
if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then |
123 |
set INCLUDEDIRS = ( ./ ../eesupp/inc/ ../model/inc/ ../diags/inc/ ../pkg/*/) |
set ROOTDIR = ( .. ) |
124 |
set BUILDDIR = ( ../bin/ ) |
endif |
125 |
set EXEDIR = ( ../exe/ ) |
endif |
126 |
set EXECUTABLE = ( mitgcmuv ) |
# Scan for logical ROOTDIR |
127 |
|
if (! $?ROOTDIR) then |
128 |
|
foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..) |
129 |
|
if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then |
130 |
|
set ROOTDIR = $dr |
131 |
|
echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\" |
132 |
|
break |
133 |
|
endif |
134 |
|
end |
135 |
|
endif |
136 |
|
if (! $?ROOTDIR) then |
137 |
|
echo Root directory was not specified and could not be determined. |
138 |
|
echo Specify the root location of the model source with -rootdir=dir |
139 |
|
exit 1 |
140 |
|
endif |
141 |
|
if (! -d $ROOTDIR) then |
142 |
|
echo Root directory $ROOTDIR not found.;exit 1 |
143 |
|
endif |
144 |
|
# If -mods wasn't specified then we will assume that we can find all the |
145 |
|
# source code in the standard directories |
146 |
|
if (! $?MODS) then |
147 |
|
set SOURCEDIRS = ( ) |
148 |
|
set INCLUDEDIRS = ( . ) |
149 |
|
else |
150 |
|
set SOURCEDIRS = ( $MODS ) |
151 |
|
set INCLUDEDIRS = ( . $MODS ) |
152 |
|
endif |
153 |
|
if (! $?BUILDDIR) set BUILDDIR = ( . ) |
154 |
|
if (! -d $BUILDDIR) then |
155 |
|
echo Build directory $BUILDDIR not found.;exit 1 |
156 |
|
endif |
157 |
|
if (! $?EXEDIR) then |
158 |
|
set pwd=`pwd` |
159 |
|
if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then |
160 |
|
set EXEDIR = ( ../exe ) |
161 |
|
else |
162 |
|
set EXEDIR = ( . ) |
163 |
|
endif |
164 |
|
endif |
165 |
|
if (! -d $EXEDIR) then |
166 |
|
echo Executable directory $EXEDIR not found.;exit 1 |
167 |
|
endif |
168 |
|
if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools ) |
169 |
|
if (! -d $TOOLSDIR) then |
170 |
|
echo Tools directory $TOOLSDIR not found.;exit 1 |
171 |
|
endif |
172 |
|
if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv ) |
173 |
|
|
174 |
|
# Now scan the standard source code tree |
175 |
|
foreach dr ($SOURCEDIRS) |
176 |
|
set adr=$dr |
177 |
|
if (! -d $adr) then |
178 |
|
echo mods directory $adr not found.; exit 1 |
179 |
|
endif |
180 |
|
echo Adding mods directory $adr |
181 |
|
end |
182 |
|
if (! $?PACKAGES) then |
183 |
|
set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`) |
184 |
|
endif |
185 |
|
foreach dr ($PACKAGES) |
186 |
|
set enable |
187 |
|
foreach p ($DISABLE) |
188 |
|
if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then |
189 |
|
echo Specified package \"$p\" does not exist. |
190 |
|
exit 1 |
191 |
|
endif |
192 |
|
if ($dr == $p) unset enable |
193 |
|
if ($p == 'all') unset enable |
194 |
|
end |
195 |
|
foreach p ($ENABLE) |
196 |
|
if ($dr == $p) set enable |
197 |
|
end |
198 |
|
if ($?enable) then |
199 |
|
set adr=$ROOTDIR/pkg/$dr |
200 |
|
if (! -d $adr) then |
201 |
|
echo Source directory $adr not found.; exit 1 |
202 |
|
endif |
203 |
|
echo Adding package directory $adr |
204 |
|
set SOURCEDIRS = ($SOURCEDIRS $adr) |
205 |
|
set INCLUDEDIRS = ($INCLUDEDIRS $adr) |
206 |
|
else |
207 |
|
echo "*" Package \"$dr\" has not been enabled. |
208 |
|
endif |
209 |
|
end |
210 |
|
if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model) |
211 |
|
foreach dr ($STANDARDDIRS) |
212 |
|
set adr=$ROOTDIR/$dr/src |
213 |
|
if (! -d $adr) then |
214 |
|
echo Source directory $adr not found.; exit 1 |
215 |
|
endif |
216 |
|
echo Adding source directory $adr |
217 |
|
set SOURCEDIRS = ($SOURCEDIRS $adr) |
218 |
|
set idr = `echo $adr | sed 's/src/inc/'` |
219 |
|
set INCLUDEDIRS = ($INCLUDEDIRS $idr) |
220 |
|
end |
221 |
|
|
222 |
# This is the generic configuration. |
# This is the generic configuration. |
223 |
# Platform specific options are chosen below |
# Platform specific options are chosen below |
224 |
set LN = ( 'ln -sf' ) |
set LN = ( 'ln -s' ) |
225 |
set CPP = ( '/lib/cpp -P' ) |
set CPP = ( '/lib/cpp -P' ) |
226 |
set KPP = ( ) |
set KPP = ( ) |
227 |
set FC = ( 'f77' ) |
set FC = ( 'f77' ) |
258 |
set KPPFILES = ( 'main.F' ) |
set KPPFILES = ( 'main.F' ) |
259 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
260 |
set FC = ( 'f77' ) |
set FC = ( 'f77' ) |
261 |
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' ) |
262 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
263 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
264 |
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
265 |
set NOOPTFILES = ( 'barrier.F different_multiple.F load_external_fields.F') |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
266 |
set RMFILES = ( '*.p.out' ) |
set RMFILES = ( '*.p.out' ) |
267 |
breaksw |
breaksw |
268 |
case IRIX64+mpi: |
case IRIX64+mpi: |
283 |
set FOPTIM = ( '-O3' ) |
set FOPTIM = ( '-O3' ) |
284 |
# set NOOPTFLAGS = ( '-O0' ) |
# set NOOPTFLAGS = ( '-O0' ) |
285 |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
286 |
# 'load_external_fields.F' ) |
# 'external_fields_load.F' ) |
287 |
set RMFILES = ( 'rii_files' ) |
set RMFILES = ( 'rii_files' ) |
288 |
breaksw |
breaksw |
289 |
|
case o2: |
290 |
|
case IRIX: |
291 |
|
echo "Configuring for SGI O2 running IRIX 6.5" |
292 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
293 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
294 |
|
set FOPTIM = ( '-O2' ) |
295 |
|
set NOOPTFLAGS = ( '-O0' ) |
296 |
|
breaksw |
297 |
|
case o2+mpi: |
298 |
|
case IRIX+mpi: |
299 |
|
echo "Configuring for SGI O2 running IRIX 6.5 with MPI" |
300 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
301 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' ) |
302 |
|
set FOPTIM = ( '-O2' ) |
303 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
304 |
|
set NOOPTFLAGS = ( '-O0' ) |
305 |
|
set LIBS = ( '-lmpi' ) |
306 |
|
breaksw |
307 |
|
case o2k+mpi: |
308 |
|
echo "Configuring for SGI Origin2000 running IRIX 6.5" |
309 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
310 |
|
set INCLUDES = ( '-I/usr/include' ) |
311 |
|
set FFLAGS = ( '-n32 -extend_source -bytereclen' ) |
312 |
|
set FOPTIM = ( '-O2' ) |
313 |
|
set NOOPTFILES = ( 'calc_mom_rhs.F' ) |
314 |
|
set NOOPTFLAGS = ( '-O1' ) |
315 |
|
set LIBS = ( '-lmpi -lscs' ) |
316 |
|
breaksw |
317 |
|
case onyx: |
318 |
|
case onyx+mpi: |
319 |
|
echo "Configuring for SGI ONYX running IRIX64" |
320 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
321 |
|
set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' ) |
322 |
|
set FOPTIM = ( '-O2' ) |
323 |
|
set NOOPTFLAGS = ( '-O0' ) |
324 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' ) |
325 |
|
set LIBS = ( '-lmpi' ) |
326 |
|
breaksw |
327 |
case SunOS: |
case SunOS: |
328 |
set LN = ( '/usr/bin/ln -fs' ) |
set LN = ( '/usr/bin/ln -s' ) |
329 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
330 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
331 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
332 |
set FOPTIM = ( '-fast -O4' ) |
set FOPTIM = ( '-fast -O3' ) |
333 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
334 |
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') |
335 |
breaksw |
breaksw |
336 |
case SunOS+mpi: |
case SunOS+mpi: |
337 |
set LN = ( '/usr/bin/ln -fs' ) |
set LN = ( '/usr/bin/ln -s' ) |
338 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
339 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
340 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
341 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
342 |
set FOPTIM = ( '-fast -O4' ) |
set FOPTIM = ( '-fast -O3' ) |
343 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
344 |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
345 |
'-lsocket -lnsl' ) |
'-lsocket -lnsl' ) |
346 |
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') |
347 |
breaksw |
breaksw |
348 |
case IRIX32: |
case IRIX32: |
349 |
echo "Configuring for SGI ONYX running IRIX64" |
echo "Configuring for SGI ONYX running IRIX64" |
353 |
set FOPTIM = ( '-O2' ) |
set FOPTIM = ( '-O2' ) |
354 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
355 |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
356 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
357 |
set LIBS = ( '-lmpi' ) |
set LIBS = ( '-lmpi' ) |
358 |
breaksw |
breaksw |
359 |
case HP-UX+mpi: |
case HP-UX+mpi: |
369 |
set FOPTIM = ( '+O2' ) |
set FOPTIM = ( '+O2' ) |
370 |
set NOOPTFLAGS = ( '+O0' ) |
set NOOPTFLAGS = ( '+O0' ) |
371 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
372 |
'load_external_fields.F' ) |
'external_fields_load.F' ) |
373 |
breaksw |
breaksw |
374 |
case Linux+mpi: |
case Linux+mpi: |
375 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
376 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
377 |
case Linux: |
case Linux: |
378 |
set LN = ( '/bin/ln -fs' ) |
set LN = ( '/bin/ln -s' ) |
379 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
380 |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
381 |
set FC = ( 'g77' ) |
set FC = ( 'g77' ) |
392 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
393 |
endif |
endif |
394 |
case Linux+pgi: |
case Linux+pgi: |
395 |
set LN = ( '/bin/ln -fs' ) |
set LN = ( '/bin/ln -s' ) |
396 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
397 |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
398 |
set FC = ( 'pgf77' ) |
set FC = ( 'pgf77' ) |
399 |
set FFLAGS = ( '-byteswapio' ) |
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
400 |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
401 |
set LINK = ( 'pgf77' ) |
set LINK = ( 'pgf77' ) |
402 |
breaksw |
breaksw |
408 |
set LINK = ( 'f90' ) |
set LINK = ( 'f90' ) |
409 |
set FFLAGS = ( '-O 2,fusion' ) |
set FFLAGS = ( '-O 2,fusion' ) |
410 |
breaksw |
breaksw |
411 |
|
case T90: |
412 |
|
case sn7113: |
413 |
|
set FC = ( 'f90' ) |
414 |
|
set LINK = ( 'f90' ) |
415 |
|
set LN = ( '/bin/ln -s' ) |
416 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
417 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
418 |
|
set FFLAGS = ( '-m3 -Rabc -N 132') |
419 |
|
set FOPTIM = ( '-O0' ) |
420 |
|
set NOOPTFLAGS = ( '-O0' ) |
421 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
422 |
|
breaksw |
423 |
|
case SV1: |
424 |
|
case sn3002: |
425 |
|
set FC = ( 'f90' ) |
426 |
|
set LINK = ( 'f90' ) |
427 |
|
set LN = ( '/bin/ln -s' ) |
428 |
|
set CPP = ( '/opt/ctl/bin/cpp -N -P' ) |
429 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) |
430 |
|
set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132') |
431 |
|
set FOPTIM = ( '-O0' ) |
432 |
|
set NOOPTFLAGS = ( '-O0' ) |
433 |
|
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
434 |
|
breaksw |
435 |
default: |
default: |
436 |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
437 |
exit |
exit |
445 |
## ## |
## ## |
446 |
############################################################################### |
############################################################################### |
447 |
|
|
|
# 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 |
|
|
|
|
448 |
# Convert lists of directories into command-line options |
# Convert lists of directories into command-line options |
449 |
foreach inc ($INCLUDEDIRS) |
foreach inc ($INCLUDEDIRS) |
450 |
set INCLUDES = ($INCLUDES -I$inc) |
set INCLUDES = ($INCLUDES -I$inc) |
451 |
end |
end |
452 |
set SRCSTARS = ( ) |
|
453 |
|
# Search for source code |
454 |
|
rm -rf .links.tmp;mkdir .links.tmp |
455 |
|
echo "# This section creates symbolic links" > srclinks.tmp |
456 |
|
echo "" >> srclinks.tmp |
457 |
|
echo -n 'SRCFILES = ' > srclist.inc |
458 |
|
echo -n 'CSRCFILES = ' > csrclist.inc |
459 |
|
#echo -n 'HEADERFILES = ' > hlist.inc |
460 |
foreach dr ($SOURCEDIRS) |
foreach dr ($SOURCEDIRS) |
461 |
set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] ) |
set deplist=( ) |
462 |
|
foreach srcfile (`cd $dr; ls *.[hcF]`) |
463 |
|
if (! -r .links.tmp/$srcfile) then |
464 |
|
if (-f $dr/$srcfile) then |
465 |
|
switch ($srcfile:e) |
466 |
|
case F: |
467 |
|
touch .links.tmp/$srcfile |
468 |
|
set deplist=($deplist $srcfile) |
469 |
|
echo ' \' >> srclist.inc |
470 |
|
echo -n " " $srcfile >> srclist.inc |
471 |
|
breaksw |
472 |
|
case c: |
473 |
|
touch .links.tmp/$srcfile |
474 |
|
set deplist=($deplist $srcfile) |
475 |
|
echo ' \' >> csrclist.inc |
476 |
|
echo -n " " $srcfile >> csrclist.inc |
477 |
|
breaksw |
478 |
|
case h: |
479 |
|
# touch .links.tmp/$srcfile |
480 |
|
# set deplist=($deplist $srcfile) |
481 |
|
# echo ' \' >> hlist.inc |
482 |
|
# echo -n " " $srcfile >> hlist.inc |
483 |
|
breaksw |
484 |
|
endsw |
485 |
|
endif |
486 |
|
endif |
487 |
|
end |
488 |
|
if ($#deplist != 0) then |
489 |
|
echo "# These files are linked from $dr" >> srclinks.tmp |
490 |
|
echo $deplist':' >> srclinks.tmp |
491 |
|
echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp |
492 |
|
endif |
493 |
end |
end |
494 |
|
rm -rf .links.tmp |
495 |
|
echo "" >> srclist.inc |
496 |
|
echo "" >> csrclist.inc |
497 |
|
#echo "" >> hlist.inc |
498 |
|
|
499 |
set THISHOSTNAME = ( `hostname` ) |
set THISHOSTNAME = ( `hostname` ) |
500 |
set THISCWD = ( `pwd` ) |
set THISCWD = ( `pwd` ) |
501 |
set THISDATE = ( `date` ) |
set THISDATE = ( `date` ) |
502 |
|
|
503 |
|
if (-r $mfile) mv -f $mfile $mfile.bak |
504 |
########################################### |
########################################### |
505 |
## This is the template for the makefile ## |
## This is the template for the makefile ## |
506 |
########################################### |
########################################### |
507 |
echo Creating makefile: $mfile |
echo Creating makefile: $mfile |
508 |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} |
509 |
echo "# This makefile was generated automatically pn" >> ${mfile} |
echo "# This makefile was generated automatically on" >> ${mfile} |
510 |
echo "# $THISDATE" >> ${mfile} |
echo "# $THISDATE" >> ${mfile} |
511 |
echo "# by the command:" >> ${mfile} |
echo "# by the command:" >> ${mfile} |
512 |
echo "# ${0} $argv" >> ${mfile} |
echo "# ${0} $argv" >> ${mfile} |
531 |
# LINK : Command for link editor program |
# LINK : Command for link editor program |
532 |
# LIBS : Library flags /or/ additional optimization/debugging flags |
# LIBS : Library flags /or/ additional optimization/debugging flags |
533 |
|
|
534 |
BUILDDIR = ${BUILDDIR} |
ROOTDIR = ${ROOTDIR} |
535 |
SOURCEDIRS = ${SOURCEDIRS} |
BUILDDIR = ${BUILDDIR} |
536 |
|
SOURCEDIRS = ${SOURCEDIRS} |
537 |
INCLUDEDIRS = ${INCLUDEDIRS} |
INCLUDEDIRS = ${INCLUDEDIRS} |
538 |
EXEDIR = ${EXEDIR} |
EXEDIR = ${EXEDIR} |
539 |
EXECUTABLE = \$(EXEDIR)${EXECUTABLE} |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
540 |
|
TOOLSDIR = ${TOOLSDIR} |
541 |
|
|
542 |
EOF |
EOF |
543 |
|
|
579 |
# Unix ln (link) |
# Unix ln (link) |
580 |
LN = ${LN} |
LN = ${LN} |
581 |
# C preprocessor |
# C preprocessor |
582 |
CPP = cat \$< | ../tools/set64bitConst.sh | ${CPP} |
CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP} |
583 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
584 |
KPP = ${KPP} |
KPP = ${KPP} |
585 |
# Fortran compiler |
# Fortran compiler |
605 |
|
|
606 |
EOF |
EOF |
607 |
|
|
608 |
cat srclist.inc >> ${mfile} |
cat srclist.inc >> ${mfile} |
609 |
cat f77list.inc >> ${mfile} |
cat csrclist.inc >> ${mfile} |
610 |
cat objlist.inc >> ${mfile} |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
611 |
rm -f srclist.inc f77list.inc objlist.inc |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
612 |
|
|
613 |
|
rm -f srclist.inc csrclist.inc flist.tmp clist.tmp |
614 |
|
|
615 |
cat >> ${mfile} <<EOF |
cat >> ${mfile} <<EOF |
616 |
|
|
620 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
621 |
\$(EXECUTABLE): \$(OBJFILES) |
\$(EXECUTABLE): \$(OBJFILES) |
622 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
|
links: |
|
|
@-\$(LN) $SRCSTARS . |
|
623 |
depend: |
depend: |
624 |
@make links |
@make links |
625 |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
626 |
|
|
627 |
|
links: \$(SRCFILES) |
628 |
|
|
629 |
|
small_f: \$(F77FILES) |
630 |
|
|
631 |
clean: |
clean: |
632 |
-rm -rf *.o *.f *.p ${RMFILES} |
-rm -rf *.o *.f *.p ${RMFILES} |
633 |
Clean: |
Clean: |
634 |
@make clean |
@make clean |
635 |
-find . -type l -exec rm {} \; |
@make cleanlinks |
636 |
-rm Makefile.bak |
-rm -f Makefile.bak |
637 |
CLEAN: |
CLEAN: |
638 |
@make Clean |
@make Clean |
639 |
-find ../verification/ -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
640 |
-find ../verification/ -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
641 |
-rm \$(EXECUTABLE) |
-rm -f \$(EXECUTABLE) |
642 |
|
|
643 |
|
makefile: |
644 |
|
${0} $argv |
645 |
|
cleanlinks: |
646 |
|
-find . -type l -exec rm {} \; |
647 |
|
|
648 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .f - .o ) |
649 |
.F.f: |
.F.f: |
668 |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} |
669 |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} |
670 |
end |
end |
671 |
echo >> ${mfile} |
echo "" >> ${mfile} |
672 |
|
|
673 |
|
# Add rules for links |
674 |
|
cat srclinks.tmp >> ${mfile} |
675 |
|
rm -f srclinks.tmp |
676 |
|
|
677 |
|
echo "" >> ${mfile} |
678 |
echo "# DO NOT DELETE" >> ${mfile} |
echo "# DO NOT DELETE" >> ${mfile} |
679 |
|
|
680 |
exit |
exit |