HEAPIMGS := stackOnHeap/figure1.pdf stackOnHeap/figure2.pdf stackOnHeap/figure3.pdf stackOnHeap/figure4.pdf stackOnHeap/figure5.pdf stackOnHeap/figure6.pdf stackOnHeap/figure7.pdf
all: DebugTraces.pdf

%.pdf: %.neato
	neato -Gmaxiter=100 -Tpdf $< > $@

%.pdf: %.dot
	dot -Tpdf $< > $@

%.tex: %.lhs
	lhs2TeX --poly -o $@ $<
	# This rather mysterious call to dos2unix works around a bug in lhs2TeX (seen in version 1.14) that leads
	# to it outputting newlines (LF or CRLF) in the input as CRCRLF in the output TeX file if compiled on Windows.
	# This confuses TeX a great deal (as you might imagine) because it treats the first CR as a line break character.
	# Using dos2unix normalises things by stripping out the bogus CR "line ending".
	#
	# The test statement is a rather hacked up attempt to only apply this if we are running on Windows.
	(test -d c:/ && c:/cygwin/bin/dos2unix $@) || true

DebugTraces.pdf: DebugTraces.tex DebugTraces.bib
	pdflatex $<
	bibtex DebugTraces
	pdflatex $<
	bibtex DebugTraces
	pdflatex $<


clean:
	rm -f *.aux *.log *.ptb *.bbl *.blg *.tex DebugTraces.pdf


.phony: all clean

