--- MITgcm/tools/genmake 2001/02/07 16:49:20 1.28 +++ MITgcm/tools/genmake 2001/03/05 19:57:31 1.32 @@ -1,6 +1,6 @@ #!/bin/csh -f # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/Attic/genmake,v 1.28 2001/02/07 16:49:20 adcroft Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/Attic/genmake,v 1.32 2001/03/05 19:57:31 adcroft Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -50,7 +50,6 @@ echo "***" Command line \"$arg\" will override this. endif set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `) - if (! $?EXEDIR) set EXEDIR = ( . ) breaksw case -mods: case -mods=: @@ -120,14 +119,8 @@ # but if it was supplied then we should place the executable in the build dir if (! $?ROOTDIR) then set pwd=`pwd` - if ($pwd:t == bin) then - if (-d ../exe & -d ../model & -d ../eesupp & -d ../pkg) then - set ROOTDIR = ( .. ) - if (! $?EXEDIR) set EXEDIR = ( ../exe ) - else if (-d ../model & -d ../eesupp & -d ../pkg) then - echo In bin with no exe - if (! $?EXEDIR) set EXEDIR = ( . ) - endif + if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then + set ROOTDIR = ( .. ) endif endif # Scan for logical ROOTDIR @@ -135,7 +128,6 @@ foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..) if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then set ROOTDIR = $dr - if (! $?EXEDIR) set EXEDIR = ( . ) echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\" break endif @@ -162,6 +154,14 @@ if (! -d $BUILDDIR) then echo Build directory $BUILDDIR not found.;exit 1 endif +if (! $?EXEDIR) then + set pwd=`pwd` + if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then + set EXEDIR = ( ../exe ) + else + set EXEDIR = ( . ) + endif +endif if (! -d $EXEDIR) then echo Executable directory $EXEDIR not found.;exit 1 endif @@ -179,23 +179,16 @@ endif echo Adding mods directory $adr end -if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags) -foreach dr ($STANDARDDIRS) - set adr=$ROOTDIR/$dr/src - if (! -d $adr) then - echo Source directory $adr not found.; exit 1 - endif - echo Adding source directory $adr - set SOURCEDIRS = ($SOURCEDIRS $adr) - set idr = `echo $adr | sed 's/src/inc/'` - set INCLUDEDIRS = ($INCLUDEDIRS $idr) -end if (! $?PACKAGES) then set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`) endif foreach dr ($PACKAGES) set enable foreach p ($DISABLE) + if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then + echo Specified package \"$p\" does not exist. + exit 1 + endif if ($dr == $p) unset enable if ($p == 'all') unset enable end @@ -214,6 +207,17 @@ echo "*" Package \"$dr\" has not been enabled. endif end +if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags) +foreach dr ($STANDARDDIRS) + set adr=$ROOTDIR/$dr/src + if (! -d $adr) then + echo Source directory $adr not found.; exit 1 + endif + echo Adding source directory $adr + set SOURCEDIRS = ($SOURCEDIRS $adr) + set idr = `echo $adr | sed 's/src/inc/'` + set INCLUDEDIRS = ($INCLUDEDIRS $idr) +end # This is the generic configuration. # Platform specific options are chosen below @@ -619,6 +623,7 @@ depend: @make links makedepend -o .f \$(INCLUDES) \$(SRCFILES) + links: \$(SRCFILES) small_f: \$(F77FILES) @@ -627,7 +632,7 @@ -rm -rf *.o *.f *.p ${RMFILES} Clean: @make clean - -find . -type l -exec rm {} \; + @make cleanlinks -rm -f Makefile.bak CLEAN: @make Clean @@ -635,6 +640,11 @@ -find \$(EXEDIR) -name "*.data" -exec rm {} \; -rm -f \$(EXECUTABLE) +makefile: + ${0} $argv +cleanlinks: + -find . -type l -exec rm {} \; + # The normal chain of rules is ( .F - .f - .o ) .F.f: \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@