--- MITgcm/tools/genmake2 2003/09/05 00:25:42 1.6 +++ MITgcm/tools/genmake2 2003/09/26 18:47:59 1.10 @@ -1,6 +1,6 @@ #!/bin/bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.6 2003/09/05 00:25:42 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.10 2003/09/26 18:47:59 adcroft Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -203,6 +203,9 @@ THISCWD=`pwd` THISDATE=`date` MACHINE=`uname -a` +EXECUTABLE= +EXEHOOK= +EXEDIR= # The following state can be set directly by command-line switches gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT" @@ -212,8 +215,9 @@ gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" +gm_s6="EXECUTABLE EXEHOOK EXEDIR" -gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5" +gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6" echo @@ -385,6 +389,41 @@ fi fi +# Check that FC, LINK, CPP, and S64 are defined. If not, complain +# and abort! +if test "x$FC" = x ; then + cat <&2 + +Error: no Fortran compiler: please specify using one of the following: + 1) within the options file ("FC=...") as specified by "-of=OPTFILE" + 2) the "-fc=XXX" command-line option + 3) the "./gm_local" file +EOF + exit 1 +fi +if test "x$LINK" = x ; then + LINK=$FC +fi +if test "x$CPP" = x ; then + cat <&2 + +Error: no C pre-processor: please specify using one of the following: + 1) within the options file ("CPP=...") as specified by "-of=OPTFILE" + 2) the "./gm_local" file +EOF + exit 1 +fi +if test "x$S64" = x ; then + cat <&2 + +Error: no C pre-processor: please specify using one of the following: + 1) within the options file ("S64=...") as specified by "-of=OPTFILE" + 2) the "./gm_local" file +EOF + exit 1 +fi + + printf "\n=== Setting defaults ===\n" echo -n " Adding MODS directories: " for d in $MODS ; do @@ -657,9 +696,9 @@ # done # echo -echo " Setting package-specific CPP flags in CPP_OPTIONS.h:" +echo " Searching for CPP_OPTIONS.h (macros and flags for configuring the model):" CPP_OPTIONS= -spaths="$SOURCEDIRS" +spaths="$MODS ./ $SOURCEDIRS" for i in $spaths ; do try="$i/CPP_OPTIONS.h" # echo -n " trying $try : " @@ -794,7 +833,7 @@ echo -n 'CSRCFILES = ' > csrclist.inc echo -n 'F90SRCFILES = ' > f90srclist.inc echo -n 'HEADERFILES = ' > hlist.inc -alldirs=". $SOURCEDIRS $INCLUDEDIRS" +alldirs="$SOURCEDIRS $INCLUDEDIRS ." for d in $alldirs ; do deplist= sfiles=`( cd $d; echo *.[h,c,F] )` @@ -945,7 +984,7 @@ depend: @make links \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) - ../../../tools/f90mkdepend >> \$(MAKEFILE) + ${TOOLSDIR}/f90mkdepend >> \$(MAKEFILE) links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) @@ -993,6 +1032,10 @@ EOF +if test "x$EXEHOOK" != x ; then + printf "\nexehook:\n\t%s\n" $EXEHOOK >> $MAKEFILE +fi + echo " Making list of \"exceptions\" that need \".p\" files" for i in $KPPFILES ; do base=`echo $i | sed -e 's/\/.*\///g' | sed -e 's/\..*$//g'`