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 |
9 |
# modified by aja 01/00 |
# modified by aja 01/00 |
10 |
|
|
11 |
# Default lists |
# Default lists |
12 |
set DISABLE = ( aim ) |
set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk flt ptracers ) |
13 |
|
set DEFINES = ( ) |
14 |
set ENABLE = ( ) |
set ENABLE = ( ) |
15 |
set MODS = ( ) |
set MODS = ( ) |
16 |
|
|
81 |
case -enable=*: |
case -enable=*: |
82 |
set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `) |
set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `) |
83 |
breaksw |
breaksw |
84 |
|
case -cpp: |
85 |
|
case -cpp=: |
86 |
|
echo "To define CPP macros use -cpp=arg" |
87 |
|
exit |
88 |
|
breaksw |
89 |
|
case -cpp=*: |
90 |
|
set DEFINES = ( $DEFINES `echo $arg | sed 's/-cpp=//' | sed 's/,/ /g' `) |
91 |
|
breaksw |
92 |
|
case -ieee: |
93 |
|
set IEEE |
94 |
|
breaksw |
95 |
case -mpi: |
case -mpi: |
96 |
echo "Enabling MPI options" |
echo "Enabling MPI options" |
97 |
set USEMPI |
set USEMPI |
100 |
set include_jam_libs |
set include_jam_libs |
101 |
echo "Including paths to JAM libraries" |
echo "Including paths to JAM libraries" |
102 |
breaksw |
breaksw |
103 |
|
case -fc: |
104 |
|
case -fc=: |
105 |
|
echo "To change the compiler (\$FC) you must specify one with -fc=" |
106 |
|
echo "eg. -fc=f90 or -fc=g77" |
107 |
|
exit |
108 |
|
breaksw |
109 |
|
case -fc*: |
110 |
|
if ($?FC) then |
111 |
|
echo Option -fc=... can only be specified once.; exit 1 |
112 |
|
endif |
113 |
|
set FC = ( `echo $arg | sed 's/-fc=//' `) |
114 |
|
breaksw |
115 |
case -help: |
case -help: |
116 |
echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]" |
echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]" |
117 |
|
cat << EOF |
118 |
|
|
119 |
|
$0 is used to generate the Makefile in the current directory. |
120 |
|
|
121 |
|
Typical invocations are: |
122 |
|
o from "bin": ../tools/genmake |
123 |
|
o from "verification/expt/code": ../../../tools/genmake |
124 |
|
o from "verification/expt/input": ../../../tools/genmake -mods=../code |
125 |
|
o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm |
126 |
|
or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods |
127 |
|
|
128 |
|
Packages (collected modules of code) can be disabled to avoid unnecessary |
129 |
|
compilation of unused code. For instance if you know you will not |
130 |
|
use GM/Redi, KPP and OBCS and they are appropriate turned-off in the |
131 |
|
configuration: |
132 |
|
.../tools/genmake -disable=gmredi,kpp,obcs |
133 |
|
|
134 |
|
If you add some source files you can re-call the previous instance of |
135 |
|
genmake with "make makefile". |
136 |
|
|
137 |
|
genmake also reads the file .genmakerc which can be used to configure |
138 |
|
options (primarily the command-line options above) for particular experiments. |
139 |
|
EOF |
140 |
exit |
exit |
141 |
breaksw |
breaksw |
142 |
default: |
default: |
153 |
# If platform wasn't specified then determine platform type of the host |
# If platform wasn't specified then determine platform type of the host |
154 |
if (! $?platform) then |
if (! $?platform) then |
155 |
set platform = (`uname`) |
set platform = (`uname`) |
156 |
|
# This let's us distinguish between different Linux platforms |
157 |
|
if ($platform == Linux) then |
158 |
|
set machine = (`uname -m`) |
159 |
|
set platform = ($platform'-'$machine) |
160 |
|
endif |
161 |
endif |
endif |
162 |
# If name of makefile wasn't specified then use default "Makefile" |
# If name of makefile wasn't specified then use default "Makefile" |
163 |
if (! $?mfile) set mfile = ( Makefile ) |
if (! $?mfile) set mfile = ( Makefile ) |
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 |
# |
# |
170 |
# If -rootdir wasn't specified then assume script is being run from bin |
# If -rootdir wasn't specified then assume script is being run from bin |
171 |
# but if it was supplied then we should place the executable in the build dir |
# but if it was supplied then we should place the executable in the build dir |
172 |
if (! $?ROOTDIR) then |
if (! $?ROOTDIR) then |
173 |
set ROOTDIR = ( .. ) |
set pwd=`pwd` |
174 |
else |
if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then |
175 |
if (! $?EXEDIR) set EXEDIR = ( . ) |
set ROOTDIR = ( .. ) |
176 |
|
endif |
177 |
|
endif |
178 |
|
# 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 |
endif |
193 |
if (! -d $ROOTDIR) then |
if (! -d $ROOTDIR) then |
194 |
echo Root directory $ROOTDIR not found.;exit 1 |
echo Root directory $ROOTDIR not found.;exit 1 |
197 |
# source code in the standard directories |
# source code in the standard directories |
198 |
if (! $?MODS) then |
if (! $?MODS) then |
199 |
set SOURCEDIRS = ( ) |
set SOURCEDIRS = ( ) |
200 |
set INCLUDEDIRS = ( . ) |
set INCLUDEDIRS = ( ) |
201 |
else |
else |
202 |
set SOURCEDIRS = ( $MODS ) |
set SOURCEDIRS = ( $MODS ) |
203 |
set INCLUDEDIRS = ( . $MODS ) |
set INCLUDEDIRS = ( $MODS ) |
204 |
endif |
endif |
205 |
if (! $?BUILDDIR) set BUILDDIR = ( . ) |
if (! $?BUILDDIR) set BUILDDIR = ( . ) |
206 |
if (! -d $BUILDDIR) then |
if (! -d $BUILDDIR) then |
207 |
echo Build directory $BUILDDIR not found.;exit 1 |
echo Build directory $BUILDDIR not found.;exit 1 |
208 |
endif |
endif |
209 |
if (! $?EXEDIR) set EXEDIR = ( $ROOTDIR/exe ) |
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 |
if (! -d $EXEDIR) then |
218 |
echo Executable directory $EXEDIR not found.;exit 1 |
echo Executable directory $EXEDIR not found.;exit 1 |
219 |
endif |
endif |
223 |
endif |
endif |
224 |
if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv ) |
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 |
# Now scan the standard source code tree |
241 |
foreach dr ($SOURCEDIRS) |
foreach dr ($SOURCEDIRS) |
242 |
set adr=$dr |
set adr=$dr |
243 |
if (! -d $adr) then |
if (! -d $adr) then |
244 |
echo mods directory $adr not found.; exit 1 |
echo mods directory $adr not found.; exit 1 |
245 |
endif |
endif |
246 |
echo Adding mods directory $adr |
echo Adding mods dir: $adr |
|
end |
|
|
if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags) |
|
|
foreach dr ($STANDARDDIRS) |
|
|
set adr=$ROOTDIR/$dr/src |
|
|
if (! -d $adr) then |
|
|
echo Source directory $adr not found.; exit 1 |
|
|
endif |
|
|
echo Adding source directory $adr |
|
|
set SOURCEDIRS = ($SOURCEDIRS $adr) |
|
|
set idr = `echo $adr | sed 's/src/inc/'` |
|
|
set INCLUDEDIRS = ($INCLUDEDIRS $idr) |
|
247 |
end |
end |
248 |
if (! $?PACKAGES) then |
if (! $?PACKAGES) then |
249 |
set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`) |
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 |
endif |
254 |
foreach dr ($PACKAGES) |
foreach dr ($PACKAGES) |
255 |
set enable |
set enable |
256 |
foreach p ($DISABLE) |
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 |
if ($dr == $p) unset enable |
262 |
if ($p == 'all') unset enable |
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 |
end |
269 |
foreach p ($ENABLE) |
foreach p ($ENABLE) |
270 |
if ($dr == $p) set enable |
if ($dr == $p) set enable |
274 |
if (! -d $adr) then |
if (! -d $adr) then |
275 |
echo Source directory $adr not found.; exit 1 |
echo Source directory $adr not found.; exit 1 |
276 |
endif |
endif |
277 |
echo Adding package directory $adr |
echo Adding pkg dir: $adr |
278 |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
279 |
set INCLUDEDIRS = ($INCLUDEDIRS $adr) |
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 |
else |
287 |
echo "*" Package \"$dr\" has not been enabled. |
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 |
|
default: |
296 |
|
breaksw |
297 |
|
endsw |
298 |
|
endif |
299 |
|
end |
300 |
|
if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model) |
301 |
|
foreach dr ($STANDARDDIRS) |
302 |
|
set adr=$ROOTDIR/$dr/src |
303 |
|
if (! -d $adr) then |
304 |
|
echo Source directory $adr not found.; exit 1 |
305 |
endif |
endif |
306 |
|
echo Adding src dir: $adr |
307 |
|
set SOURCEDIRS = ($SOURCEDIRS $adr) |
308 |
|
set idr = `echo $adr | sed 's/src/inc/'` |
309 |
|
set INCLUDEDIRS = ($INCLUDEDIRS $idr) |
310 |
end |
end |
311 |
|
|
312 |
|
# Find possible compilers |
313 |
|
if ($?FC) then |
314 |
|
echo "$FC was specified as the compiler" |
315 |
|
else |
316 |
|
echo " " |
317 |
|
set likelysuspects=(ifc g77 pgf77 f77 f90 f95) |
318 |
|
foreach fc ($likelysuspects) |
319 |
|
set foundfc=`which $fc |& cat - ` |
320 |
|
if (-x $foundfc[1]) then |
321 |
|
if ($?possiblefc) then |
322 |
|
set possiblefc=($possiblefc $fc) |
323 |
|
else |
324 |
|
set possiblefc=$fc |
325 |
|
endif |
326 |
|
endif |
327 |
|
end |
328 |
|
if ($?possiblefc) then |
329 |
|
set FC=$possiblefc[1] |
330 |
|
echo Found these compilers: $possiblefc. Using \"$FC\" as the compiler |
331 |
|
else |
332 |
|
echo "No compiler found\!" |
333 |
|
echo I tried looking for \"$likelysuspects\" in your \$PATH but found none |
334 |
|
exit 13 |
335 |
|
endif |
336 |
|
endif |
337 |
|
|
338 |
# This is the generic configuration. |
# This is the generic configuration. |
339 |
# Platform specific options are chosen below |
# Platform specific options are chosen below |
340 |
set LN = ( 'ln -s' ) |
set LN = ( 'ln -s' ) |
341 |
set CPP = ( '/lib/cpp -P' ) |
set CPP = ( '/lib/cpp -P' ) |
342 |
|
set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' ) |
343 |
set KPP = ( ) |
set KPP = ( ) |
344 |
set FC = ( 'f77' ) |
#set FC = ( 'f77' ) |
345 |
set LINK = ( 'f77' ) |
set LINK = $FC |
346 |
set DEFINES = ( ) |
set MAKEDEPEND = ( 'makedepend' ) |
347 |
set INCLUDES = ( ) |
set INCLUDES = ( -I. ) |
348 |
set FFLAGS = ( ) |
set FFLAGS = ( ) |
349 |
set FOPTIM = ( ) |
set FOPTIM = ( ) |
350 |
|
set CFLAGS = ( ) |
351 |
set KFLAGS1 = ( ) |
set KFLAGS1 = ( ) |
352 |
set KFLAGS2 = ( ) |
set KFLAGS2 = ( ) |
353 |
set LIBS = ( ) |
set LIBS = ( ) |
367 |
|
|
368 |
# Platform specific options |
# Platform specific options |
369 |
switch ($platform$USEMPI) |
switch ($platform$USEMPI) |
|
case OSF1: |
|
370 |
case OSF1+mpi: |
case OSF1+mpi: |
371 |
|
echo "Configuring for DEC Alpha with MPI" |
372 |
|
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
373 |
|
case OSF1: |
374 |
echo "Configuring for DEC Alpha" |
echo "Configuring for DEC Alpha" |
375 |
set CPP = ( '/usr/bin/cpp -P' ) |
set CPP = ( '/usr/bin/cpp -P' ) |
376 |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) |
377 |
set KPP = ( 'kapf' ) |
set KPP = ( ) |
378 |
set KPPFILES = ( 'main.F' ) |
set KPPFILES = ( ) |
379 |
set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) |
set KFLAGS1 = ( ) |
380 |
set FC = ( 'f77' ) |
set FC = ( 'f77' ) |
381 |
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' ) |
382 |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
set FOPTIM = ( '-O5 -fast -tune host -inline all' ) |
383 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
|
set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) |
|
384 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
385 |
set RMFILES = ( '*.p.out' ) |
set RMFILES = ( '*.p.out' ) |
386 |
breaksw |
breaksw |
398 |
echo "Configuring for SGI Mips" |
echo "Configuring for SGI Mips" |
399 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
400 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
401 |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' ) |
402 |
set FOPTIM = ( '-O3' ) |
set FOPTIM = ( '-O3' ) |
403 |
# set NOOPTFLAGS = ( '-O0' ) |
# set NOOPTFLAGS = ( '-O0' ) |
404 |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
446 |
case SunOS: |
case SunOS: |
447 |
set LN = ( '/usr/bin/ln -s' ) |
set LN = ( '/usr/bin/ln -s' ) |
448 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
449 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend ) |
450 |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
451 |
set FOPTIM = ( '-fast -O3' ) |
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
452 |
set NOOPTFLAGS = ( '-O0' ) |
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
453 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') |
set CFLAGS = ( '-dalign -O3 -xarch=v9' ) |
454 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
455 |
|
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 ') |
456 |
breaksw |
breaksw |
457 |
case SunOS+mpi: |
case SunOS+mpi: |
458 |
set LN = ( '/usr/bin/ln -s' ) |
set LN = ( '/usr/bin/ln -s' ) |
459 |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
set CPP = ( '/usr/ccs/lib/cpp -P' ) |
460 |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' ) |
461 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') |
|
|
set FOPTIM = ( '-fast -O3' ) |
|
|
set NOOPTFLAGS = ( '-O0' ) |
|
462 |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ |
463 |
|
set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) |
464 |
|
set FOPTIM = ( '-dalign -O3 -xarch=v9' ) |
465 |
|
set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) |
466 |
'-lsocket -lnsl' ) |
'-lsocket -lnsl' ) |
467 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F') |
468 |
breaksw |
breaksw |
469 |
case IRIX32: |
case IRIX32: |
470 |
echo "Configuring for SGI ONYX running IRIX64" |
echo "Configuring for SGI ONYX running IRIX64" |
492 |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
set NOOPTFILES = ( 'barrier.F different_multiple.F' \ |
493 |
'external_fields_load.F' ) |
'external_fields_load.F' ) |
494 |
breaksw |
breaksw |
495 |
case Linux+mpi: |
case Linux-alpha+mpi: |
496 |
|
echo "Configuring with MPI" |
497 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
498 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
499 |
case Linux: |
case Linux-alpha: |
500 |
|
echo "Configuring for " $platform |
501 |
set LN = ( '/bin/ln -s' ) |
set LN = ( '/bin/ln -s' ) |
502 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
503 |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
504 |
set FC = ( 'g77' ) |
set FC = ( 'g77' ) |
505 |
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
set FFLAGS = ( ' ' ) |
506 |
set FOPTIM = ( '-O3 -malign-double -funroll-loops ' ) |
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
507 |
|
set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' ) |
508 |
set LINK = ( 'g77' ) |
set LINK = ( 'g77' ) |
509 |
breaksw |
breaksw |
510 |
case Linux+pgi+mpi: |
case Linux*+pgi+mpi: |
511 |
if ($?include_jam_libs) then |
if ($?include_jam_libs) then |
512 |
set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' ) |
set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' ) |
513 |
set LIBS = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' ) |
514 |
else |
else |
515 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
516 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
517 |
endif |
endif |
518 |
case Linux+pgi: |
case Linux*+pgi: |
519 |
|
echo "Configuring for " $platform |
520 |
set LN = ( '/bin/ln -s' ) |
set LN = ( '/bin/ln -s' ) |
521 |
set CPP = ( '/lib/cpp -traditional -P' ) |
set CPP = ( '/lib/cpp -traditional -P' ) |
522 |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
525 |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
526 |
set LINK = ( 'pgf77' ) |
set LINK = ( 'pgf77' ) |
527 |
breaksw |
breaksw |
528 |
|
case Linux*+mpi: |
529 |
|
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
530 |
|
set INCLUDES = ( '-I/usr/local/include' ) |
531 |
|
case Linux*: |
532 |
|
echo "Configuring for " $platform |
533 |
|
set LN = ( '/bin/ln -s' ) |
534 |
|
set CPP = ( '/lib/cpp -traditional -P' ) |
535 |
|
switch ($FC) |
536 |
|
case g77: |
537 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
538 |
|
set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) |
539 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) |
540 |
|
set FOPTIM = ( '-O3 -malign-double -funroll-loops' ) |
541 |
|
breaksw |
542 |
|
case pgf77: |
543 |
|
set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) |
544 |
|
set FC = ( 'pgf77' ) |
545 |
|
set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) |
546 |
|
set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) |
547 |
|
breaksw |
548 |
|
case ifc: |
549 |
|
set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) |
550 |
|
set FFLAGS = ( '-132 -r8 -i4 -w95 -W0 -WB' ) |
551 |
|
if ($?IEEE) set FFLAGS = ( $FFLAGS '-mp' ) |
552 |
|
set FOPTIM = ( '-O3 -align' ) |
553 |
|
#P3 set FOPTIM = ( $FOPTIM '-tpp6 -xWKM' ) |
554 |
|
#P4 set FOPTIM = ( $FOPTIM '-tpp7 -xWKM' ) |
555 |
|
set LIBS = ( '-lPEPCF90' ) |
556 |
|
breaksw |
557 |
|
default: |
558 |
|
echo Error: Linux compiler not recognized: \$FC=$FC |
559 |
|
exit |
560 |
|
breaksw |
561 |
|
endsw |
562 |
|
breaksw |
563 |
case T3E: |
case T3E: |
564 |
case sn6312: |
case sn6312: |
565 |
|
echo "Configuring for T3E" |
566 |
set CPP = ( '/opt/ctl/bin/cpp -P') |
set CPP = ( '/opt/ctl/bin/cpp -P') |
567 |
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' ) |
568 |
set FC = ( 'f90' ) |
set FC = ( 'f90' ) |
571 |
breaksw |
breaksw |
572 |
case T90: |
case T90: |
573 |
case sn7113: |
case sn7113: |
574 |
|
echo "Configuring for T90" |
575 |
set FC = ( 'f90' ) |
set FC = ( 'f90' ) |
576 |
set LINK = ( 'f90' ) |
set LINK = ( 'f90' ) |
577 |
set LN = ( '/bin/ln -s' ) |
set LN = ( '/bin/ln -s' ) |
594 |
set NOOPTFLAGS = ( '-O0' ) |
set NOOPTFLAGS = ( '-O0' ) |
595 |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') |
596 |
breaksw |
breaksw |
597 |
|
case SP3: |
598 |
|
# originally from A. Biastoch, SIO. |
599 |
|
echo "Configuring for IBM SP POWER3" |
600 |
|
set SOURCEDIRS = ( ./ $SOURCEDIRS ) |
601 |
|
set LN = ( 'ln -s' ) |
602 |
|
set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' ) |
603 |
|
set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' ) |
604 |
|
# set CPP = ( '/lib/cpp' ) |
605 |
|
set FC = ( 'mpxlf95' ) |
606 |
|
set LINK = ( 'mpxlf95' ) |
607 |
|
set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
608 |
|
'-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' ) |
609 |
|
set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
610 |
|
'-bmaxdata:0x80000000 ' ) |
611 |
|
set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \ |
612 |
|
'-bmaxdata:0x80000000' ) |
613 |
|
set LIBS = ( ' -L/usr/local/apps/mass -lmass' ) |
614 |
|
# set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
615 |
|
# set FOPTIM = ( '-O3' ) |
616 |
|
# set NOOPTFLAGS = ( '-O0' ) |
617 |
|
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
618 |
|
# 'external_fields_load.F' ) |
619 |
|
set RMFILES = ( 'rii_files' ) |
620 |
|
breaksw |
621 |
default: |
default: |
622 |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
echo "Error: platform not recognized: uname -p = " $platform$USEMPI |
623 |
exit |
exit |
642 |
echo "" >> srclinks.tmp |
echo "" >> srclinks.tmp |
643 |
echo -n 'SRCFILES = ' > srclist.inc |
echo -n 'SRCFILES = ' > srclist.inc |
644 |
echo -n 'CSRCFILES = ' > csrclist.inc |
echo -n 'CSRCFILES = ' > csrclist.inc |
645 |
#echo -n 'HEADERFILES = ' > hlist.inc |
echo -n 'HEADERFILES = ' > hlist.inc |
646 |
foreach dr ($SOURCEDIRS) |
foreach dr ($SOURCEDIRS $INCLUDEDIRS .) |
647 |
set deplist=( ) |
set deplist=( ) |
648 |
foreach srcfile (`cd $dr; ls *.[hcF]`) |
foreach srcfile (`cd $dr; ls *.[hcF]`) |
649 |
if (! -r .links.tmp/$srcfile) then |
if (! -r .links.tmp/$srcfile) then |
662 |
echo -n " " $srcfile >> csrclist.inc |
echo -n " " $srcfile >> csrclist.inc |
663 |
breaksw |
breaksw |
664 |
case h: |
case h: |
665 |
# touch .links.tmp/$srcfile |
touch .links.tmp/$srcfile |
666 |
# set deplist=($deplist $srcfile) |
set deplist=($deplist $srcfile) |
667 |
# echo ' \' >> hlist.inc |
echo ' \' >> hlist.inc |
668 |
# echo -n " " $srcfile >> hlist.inc |
echo -n " " $srcfile >> hlist.inc |
669 |
breaksw |
breaksw |
670 |
endsw |
endsw |
671 |
endif |
endif |
680 |
rm -rf .links.tmp |
rm -rf .links.tmp |
681 |
echo "" >> srclist.inc |
echo "" >> srclist.inc |
682 |
echo "" >> csrclist.inc |
echo "" >> csrclist.inc |
683 |
#echo "" >> hlist.inc |
echo "" >> hlist.inc |
684 |
|
|
685 |
set THISHOSTNAME = ( `hostname` ) |
set THISHOSTNAME = ( `hostname` ) |
686 |
set THISCWD = ( `pwd` ) |
set THISCWD = ( `pwd` ) |
709 |
# CPP : C-preprocessor command |
# CPP : C-preprocessor command |
710 |
# INCLUDES : Directories searched for header files |
# INCLUDES : Directories searched for header files |
711 |
# DEFINES : Macro definitions for CPP |
# DEFINES : Macro definitions for CPP |
712 |
|
# MAKEDEPEND : Dependency generator |
713 |
# KPP : Special preprocessor command (specific to platform) |
# KPP : Special preprocessor command (specific to platform) |
714 |
# KFLAGS : Flags for KPP |
# KFLAGS : Flags for KPP |
715 |
# FC : Fortran compiler command |
# FC : Fortran compiler command |
735 |
# extra stuff for Hyades ............................................ |
# extra stuff for Hyades ............................................ |
736 |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
737 |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
738 |
|
HYADES_DIR = /usr/local/jamlib/current/dual_proc |
739 |
WORK_DIR = \$(HYADES_DIR) |
WORK_DIR = \$(HYADES_DIR) |
740 |
DEPOSIT_DIR = linux_bin |
DEPOSIT_DIR = linux_bin |
741 |
|
|
767 |
# Unix ln (link) |
# Unix ln (link) |
768 |
LN = ${LN} |
LN = ${LN} |
769 |
# C preprocessor |
# C preprocessor |
770 |
CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP} |
CPP = cat \$< | ${S64} | ${CPP} |
771 |
|
# Dependency generator |
772 |
|
MAKEDEPEND = ${MAKEDEPEND} |
773 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
774 |
KPP = ${KPP} |
KPP = ${KPP} |
775 |
# Fortran compiler |
# Fortran compiler |
787 |
# Optim./debug for FC |
# Optim./debug for FC |
788 |
FFLAGS = ${FFLAGS} |
FFLAGS = ${FFLAGS} |
789 |
FOPTIM = ${FOPTIM} |
FOPTIM = ${FOPTIM} |
790 |
|
# Flags for CC |
791 |
|
CFLAGS = ${CFLAGS} |
792 |
# Files that should not be optimized |
# Files that should not be optimized |
793 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
794 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
799 |
|
|
800 |
cat srclist.inc >> ${mfile} |
cat srclist.inc >> ${mfile} |
801 |
cat csrclist.inc >> ${mfile} |
cat csrclist.inc >> ${mfile} |
802 |
|
cat hlist.inc >> ${mfile} |
803 |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} |
804 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} |
805 |
|
|
806 |
rm -f srclist.inc csrclist.inc flist.tmp clist.tmp |
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp |
807 |
|
|
808 |
cat >> ${mfile} <<EOF |
cat >> ${mfile} <<EOF |
809 |
|
|
815 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
816 |
depend: |
depend: |
817 |
@make links |
@make links |
818 |
makedepend -o .f \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
819 |
links: \$(SRCFILES) |
|
820 |
|
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) |
821 |
|
|
822 |
small_f: \$(F77FILES) |
small_f: \$(F77FILES) |
823 |
|
|
824 |
|
output.txt: \$(EXECUTABLE) |
825 |
|
@printf 'running ... ' |
826 |
|
@\$(EXECUTABLE) > \$@ |
827 |
|
|
828 |
clean: |
clean: |
829 |
-rm -rf *.o *.f *.p ${RMFILES} |
-rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl} |
830 |
Clean: |
Clean: |
831 |
@make clean |
@make clean |
832 |
-find . -type l -exec rm {} \; |
@make cleanlinks |
833 |
-rm -f Makefile.bak |
-rm -f Makefile.bak |
834 |
CLEAN: |
CLEAN: |
835 |
@make Clean |
@make Clean |
836 |
-find \$(ROOTDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
837 |
-find \$(ROOTDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
838 |
-rm -f \$(EXECUTABLE) |
-rm -f \$(EXECUTABLE) |
839 |
|
|
840 |
|
makefile: |
841 |
|
${0} $argv |
842 |
|
cleanlinks: |
843 |
|
-find . -type l -exec rm {} \; |
844 |
|
|
845 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .f - .o ) |
846 |
.F.f: |
.F.f: |
847 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
848 |
.f.o: |
.f.o: |
849 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
850 |
|
.c.o: |
851 |
|
\$(CC) \$(CFLAGS) -c \$< |
852 |
|
|
853 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
854 |
.F.p: |
.F.p: |