--- MITgcm/tools/genmake 2000/11/30 19:58:13 1.22 +++ MITgcm/tools/genmake 2001/09/10 02:28:20 1.51 @@ -1,10 +1,21 @@ #!/bin/csh -f # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/Attic/genmake,v 1.22 2000/11/30 19:58:13 adcroft Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/Attic/genmake,v 1.51 2001/09/10 02:28:20 adcroft Exp $ +# $Name: $ # # Makefile generator for MITgcm UV codes -# created by cnh 03/98 -# adapted by aja 06/98 +# created by cnh 03/98 +# adapted by aja 06/98 +# modified by aja 01/00 + +# Default lists +set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk ) +set DEFINES = ( ) +set ENABLE = ( ) +set MODS = ( ) + +# Grab variables/lists from .genmakerc +if (-r .genmakerc) source .genmakerc # Process command-line arguments set allargs=( $argv ) @@ -24,8 +35,55 @@ exit breaksw case -platform*: + if ($?platform) then + echo Option -platform=dir can only be specified once.; exit 1 + endif set platform = ( `echo $arg | sed 's/-platform=//' `) breaksw + case -rootdir: + case -rootdir=: + echo "To specify root directory you must specify one with -rootdir=dir" + echo "with NO space eg. -rootdir=../../.. or -rootdir=/usr/people/joe/src" + exit + breaksw + case -rootdir=*: + if ($?ROOTDIR) then + echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR + echo "***" Command line \"$arg\" will override this. + endif + set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `) + breaksw + case -mods: + case -mods=: + echo "To specify an additional source directory you must specify one with -mods=dir" + echo "with NO space eg. -mods=../code or -mods=/usr/people/joe/src" + exit + breaksw + case -mods=*: + set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `) + breaksw + case -disable: + case -disable=: + echo "To disable packages from compilation use -disable=pkg1,pkg2" + echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)" + exit + breaksw + case -disable=*: + set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `) + breaksw + case -enable: + case -enable=: + echo "To enable packages from compilation use -enable=pkg1,pkg2" + echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)" + echo "-enable overrides -disable, ie. a package listed in both is enabled" + exit + breaksw + case -ieee: + set IEEE + breaksw + case -enable=*: + set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `) + breaksw case -mpi: echo "Enabling MPI options" set USEMPI @@ -35,7 +93,30 @@ echo "Including paths to JAM libraries" breaksw case -help: - echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]" + echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]" +cat << EOF + +$0 is used to generate the Makefile in the current directory. + +Typical invocations are: + o from "bin": ../tools/genmake + o from "verification/expt/code": ../../../tools/genmake + o from "verification/expt/input": ../../../tools/genmake -mods=../code + o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm + or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods + +Packages (collected modules of code) can be disabled to avoid unnecessary +compilation of unused code. For instance if you know you will not +use GM/Redi, KPP and OBCS and they are appropriate turned-off in the +configuration: + .../tools/genmake -disable=gmredi,kpp,obcs + +If you add some source files you can re-call the previous instance of +genmake with "make makefile". + +genmake also reads the file .genmakerc which can be used to configure +options (primarily the command-line options above) for particular experiments. +EOF exit breaksw default: @@ -47,36 +128,165 @@ shift allargs end -if ($?platform == 0) then +# Default actions/options + +# If platform wasn't specified then determine platform type of the host +if (! $?platform) then set platform = (`uname`) endif -if ($?mfile == 0) set mfile = ( Makefile.$platform ) +# If name of makefile wasn't specified then use default "Makefile" +if (! $?mfile) set mfile = ( Makefile ) + set mach = ( `uname -a` ) echo Operating system: $mach # Directories for source, includes, binaries and executables -# Note -# o If you prefer/need everything under a single directory -# copy everything in ../eesupp/src, ../model/src, -# ../eesupp/inc and ../model/inc into a directory and then -# edit the paths below to ./ -set SOURCEDIRS = ( ../eesupp/src/ ../model/src/ ../diags/src/ ../pkg/*/ ) -set INCLUDEDIRS = ( ./ ../eesupp/inc/ ../model/inc/ ../diags/inc/ ../pkg/*/ ) -set BUILDDIR = ( ../bin/ ) -set EXEDIR = ( ../exe/ ) -set EXECUTABLE = ( mitgcmuv ) +# +# If -rootdir wasn't specified then assume script is being run from bin +# 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 & -d ../model & -d ../eesupp & -d ../pkg) then + set ROOTDIR = ( .. ) + endif +endif +# Scan for logical ROOTDIR +if (! $?ROOTDIR) then + foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..) + if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then + set ROOTDIR = $dr + echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\" + break + endif + end +endif +if (! $?ROOTDIR) then + echo Root directory was not specified and could not be determined. + echo Specify the root location of the model source with -rootdir=dir + exit 1 +endif +if (! -d $ROOTDIR) then + echo Root directory $ROOTDIR not found.;exit 1 +endif +# If -mods wasn't specified then we will assume that we can find all the +# source code in the standard directories +if (! $?MODS) then + set SOURCEDIRS = ( ) + set INCLUDEDIRS = ( ) +else + set SOURCEDIRS = ( $MODS ) + set INCLUDEDIRS = ( $MODS ) +endif +if (! $?BUILDDIR) set BUILDDIR = ( . ) +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 +if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools ) +if (! -d $TOOLSDIR) then + echo Tools directory $TOOLSDIR not found.;exit 1 +endif +if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv ) + +# We have a special set of source files in eesupp/src which +# are generated from some template source files. We'll make them +# first so the appear as regular source code +if (-r $ROOTDIR/eesupp/src/Makefile) then + echo Making source files in eesupp from templates... + (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs + if ($status == 0) then + rm -f make_eesupp.errs + else + cat make_eesupp.errs + exit 2 + endif +endif + +# Now scan the standard source code tree +foreach dr ($SOURCEDIRS) + set adr=$dr + if (! -d $adr) then + echo mods directory $adr not found.; exit 1 + endif + echo Adding mods dir: $adr +end +if (! $?PACKAGES) then + set PACKAGES=() + foreach pkg (`cd $ROOTDIR/pkg; find . -type d | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`) + if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg) + end +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 +# The following allows entire trees to be disabled + if ($dr:h == $p) unset enable + if ($dr:h:h == $p) unset enable + if ($dr:h:h:h == $p) unset enable + if ($dr:h:h:h:h == $p) unset enable + end + foreach p ($ENABLE) + if ($dr == $p) set enable + end + if ($?enable) then + set adr=$ROOTDIR/pkg/$dr + if (! -d $adr) then + echo Source directory $adr not found.; exit 1 + endif + echo Adding pkg dir: $adr + set SOURCEDIRS = ($SOURCEDIRS $adr) + set INCLUDEDIRS = ($INCLUDEDIRS $adr) + else + echo " *" Package \"$dr\" NOT enabled. + switch ($dr) + case mom_fluxform: + set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw + case mom_vecinv: + set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw + default: + breaksw + endsw + endif +end +if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model) +foreach dr ($STANDARDDIRS) + set adr=$ROOTDIR/$dr/src + if (! -d $adr) then + echo Source directory $adr not found.; exit 1 + endif + echo Adding src dir: $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 -set LN = ( 'ln -sf' ) +set LN = ( 'ln -s' ) set CPP = ( '/lib/cpp -P' ) set KPP = ( ) set FC = ( 'f77' ) set LINK = ( 'f77' ) -set DEFINES = ( ) -set INCLUDES = ( ) +set INCLUDES = ( -I. ) set FFLAGS = ( ) set FOPTIM = ( ) +set CFLAGS = ( ) set KFLAGS1 = ( ) set KFLAGS2 = ( ) set LIBS = ( ) @@ -96,19 +306,20 @@ # Platform specific options switch ($platform$USEMPI) - case OSF1: case OSF1+mpi: + echo "Configuring for DEC Alpha with MPI" + set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) + case OSF1: echo "Configuring for DEC Alpha" set CPP = ( '/usr/bin/cpp -P' ) set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' ) - set KPP = ( 'kapf' ) - set KPPFILES = ( 'main.F' ) - set KFLAGS1 = ( '-scan=132 -noconc -cmp=' ) + set KPP = ( ) + set KPPFILES = ( ) + set KFLAGS1 = ( ) set FC = ( 'f77' ) - set FFLAGS = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' ) + set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' ) set FOPTIM = ( '-O5 -fast -tune host -inline all' ) set NOOPTFLAGS = ( '-O0' ) - set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' ) set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F') set RMFILES = ( '*.p.out' ) breaksw @@ -126,7 +337,7 @@ echo "Configuring for SGI Mips" set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' ) set INCLUDES = ( '-I/usr/local/mpi/include' ) - set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' ) + set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' ) set FOPTIM = ( '-O3' ) # set NOOPTFLAGS = ( '-O0' ) # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \ @@ -172,25 +383,26 @@ set LIBS = ( '-lmpi' ) breaksw case SunOS: - set LN = ( '/usr/bin/ln -fs' ) + set LN = ( '/usr/bin/ln -s' ) set CPP = ( '/usr/ccs/lib/cpp -P' ) set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) - set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') - set FOPTIM = ( '-fast -O3' ) - set NOOPTFLAGS = ( '-O0' ) - set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') + set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) + set FOPTIM = ( '-dalign -O3 -xarch=v9' ) + set CFLAGS = ( '-dalign -O3 -xarch=v9' ) + set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) + set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F aim_aim2dyn.F aim_dyn2aim.F aim_aim2dyn_exchanges.F aim_external_fields_load.F aim_calc_diags.F aim_external_forcing.F aim_do_atmos_physics.F aim_write_diags.F aim_do_inphys.F ') breaksw case SunOS+mpi: - set LN = ( '/usr/bin/ln -fs' ) + set LN = ( '/usr/bin/ln -s' ) set CPP = ( '/usr/ccs/lib/cpp -P' ) set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' ) set INCLUDES = ( '-I/usr/local/mpi/include' ) - set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar') - set FOPTIM = ( '-fast -O3' ) - set NOOPTFLAGS = ( '-O0' ) set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \ + set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' ) + set FOPTIM = ( '-dalign -O3 -xarch=v9' ) + set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' ) '-lsocket -lnsl' ) - set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F') + set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F') breaksw case IRIX32: echo "Configuring for SGI ONYX running IRIX64" @@ -222,28 +434,29 @@ set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) set INCLUDES = ( '-I/usr/local/include' ) case Linux: - set LN = ( '/bin/ln -fs' ) + set LN = ( '/bin/ln -s' ) set CPP = ( '/lib/cpp -traditional -P' ) set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' ) set FC = ( 'g77' ) set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' ) - set FOPTIM = ( '-O3 -malign-double -funroll-loops ' ) + if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' ) + set FOPTIM = ( '-O3 -malign-double -funroll-loops' ) set LINK = ( 'g77' ) breaksw case Linux+pgi+mpi: if ($?include_jam_libs) then - set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' ) - set LIBS = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) + set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' ) + set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' ) else set INCLUDES = ( '-I/usr/local/include' ) set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' ) endif case Linux+pgi: - set LN = ( '/bin/ln -fs' ) + set LN = ( '/bin/ln -s' ) set CPP = ( '/lib/cpp -traditional -P' ) set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' ) set FC = ( 'pgf77' ) - set FFLAGS = ( '-byteswapio' ) + set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' ) set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' ) set LINK = ( 'pgf77' ) breaksw @@ -259,7 +472,7 @@ case sn7113: set FC = ( 'f90' ) set LINK = ( 'f90' ) - set LN = ( '/bin/ln -fs' ) + set LN = ( '/bin/ln -s' ) set CPP = ( '/opt/ctl/bin/cpp -N -P' ) set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) set FFLAGS = ( '-m3 -Rabc -N 132') @@ -271,7 +484,7 @@ case sn3002: set FC = ( 'f90' ) set LINK = ( 'f90' ) - set LN = ( '/bin/ln -fs' ) + set LN = ( '/bin/ln -s' ) set CPP = ( '/opt/ctl/bin/cpp -N -P' ) set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' ) set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132') @@ -292,52 +505,68 @@ ## ## ############################################################################### -# Create list of files -set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[F]$'` -if ( $#flist ) then - echo -n 'SRCFILES = ' > srclist.inc - foreach ff ( ${flist} ) - set fname = ( ${ff:t} ) - echo ' \' >> srclist.inc - echo -n " " ${fname:r}.F >> srclist.inc - end -else - echo No source files found...\! - exit -endif -echo " " >> srclist.inc - -set flist = `ls -1 ${SOURCEDIRS} | grep '.*\.[c]$'` -if ( $#flist ) then - echo -n 'CSRCFILES = ' > csrclist.inc - foreach ff ( ${flist} ) - set fname = ( ${ff:t} ) - echo ' \' >> csrclist.inc - echo -n " " ${fname} >> csrclist.inc -else - echo -n 'CSRCFILES =' > csrclist.inc -endif -echo " " >> csrclist.inc - # Convert lists of directories into command-line options foreach inc ($INCLUDEDIRS) set INCLUDES = ($INCLUDES -I$inc) end -set SRCSTARS = ( ) -foreach dr ($SOURCEDIRS) - set SRCSTARS = ("${SRCSTARS}" $dr\*.\[Fc\] ) + +# Search for source code +rm -rf .links.tmp;mkdir .links.tmp +echo "# This section creates symbolic links" > srclinks.tmp +echo "" >> srclinks.tmp +echo -n 'SRCFILES = ' > srclist.inc +echo -n 'CSRCFILES = ' > csrclist.inc +echo -n 'HEADERFILES = ' > hlist.inc +foreach dr ($SOURCEDIRS $INCLUDEDIRS .) + set deplist=( ) + foreach srcfile (`cd $dr; ls *.[hcF]`) + if (! -r .links.tmp/$srcfile) then + if (-f $dr/$srcfile) then + switch ($srcfile:e) + case F: + touch .links.tmp/$srcfile + set deplist=($deplist $srcfile) + echo ' \' >> srclist.inc + echo -n " " $srcfile >> srclist.inc + breaksw + case c: + touch .links.tmp/$srcfile + set deplist=($deplist $srcfile) + echo ' \' >> csrclist.inc + echo -n " " $srcfile >> csrclist.inc + breaksw + case h: + touch .links.tmp/$srcfile + set deplist=($deplist $srcfile) + echo ' \' >> hlist.inc + echo -n " " $srcfile >> hlist.inc + breaksw + endsw + endif + endif + end + if ($#deplist != 0) then + echo "# These files are linked from $dr" >> srclinks.tmp + echo $deplist':' >> srclinks.tmp + echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp + endif end +rm -rf .links.tmp +echo "" >> srclist.inc +echo "" >> csrclist.inc +echo "" >> hlist.inc set THISHOSTNAME = ( `hostname` ) set THISCWD = ( `pwd` ) set THISDATE = ( `date` ) +if (-r $mfile) mv -f $mfile $mfile.bak ########################################### ## This is the template for the makefile ## ########################################### echo Creating makefile: $mfile echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile} -echo "# This makefile was generated automatically pn" >> ${mfile} +echo "# This makefile was generated automatically on" >> ${mfile} echo "# $THISDATE" >> ${mfile} echo "# by the command:" >> ${mfile} echo "# ${0} $argv" >> ${mfile} @@ -362,11 +591,13 @@ # LINK : Command for link editor program # LIBS : Library flags /or/ additional optimization/debugging flags -BUILDDIR = ${BUILDDIR} -SOURCEDIRS = ${SOURCEDIRS} +ROOTDIR = ${ROOTDIR} +BUILDDIR = ${BUILDDIR} +SOURCEDIRS = ${SOURCEDIRS} INCLUDEDIRS = ${INCLUDEDIRS} -EXEDIR = ${EXEDIR} -EXECUTABLE = \$(EXEDIR)${EXECUTABLE} +EXEDIR = ${EXEDIR} +EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} +TOOLSDIR = ${TOOLSDIR} EOF @@ -377,6 +608,7 @@ # extra stuff for Hyades ............................................ HYADES_DIR = /u/u0/cnh/jam-lib/software HYADES_DIR = /u/u0/cnh/jam-lib-twoproc +HYADES_DIR = /usr/local/jamlib/current/dual_proc WORK_DIR = \$(HYADES_DIR) DEPOSIT_DIR = linux_bin @@ -408,7 +640,7 @@ # Unix ln (link) LN = ${LN} # C preprocessor -CPP = cat \$< | ../tools/set64bitConst.sh | ${CPP} +CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP} # Special preprocessor (KAP on DECs, FPP on Crays) KPP = ${KPP} # Fortran compiler @@ -426,6 +658,8 @@ # Optim./debug for FC FFLAGS = ${FFLAGS} FOPTIM = ${FOPTIM} +# Flags for CC +CFLAGS = ${CFLAGS} # Files that should not be optimized NOOPTFILES = ${NOOPTFILES} NOOPTFLAGS = ${NOOPTFLAGS} @@ -436,10 +670,11 @@ cat srclist.inc >> ${mfile} cat csrclist.inc >> ${mfile} +cat hlist.inc >> ${mfile} echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile} echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile} -rm -f srclist.inc csrclist.inc +rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp cat >> ${mfile} < \$@ + clean: -rm -rf *.o *.f *.p ${RMFILES} Clean: @make clean - -find . -type l -exec rm {} \; - -rm Makefile.bak + @make cleanlinks + -rm -f Makefile.bak CLEAN: @make Clean - -find ../verification/*/input/ -name "*.meta" -exec rm {} \; - -find ../verification/*/input/ -name "*.data" -exec rm {} \; - -rm \$(EXECUTABLE) + -find \$(EXEDIR) -name "*.meta" -exec rm {} \; + -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) > \$@ .f.o: \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< +.c.o: + \$(CC) \$(CFLAGS) -c \$< # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain .F.p: @@ -492,7 +738,13 @@ echo "${fname:r}.o: ${fname:r}.f" >> ${mfile} echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile} end -echo >> ${mfile} +echo "" >> ${mfile} + +# Add rules for links +cat srclinks.tmp >> ${mfile} +rm -f srclinks.tmp + +echo "" >> ${mfile} echo "# DO NOT DELETE" >> ${mfile} exit