124 |
EOF |
EOF |
125 |
test -f Makefile && mv -f Makefile Makefile.bak |
test -f Makefile && mv -f Makefile Makefile.bak |
126 |
cat <<EOF >> Makefile |
cat <<EOF >> Makefile |
|
%.$tfs : %.F |
|
127 |
.SUFFIXES: |
.SUFFIXES: |
128 |
genmake_hello.$tfs: genmake_hello.F |
.SUFFIXES: .$tfs .F |
129 |
$LN genmake_hello.F genmake_hello.$tfs |
.F.$tfs: |
130 |
|
$LN \$< \$@ |
131 |
EOF |
EOF |
132 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
133 |
RETVAL=$? |
RETVAL=$? |
693 |
#echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.f" |
#echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.f" |
694 |
#echo "$LINK -o genmake_tnc.o $LIBS" |
#echo "$LINK -o genmake_tnc.o $LIBS" |
695 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
696 |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1 \ |
697 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
698 |
RET_COMPILE=$? |
RET_COMPILE=$? |
699 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
|
700 |
RETVAL=$? |
#EH3 Remove test program execution for machines that either disallow |
701 |
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
#EH3 execution or cannot support it (eg. cross-compilers) |
702 |
|
#EH3 |
703 |
|
#EH3 test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
704 |
|
#EH3 RETVAL=$? |
705 |
|
#EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
706 |
|
|
707 |
|
if test "x$RET_COMPILE" = x0 ; then |
708 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
709 |
else |
else |
710 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
711 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
712 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1 \ |
713 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
714 |
RET_COMPILE=$? |
RET_COMPILE=$? |
715 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
if test "x$RET_COMPILE" = x0 ; then |
|
RETVAL=$? |
|
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
|
716 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
717 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
718 |
else |
else |
1490 |
rm -f ./.tmp_pack |
rm -f ./.tmp_pack |
1491 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1492 |
|
|
1493 |
|
# Check availability of NetCDF and then either build the MNC template |
1494 |
|
# files or delete mnc from the list of available packages. |
1495 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1496 |
|
RETVAL=$? |
1497 |
|
if test "x$RETVAL" = x0 ; then |
1498 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1499 |
|
cat <<EOF |
1500 |
|
|
1501 |
|
********************************************************************* |
1502 |
|
WARNING: the "mnc" package was enabled but tests failed to compile |
1503 |
|
NetCDF applications. Please check that: |
1504 |
|
|
1505 |
|
1) NetCDF is correctly installed for this compiler and |
1506 |
|
2) the LIBS variable (within the "optfile") specifies the correct |
1507 |
|
NetCDF library to link against. |
1508 |
|
|
1509 |
|
Due to this failure, the "mnc" package is now DISABLED. |
1510 |
|
********************************************************************* |
1511 |
|
|
1512 |
|
EOF |
1513 |
|
PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'` |
1514 |
|
DISABLE="$DISABLE mnc" |
1515 |
|
else |
1516 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1 |
1517 |
|
RETVAL=$? |
1518 |
|
if test "x${RETVAL}" = x0 ; then |
1519 |
|
rm -f make_mnc.errors |
1520 |
|
else |
1521 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1522 |
|
cat make_mnc.errors 1>&2 |
1523 |
|
exit 1 |
1524 |
|
fi |
1525 |
|
fi |
1526 |
|
fi |
1527 |
|
|
1528 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1529 |
ck= |
ck= |
1530 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
1609 |
fi |
fi |
1610 |
done |
done |
1611 |
|
|
|
# Build MNC templates and check for ability to build and use NetCDF |
|
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" = x0 ; then |
|
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1 |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
rm -f make_mnc.errors |
|
|
else |
|
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
|
|
cat make_mnc.errors 1>&2 |
|
|
exit 1 |
|
|
fi |
|
|
if test "x$HAVE_NETCDF" != xt ; then |
|
|
cat <<EOF |
|
|
|
|
|
WARNING: the "mnc" package has been enabled but tests failed to |
|
|
compile and/or execute NetCDF applications. Please check that: |
|
|
|
|
|
1) NetCDF is installed for your compiler and |
|
|
2) the LIBS variable (within the 'optfile") specifies the correct |
|
|
NetCDF library to link against. |
|
|
|
|
|
EOF |
|
|
fi |
|
|
fi |
|
|
|
|
1612 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
1613 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
1614 |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
1755 |
;; |
;; |
1756 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
1757 |
;; |
;; |
1758 |
|
./BUILD_INFO.h) |
1759 |
|
;; |
1760 |
*) |
*) |
1761 |
touch .links.tmp/$sf |
touch .links.tmp/$sf |
1762 |
deplist="$deplist $sf" |
deplist="$deplist $sf" |
1987 |
|
|
1988 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
1989 |
|
|
1990 |
%.o : %.F |
## This nullifies any default implicit rules concerning these two file types: |
1991 |
|
## %.o : %.F |
1992 |
|
|
1993 |
.F.$FS: |
.F.$FS: |
1994 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |