248 |
fi |
fi |
249 |
} |
} |
250 |
|
|
251 |
|
|
252 |
|
build_embed_encode() |
253 |
|
{ |
254 |
|
printf " building the embed-encode utility... " |
255 |
|
if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then |
256 |
|
if test ! -d "$ROOTDIR/tools/embed_encode" ; then |
257 |
|
echo |
258 |
|
echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" |
259 |
|
echo |
260 |
|
EMBED_SRC=f |
261 |
|
return 1 |
262 |
|
fi |
263 |
|
clist="cc gcc c89 $CC" |
264 |
|
for ic in $clist ; do |
265 |
|
comm="$ic -o encode_files encode_files.c" |
266 |
|
( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1 |
267 |
|
RETVAL=$? |
268 |
|
if test "x$RETVAL" = x0 ; then |
269 |
|
echo "OK" |
270 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
271 |
|
return 0 |
272 |
|
fi |
273 |
|
done |
274 |
|
echo |
275 |
|
echo " Error: unable to build $ROOTDIR/embed_encode/encode_files" |
276 |
|
echo " so it has been disabled" |
277 |
|
echo |
278 |
|
EMBED_SRC=f |
279 |
|
return 1 |
280 |
|
fi |
281 |
|
echo "OK" |
282 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
# Guess possible config options for this host |
# Guess possible config options for this host |
287 |
find_possible_configs() { |
find_possible_configs() { |
288 |
|
|
570 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
571 |
is being used. |
is being used. |
572 |
|
|
573 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time |
574 |
|
Ignore all the "wall clock" routines entirely. This will |
575 |
|
not in any way hurt the model results -- it simply means |
576 |
|
that the code that checks how long the model spends in |
577 |
|
various routines will give junk values. |
578 |
|
|
579 |
-ts | --ts |
-ts | --ts |
580 |
Produce timing information per timestep |
Produce timing information per timestep |
581 |
-papis | --papis |
-papis | --papis |
597 |
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
598 |
from \$PATH/lib and use binaries from \$PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
599 |
|
|
600 |
|
-es | --es | -embed-source | --embed-source |
601 |
|
Embed a tarball containing the full source code |
602 |
|
(including the Makefile, etc.) used to build the |
603 |
|
executable [off by default] |
604 |
|
|
605 |
-bash NAME |
-bash NAME |
606 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
607 |
|
|
1036 |
PWD=`pwd` |
PWD=`pwd` |
1037 |
test "x$MAKE" = x && MAKE=make |
test "x$MAKE" = x && MAKE=make |
1038 |
test "x$AWK" = x && AWK=awk |
test "x$AWK" = x && AWK=awk |
1039 |
|
EMBED_SRC= |
1040 |
THISHOST=`hostname` |
THISHOST=`hostname` |
1041 |
THISCWD=`pwd` |
THISCWD=`pwd` |
1042 |
THISDATE=`date` |
THISDATE=`date` |
1291 |
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1292 |
IGNORE_TIME="-DIGNORE_TIME" ;; |
IGNORE_TIME="-DIGNORE_TIME" ;; |
1293 |
|
|
1294 |
|
-es | --es | -embed-source | --embed-source) |
1295 |
|
EMBED_SRC=t ;; |
1296 |
|
|
1297 |
-*) |
-*) |
1298 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1299 |
usage |
usage |
1626 |
echo "yes" |
echo "yes" |
1627 |
else |
else |
1628 |
echo "no" |
echo "no" |
1629 |
|
if test "x$EMBED_SRC" = xt ; then |
1630 |
|
echo " WARNING: you requested file embedding but it has" |
1631 |
|
echo " been disabled since C code cannot be called" |
1632 |
|
EMBED_SRC= |
1633 |
|
fi |
1634 |
fi |
fi |
1635 |
rm -f genmake_t* |
rm -f genmake_t* |
1636 |
|
|
1670 |
fi |
fi |
1671 |
DEFINES="$DEFINES $IGNORE_TIME" |
DEFINES="$DEFINES $IGNORE_TIME" |
1672 |
|
|
1673 |
|
if test "x$EMBED_SRC" = xt ; then |
1674 |
|
build_embed_encode |
1675 |
|
fi |
1676 |
|
if test "x$EMBED_SRC" = xt ; then |
1677 |
|
ENABLE="$ENABLE embed_files" |
1678 |
|
fi |
1679 |
|
|
1680 |
|
|
1681 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1682 |
printf " Adding MODS directories: " |
printf " Adding MODS directories: " |
1683 |
for d in $MODS ; do |
for d in $MODS ; do |
2157 |
echo " Determining the list of source and include files" |
echo " Determining the list of source and include files" |
2158 |
rm -rf .links.tmp |
rm -rf .links.tmp |
2159 |
mkdir .links.tmp |
mkdir .links.tmp |
2160 |
|
touch .links.tmp/foo |
2161 |
|
if test ! -r ".links.tmp/foo" ; then |
2162 |
|
echo |
2163 |
|
echo "ERROR : something is wrong with your directory permissions or" |
2164 |
|
echo " your user file-creation mask (\"umask\") since creating a" |
2165 |
|
echo " sub-dir, touch-ing a file within it, and then reading it is" |
2166 |
|
echo " not working. Please try setting your umask to something" |
2167 |
|
echo " sane such as:" |
2168 |
|
echo |
2169 |
|
echo " umask 0002" |
2170 |
|
echo |
2171 |
|
echo " and please verify that you have the proper permissions for" |
2172 |
|
echo " creating sub-directories and then reading files created" |
2173 |
|
echo " within them." |
2174 |
|
echo |
2175 |
|
exit 1 |
2176 |
|
fi |
2177 |
|
rm -f .links.tmp/foo |
2178 |
echo "# This section creates symbolic links" > srclinks.tmp |
echo "# This section creates symbolic links" > srclinks.tmp |
2179 |
echo "" >> srclinks.tmp |
echo "" >> srclinks.tmp |
2180 |
printf 'SRCFILES = ' > srclist.inc |
printf 'SRCFILES = ' > srclist.inc |
2193 |
ignore_f=f |
ignore_f=f |
2194 |
case $d/$sf in |
case $d/$sf in |
2195 |
./$PACKAGES_DOT_H) |
./$PACKAGES_DOT_H) |
2196 |
|
ignore_f=t |
2197 |
;; |
;; |
2198 |
./AD_CONFIG.h) |
./AD_CONFIG.h) |
2199 |
|
ignore_f=t |
2200 |
;; |
;; |
2201 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
2202 |
|
ignore_f=t |
2203 |
;; |
;; |
2204 |
./BUILD_INFO.h) |
./BUILD_INFO.h) |
2205 |
|
ignore_f=t |
2206 |
|
;; |
2207 |
|
./EMBEDDED_FILES.h) |
2208 |
|
ignore_f=t |
2209 |
;; |
;; |
2210 |
*) |
*) |
2211 |
# For the local directory *ONLY*, |
# For the local directory *ONLY*, |
2318 |
|
|
2319 |
# These files are created by Makefile |
# These files are created by Makefile |
2320 |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h |
|
|
|
2321 |
EOF |
EOF |
2322 |
|
|
2323 |
# Note: figure out some way to add Hyades JAM libraries here |
if test "x$EMBED_SRC" = xt ; then |
2324 |
|
echo "EMBEDDED_FILES = EMBEDDED_FILES.h" >>$MAKEFILE |
2325 |
|
else |
2326 |
|
echo "EMBEDDED_FILES = " >>$MAKEFILE |
2327 |
|
fi |
2328 |
|
|
2329 |
|
# Note: figure out some way to add Hyades JAM libraries here |
2330 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2331 |
# Unix ln (link) |
# Unix ln (link) |
2332 |
LN = ${LN} |
LN = ${LN} |
2388 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2389 |
|
|
2390 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
2391 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES) |
2392 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2393 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
2394 |
depend: |
depend: |
2422 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2423 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2424 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
2425 |
-rm -f \$(EXECUTABLE) output.txt STD* |
-rm -f \$(EXECUTABLE) *.txt STD* *diagnostics.log datetime |
2426 |
|
-rm -rf mnc_test_* |
2427 |
|
|
2428 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
2429 |
makefile: |
makefile: |
2451 |
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2452 |
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2453 |
|
|
2454 |
|
if test "x$EMBED_SRC" = xt ; then |
2455 |
|
cat >>$MAKEFILE <<EOF |
2456 |
|
|
2457 |
|
decode_files.o : EMBEDDED_FILES.h |
2458 |
|
|
2459 |
|
## \$(F77FILES) |
2460 |
|
all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2461 |
|
@echo Creating \$@ ... |
2462 |
|
-tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2463 |
|
-rm -f all_fF.tar.gz |
2464 |
|
-gzip all_fF.tar |
2465 |
|
|
2466 |
|
EMBEDDED_FILES.h : all_fF.tar.gz |
2467 |
|
@echo Creating \$@ ... |
2468 |
|
-\${ROOTDIR}/tools/embed_encode/encode_files EMBEDDED_FILES.h all_fF.tar.gz |
2469 |
|
|
2470 |
|
EOF |
2471 |
|
fi |
2472 |
|
|
2473 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2474 |
|
|
2475 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |