1 |
#! /usr/bin/env bash |
#! /usr/bin/env sh |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
# |
# |
158 |
} |
} |
159 |
|
|
160 |
|
|
161 |
# Guess possible config options for this host |
look_for_makedepend() { |
|
find_possible_configs() { |
|
|
|
|
|
tmp1=`uname`"_"`uname -m` |
|
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
|
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
|
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
|
|
PLATFORM=$tmp3 |
|
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
|
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
|
|
echo " The platform appears to be: $PLATFORM" |
|
|
|
|
|
echo "test" > test |
|
|
ln -s ./test link |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
LN="ln -s" |
|
|
else |
|
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
|
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
|
|
exit 1 |
|
|
fi |
|
|
rm -f test link |
|
|
|
|
|
if test "x$CPP" = x ; then |
|
|
CPP="cpp -traditional -P" |
|
|
fi |
|
162 |
|
|
163 |
# The "original" makedepend is part of the Imake system that is |
# The "original" makedepend is part of the Imake system that is |
164 |
# most often distributed with XFree86 or with an XFree86 source |
# most often distributed with XFree86 or with an XFree86 source |
214 |
rm -f ./genmake_cy_md |
rm -f ./genmake_cy_md |
215 |
fi |
fi |
216 |
fi |
fi |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
|
# Guess possible config options for this host |
221 |
|
find_possible_configs() { |
222 |
|
|
223 |
|
tmp1=`uname`"_"`uname -m` |
224 |
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
225 |
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
226 |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
227 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
228 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
229 |
|
PLATFORM=$tmp3 |
230 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
231 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
232 |
|
echo " The platform appears to be: $PLATFORM" |
233 |
|
|
234 |
|
echo "test" > test |
235 |
|
ln -s ./test link |
236 |
|
RETVAL=$? |
237 |
|
if test "x${RETVAL}" = x0 ; then |
238 |
|
LN="ln -s" |
239 |
|
else |
240 |
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
241 |
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
242 |
|
exit 1 |
243 |
|
fi |
244 |
|
rm -f test link |
245 |
|
|
246 |
|
if test "x$CPP" = x ; then |
247 |
|
CPP="cpp -traditional -P" |
248 |
|
fi |
249 |
|
|
250 |
|
look_for_makedepend |
251 |
|
|
252 |
# look for possible fortran compilers |
# look for possible fortran compilers |
253 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
377 |
-help | --help | -h | --h |
-help | --help | -h | --h |
378 |
Print this help message and exit. |
Print this help message and exit. |
379 |
|
|
380 |
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
381 |
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
382 |
|
Use "NAME" as the adoptfile. By default, the file at |
383 |
|
"tools/adjoint_options/adjoint_default" will be used. |
384 |
|
|
385 |
-nooptfile | --nooptfile |
-nooptfile | --nooptfile |
386 |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
387 |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
688 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
689 |
HAVE_CLOC= |
HAVE_CLOC= |
690 |
HAVE_NETCDF= |
HAVE_NETCDF= |
691 |
|
HAVE_ETIME= |
692 |
|
|
693 |
MODS= |
MODS= |
694 |
TOOLSDIR= |
TOOLSDIR= |
739 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
740 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
741 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
742 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
743 |
|
|
744 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
745 |
gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
1091 |
else |
else |
1092 |
rm -f test_cpp |
rm -f test_cpp |
1093 |
fi |
fi |
1094 |
if test "x$MAKEDEPEND" = x ; then |
look_for_makedepend |
|
MAKEDEPEND=makedepend |
|
|
fi |
|
1095 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1096 |
LN="ln -s" |
LN="ln -s" |
1097 |
fi |
fi |
1157 |
fi |
fi |
1158 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1159 |
|
|
1160 |
|
printf " Do we have the etime() command using $FC... " |
1161 |
|
cat > genmake_tcomp.f <<EOF |
1162 |
|
program hello |
1163 |
|
REAL*4 ACTUAL, TARRAY(2) |
1164 |
|
EXTERNAL ETIME |
1165 |
|
REAL*4 ETIME |
1166 |
|
actual = etime( tarray ) |
1167 |
|
print *, tarray |
1168 |
|
end |
1169 |
|
EOF |
1170 |
|
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
1171 |
|
RETVAL=$? |
1172 |
|
if test "x$RETVAL" = x0 ; then |
1173 |
|
HAVE_ETIME=t |
1174 |
|
DEFINES="$DEFINES -DHAVE_ETIME" |
1175 |
|
echo "yes" |
1176 |
|
else |
1177 |
|
HAVE_ETIME= |
1178 |
|
echo "no" |
1179 |
|
fi |
1180 |
|
rm -f genmake_tcomp* |
1181 |
|
|
1182 |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
1183 |
check_HAVE_CLOC |
check_HAVE_CLOC |
1184 |
if test "x$HAVE_CLOC" != x ; then |
if test "x$HAVE_CLOC" != x ; then |
1801 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
1802 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1803 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |
1804 |
echo '.SUFFIXES: .o .F .p .'$FS' .c .F90 .'$FS90 >> $MAKEFILE |
echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE |
1805 |
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc |
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc |
1806 |
rm -f ad_flow_files.inc |
rm -f ad_flow_files.inc |
1807 |
|
|
1837 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1838 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
1839 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
1840 |
-rm -f \$(EXECUTABLE) output.txt |
-rm -f \$(EXECUTABLE) output.txt STD* |
1841 |
|
|
1842 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
1843 |
makefile: |
makefile: |