--- MITgcm/tools/genmake2 2004/01/15 04:27:39 1.61 +++ MITgcm/tools/genmake2 2004/01/23 16:12:45 1.63 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.61 2004/01/15 04:27:39 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.63 2004/01/23 16:12:45 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -834,12 +834,21 @@ if test "x$LINK" = x ; then LINK=$FC fi -if test "x$CPP" = x ; then - CPP="cpp" -fi if test "x$MAKE" = x ; then MAKE="make" fi +if test "x$CPP" = x ; then + CPP=cpp +fi +#EH3 === UGLY === +# The following an ugly little hack to check for $CPP in /lib/ and it +# should eventually be replaced with a more general function that +# searches a combo of the user's path and a list of "usual suspects" +# to find the correct location for binaries such as $CPP. +for i in " " "/lib/" ; do + echo "#define A a" | $i$CPP > test_cpp 2>&1 && CPP=$i$CPP +done +#EH3 === UGLY === echo "#define A a" | $CPP > test_cpp 2>&1 RETVAL=$? if test "x$RETVAL" != x0 ; then @@ -994,7 +1003,7 @@ rm -f make_eesupp.errors else echo "Error: problem encountered while building source files in eesupp:" - cat make_eesupp.errors + cat make_eesupp.errors 1>&2 exit 1 fi fi @@ -1008,7 +1017,7 @@ rm -f make_exch2.errors else echo "Error: problem encountered while building source files in exch2:" - cat make_exch2.errors + cat make_exch2.errors 1>&2 exit 1 fi fi @@ -1196,11 +1205,21 @@ fi done -# Check for ability to build and use NetCDF +# 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 -a "x$HAVE_NETCDF" != xt ; then - cat < 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 -a "x$HAVE_NETCDF" != xt ; then + cat <