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 |
89 |
echo "Including paths to JAM libraries" |
echo "Including paths to JAM libraries" |
90 |
breaksw |
breaksw |
91 |
case -help: |
case -help: |
92 |
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]" |
93 |
|
cat << EOF |
94 |
|
|
95 |
|
$0 is used to generate the Makefile in the current directory. |
96 |
|
|
97 |
|
Typical invocations are: |
98 |
|
o from "bin": ../tools/genmake |
99 |
|
o from "verification/expt/code": ../../../tools/genmake |
100 |
|
o from "verification/expt/input": ../../../tools/genmake -mods=../code |
101 |
|
o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm |
102 |
|
or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods |
103 |
|
|
104 |
|
Packages (collected modules of code) can be disabled to avoid unnecessary |
105 |
|
compilation of unused code. For instance if you know you will not |
106 |
|
use GM/Redi, KPP and OBCS and they are appropriate turned-off in the |
107 |
|
configuration: |
108 |
|
.../tools/genmake -disable=gmredi,kpp,obcs |
109 |
|
|
110 |
|
If you add some source files you can re-call the previous instance of |
111 |
|
genmake with "make makefile". |
112 |
|
|
113 |
|
genmake also reads the file .genmakerc which can be used to configure |
114 |
|
options (primarily the command-line options above) for particular experiments. |
115 |
|
EOF |
116 |
exit |
exit |
117 |
breaksw |
breaksw |
118 |
default: |
default: |
136 |
set mach = ( `uname -a` ) |
set mach = ( `uname -a` ) |
137 |
echo Operating system: $mach |
echo Operating system: $mach |
138 |
|
|
|
|
|
139 |
# Directories for source, includes, binaries and executables |
# Directories for source, includes, binaries and executables |
140 |
# |
# |
141 |
# 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 |
194 |
endif |
endif |
195 |
if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv ) |
if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv ) |
196 |
|
|
197 |
|
# We have a special set of source files in eesupp/src which |
198 |
|
# are generated from some template source files. We'll make them |
199 |
|
# first so the appear as regular source code |
200 |
|
if (-r $ROOTDIR/eesupp/src/Makefile) then |
201 |
|
echo Making source files in eesupp from templates... |
202 |
|
(cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs |
203 |
|
if ($status == 0) then |
204 |
|
rm -f make_eesupp.errs |
205 |
|
else |
206 |
|
cat make_eesupp.errs |
207 |
|
exit 2 |
208 |
|
endif |
209 |
|
endif |
210 |
|
|
211 |
# Now scan the standard source code tree |
# Now scan the standard source code tree |
212 |
foreach dr ($SOURCEDIRS) |
foreach dr ($SOURCEDIRS) |
213 |
set adr=$dr |
set adr=$dr |
214 |
if (! -d $adr) then |
if (! -d $adr) then |
215 |
echo mods directory $adr not found.; exit 1 |
echo mods directory $adr not found.; exit 1 |
216 |
endif |
endif |
217 |
echo Adding mods directory $adr |
echo Adding mods dir: $adr |
218 |
end |
end |
219 |
if (! $?PACKAGES) then |
if (! $?PACKAGES) then |
220 |
set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`) |
set PACKAGES=() |
221 |
|
foreach pkg (`cd $ROOTDIR/pkg; find . -type d | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`) |
222 |
|
if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg) |
223 |
|
end |
224 |
endif |
endif |
225 |
foreach dr ($PACKAGES) |
foreach dr ($PACKAGES) |
226 |
set enable |
set enable |
231 |
endif |
endif |
232 |
if ($dr == $p) unset enable |
if ($dr == $p) unset enable |
233 |
if ($p == 'all') unset enable |
if ($p == 'all') unset enable |
234 |
|
# The following allows entire trees to be disabled |
235 |
|
if ($dr:h == $p) unset enable |
236 |
|
if ($dr:h:h == $p) unset enable |
237 |
|
if ($dr:h:h:h == $p) unset enable |
238 |
|
if ($dr:h:h:h:h == $p) unset enable |
239 |
end |
end |
240 |
foreach p ($ENABLE) |
foreach p ($ENABLE) |
241 |
if ($dr == $p) set enable |
if ($dr == $p) set enable |
245 |
if (! -d $adr) then |
if (! -d $adr) then |
246 |
echo Source directory $adr not found.; exit 1 |
echo Source directory $adr not found.; exit 1 |
247 |
endif |
endif |
248 |
echo Adding package directory $adr |
echo Adding pkg dir: $adr |
249 |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
250 |
set INCLUDEDIRS = ($INCLUDEDIRS $adr) |
set INCLUDEDIRS = ($INCLUDEDIRS $adr) |
251 |
else |
else |
252 |
echo "*" Package \"$dr\" has not been enabled. |
echo " *" Package \"$dr\" NOT enabled. |
253 |
endif |
endif |
254 |
end |
end |
255 |
if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model) |
if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model) |
258 |
if (! -d $adr) then |
if (! -d $adr) then |
259 |
echo Source directory $adr not found.; exit 1 |
echo Source directory $adr not found.; exit 1 |
260 |
endif |
endif |
261 |
echo Adding source directory $adr |
echo Adding src dir: $adr |
262 |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
set SOURCEDIRS = ($SOURCEDIRS $adr) |
263 |
set idr = `echo $adr | sed 's/src/inc/'` |
set idr = `echo $adr | sed 's/src/inc/'` |
264 |
set INCLUDEDIRS = ($INCLUDEDIRS $idr) |
set INCLUDEDIRS = ($INCLUDEDIRS $idr) |
324 |
echo "Configuring for SGI Mips" |
echo "Configuring for SGI Mips" |
325 |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) |
326 |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
set INCLUDES = ( '-I/usr/local/mpi/include' ) |
327 |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) |
set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' ) |
328 |
set FOPTIM = ( '-O3' ) |
set FOPTIM = ( '-O3' ) |
329 |
# set NOOPTFLAGS = ( '-O0' ) |
# set NOOPTFLAGS = ( '-O0' ) |
330 |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
# set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ |
430 |
breaksw |
breaksw |
431 |
case Linux+pgi+mpi: |
case Linux+pgi+mpi: |
432 |
if ($?include_jam_libs) then |
if ($?include_jam_libs) then |
433 |
set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' ) |
set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' ) |
434 |
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' ) |
435 |
else |
else |
436 |
set INCLUDES = ( '-I/usr/local/include' ) |
set INCLUDES = ( '-I/usr/local/include' ) |
437 |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) |
593 |
# extra stuff for Hyades ............................................ |
# extra stuff for Hyades ............................................ |
594 |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
HYADES_DIR = /u/u0/cnh/jam-lib/software |
595 |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
HYADES_DIR = /u/u0/cnh/jam-lib-twoproc |
596 |
|
HYADES_DIR = /usr/local/jamlib/current/dual_proc |
597 |
WORK_DIR = \$(HYADES_DIR) |
WORK_DIR = \$(HYADES_DIR) |
598 |
DEPOSIT_DIR = linux_bin |
DEPOSIT_DIR = linux_bin |
599 |
|
|