PKG=hoopl
SRC=Graph Label GraphUtil Fuel MkGraph Dataflow
VERSION=`awk '$1 == "Version:" { print $2 }' $PKG.cabal`
HOOPL=Compiler/Hoopl
HS=${SRC:%=$HOOPL/%.hs}
O=${SRC:%=$HOOPL/%.o}
CABAL=hoopl
CONFIG=.config.$CABAL

all:V: $O hoopl.pdf

dist:V: hoopl.pdf
	cabal sdist

hoopl.pdf: ../paper/dfopt.pdf
	cp -a -v $prereq $target

test:V: 
	cabal install --enable-documentation
	(cd ../testing && mk test)

install:V: $CONFIG
	cabal install --enable-documentation

build:V: $CONFIG
	cabal build

check:V: $CONFIG
	cabal check

upload:V: hoopl.pdf $CONFIG
	cabal build
	cabal sdist
	cabal upload dist/$PKG-$VERSION.tar.gz

config:V: $CONFIG

.config.&:D: &.cabal
	cabal configure --user > $target

clean:V:
	rm -f `find [A-Z]* ../testing -name '*.o' -o '*.hi'`

%.pdf: %.tex
	(cd `dirname $prereq`; mk `basename $target`)


%.o: %.hs
	ghc --make -c $prereq


clean:V:
	rm -f $HOOPL/*.o
	rm -f $HOOPL/*.hi
	rm -f *~ $HOOPL/*~
