--- MITgcm/tools/genmake2 2006/07/14 16:39:39 1.153 +++ MITgcm/tools/genmake2 2006/12/13 02:24:53 1.159 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.153 2006/07/14 16:39:39 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.159 2006/12/13 02:24:53 cnh Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -325,7 +325,7 @@ #================================================================ # look for possible C compilers - tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" + tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" p_CC= for c in $tmp ; do rm -f ./genmake_hello.c ./genmake_hello @@ -364,7 +364,7 @@ #================================================================ # look for possible FORTRAN compilers - tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran" + tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95" p_FC= for c in $tmp ; do rm -f ./hello.f ./hello @@ -946,7 +946,7 @@ RET_CPP=f COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES" echo "$COMM" >> genmake_tnc.log - $COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t + eval $COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t if test "x$RET_CPP" = xf ; then echo " WARNING: CPP failed to pre-process the netcdf test." \ >> genmake_tnc.log @@ -1352,7 +1352,7 @@ # Find the MITgcm ${ROOTDIR} if test "x${ROOTDIR}" = x ; then tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` - if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then + if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesupp -a -d ../pkg ; then ROOTDIR=".." else for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do @@ -1818,19 +1818,21 @@ fi fi -#same for exch2 -if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then - echo " Making source files in exch2 from templates" - ( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1 - RETVAL=$? - if test "x${RETVAL}" = x0 ; then - rm -f make_exch2.errors - else - echo "Error: problem encountered while building source files in exch2:" - cat make_exch2.errors 1>&2 - exit 1 +#same for pkg/exch2 and pkg/regrid +for pdir in exch2 regrid ; do + if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then + echo " Making source files in pkg/${pdir} from templates" + ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE ) > make_${pdir}.errors 2>&1 + RETVAL=$? + if test "x${RETVAL}" = x0 ; then + rm -f make_${pdir}.errors + else + echo "Error: problem encountered while building source files in pkg/${pdir}:" + cat make_${pdir}.errors 1>&2 + exit 1 + fi fi -fi +done printf "\n=== Determining package settings ===\n" if test "x${PDEPEND}" = x ; then @@ -2205,7 +2207,7 @@ perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h else echo " We cannot create a copy of mpif.h!" - exit -1 +# exit -1 fi fi @@ -2456,6 +2458,7 @@ libmitgcmuv.a: \$(OBJFILES) ar rcv libmitgcmuv.a \$(OBJFILES) + ar d libmitgcmuv.a main.o links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) @@ -2466,7 +2469,9 @@ @\$(EXECUTABLE) > \$@ clean: - -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template + -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template + -rm -rf *.o + -rm -rf *.$FS Clean: @make clean @make cleanlinks @@ -2536,9 +2541,7 @@ \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ .$FS.o: \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< -.F90.$FS90: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ -.$FS90.o: +.F90.o: \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< .c.o: \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<