--- MITgcm/tools/genmake2 2005/02/09 17:34:19 1.118 +++ MITgcm/tools/genmake2 2005/03/09 19:57:00 1.119 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.118 2005/02/09 17:34:19 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.119 2005/03/09 19:57:00 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -122,8 +122,8 @@ stop end EOF - test -f Makefile && mv -f Makefile Makefile.bak - cat <> Makefile + test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" + cat <> $MAKEFILE .SUFFIXES: .SUFFIXES: .$tfs .F .F.$tfs: @@ -148,8 +148,8 @@ return fi fi - rm -f genmake_hello.* Makefile - test -f Makefile && mv -f Makefile.bak Makefile + rm -f genmake_hello.* $MAKEFILE + test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE # If we make it here, use the extensions FS=$tfs @@ -181,6 +181,15 @@ if test "x${MAKEDEPEND}" = x ; then which makedepend > /dev/null 2>&1 RV0=$? + test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" + # echo 'MAKEFILE="'$MAKEFILE'"' + cat <> $MAKEFILE +# THIS IS A TEST MAKEFILE GENERATED BY "genmake2" +# +# Some "makedepend" implementations will die if they cannot +# find a Makefile -- so this file is here to gives them an +# empty one to find and parse. +EOF cat <> genmake_tc.f program test write(*,*) 'test' @@ -188,6 +197,8 @@ end EOF makedepend genmake_tc.f > /dev/null 2>&1 + test -f $MAKEFILE && rm -f $MAKEFILE + test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE RV1=$? if test "x${RV0}${RV1}" = x00 ; then MAKEDEPEND=makedepend @@ -804,8 +815,8 @@ PACKAGES= ENABLE= DISABLE= -MAKEFILE= -#MAKEDEPEND= +# MAKEFILE= +# MAKEDEPEND= PDEPEND= DUMPSTATE=t PDEFAULT= @@ -1095,6 +1106,7 @@ done + if test -f ./.genmakerc ; then echo echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" @@ -1139,6 +1151,10 @@ THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` fi +if test "x$MAKEFILE" = x ; then + MAKEFILE="Makefile" +fi + echo " getting OPTFILE information: " if test "x${OPTFILE}" = x ; then if test "x$MITGCM_OF" = x ; then @@ -1168,9 +1184,6 @@ fi fi -# Check for broken systems that cannot correctly distinguish *.F and *.f files -# check_for_broken_Ff - echo " getting AD_OPTFILE information: " if test "x${AD_OPTFILE}" = x ; then if test "x$MITGCM_AD_OF" = x ; then @@ -1198,6 +1211,9 @@ fi fi +#==================================================================== +# Set default values if not set by the optfile +# # Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, # either set defaults or complain and abort! if test ! "x$BASH" = x ; then @@ -1388,9 +1404,6 @@ done echo -if test "x$MAKEFILE" = x ; then - MAKEFILE="Makefile" -fi if test "x${PLATFORM}" = x ; then PLATFORM=$p_PLATFORM fi