all : ptr-tagging.pdf

# Submission targets
icfp: icfp064-marlow.tex icfp064-marlow.pdf icfp064-marlow.ps

figures=heap-obj.pdf thunk.pdf update.pdf
epsfigures=$(figures:.pdf=.eps)

$(epsfigures): %.eps: %.pdf
	pdf2ps $< $(@:.eps=.ps)
	ps2eps $(@:.eps=.ps)

icfp064-marlow.pdf: ptr-tagging.pdf
	cp $< $@

icfp064-marlow.ps: $(epsfigures) ptr-tagging.dvi #produces ps as side effect
	cp ptr-tagging.ps $@

icfp064-marlow.tex: ptr-tagging.pdf #produces bbl as side effect
	cat ptr-tagging.tex ptr-tagging.bbl | grep -v bibliography\{ > $@

ptr-tagging.pdf ::
	pdflatex ptr-tagging.tex
	bibtex ptr-tagging
	pdflatex ptr-tagging.tex
	pdflatex ptr-tagging.tex

ptr-tagging.dvi ::
	latex ptr-tagging.tex
	bibtex ptr-tagging
	latex ptr-tagging.tex
	latex ptr-tagging.tex
	dvips -t letter -f ptr-tagging.dvi > ptr-tagging.ps


NOFIB_ANALYSE=nofib-analyse/nofib-analyse

$(NOFIB_ANALYSE):
	cd nofib-analyse; ghc --make -fglasgow-exts -cpp -O -o nofib-analyse Main

NOFIB_RESULTS=nofib-xeon
NOFIB_RESULTS_64=nofib-opteron

NOFIB_RESULTS_COUNT=semi-count-2007-02-26
NOFIB_RESULTS_COUNT_32M=semi-count-2007-02-26-32M

.PHONY : data
data : vec1.tex semi1.tex semi2.tex bmis1.tex bmis2.tex ptag1.tex ptag2.tex \
	datatypes.tex untagged.tex cache1.tex cache2.tex evald.tex ind.tex

vec1.tex : $(NOFIB_RESULTS_64)/2/ghc $(NOFIB_RESULTS_64)/2/ghc-nonvec $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns Size,Runtime,PAPI_L2_DCM \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

semi1.tex : $(NOFIB_RESULTS_64)/2/ghc-nonvec $(NOFIB_RESULTS_64)/2/experiment $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns Size,Runtime \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

semi2.tex : $(NOFIB_RESULTS)/ghc-nonvec $(NOFIB_RESULTS)/experiment $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns Size,Runtime \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

bmis1.tex : $(NOFIB_RESULTS_64)/b/ghc-nonvec $(NOFIB_RESULTS_64)/b/experiment $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns FR_BR,FR_BR_MIS \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

bmis2.tex : $(NOFIB_RESULTS_64)/b/ghc-nonvec $(NOFIB_RESULTS_64)/b/experiment $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns FR_BR_MIS/FR_BR \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

ptag1.tex : $(NOFIB_RESULTS_64)/2/ghc-nonvec $(NOFIB_RESULTS_64)/2/semi $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns Size,Runtime \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

ptag2.tex : $(NOFIB_RESULTS)/ghc-nonvec $(NOFIB_RESULTS)/semi $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns Size,Runtime \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

cache1.tex : $(NOFIB_RESULTS_64)/1/experiment $(NOFIB_RESULTS_64)/1/semi $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns PAPI_L1_DCA,PAPI_L1_DCM \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

cache2.tex : $(NOFIB_RESULTS_64)/2/experiment $(NOFIB_RESULTS_64)/2/semi $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns PAPI_L2_DCA,PAPI_L2_DCM \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

evald.tex : $(NOFIB_RESULTS_COUNT) $(NOFIB_ANALYSE)
	$(NOFIB_ANALYSE) --latex \
		--columns EVALUATED_SCRUTINEE/INSPECTED_SCRUTINEE \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

ind.tex : $(NOFIB_RESULTS_COUNT) $(NOFIB_RESULTS_COUNT_32M)
	$(NOFIB_ANALYSE) --latex \
		--columns INDIRECTION_SCRUTINEE/INSPECTED_SCRUTINEE \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

untagged.tex : $(NOFIB_RESULTS_COUNT)
	$(NOFIB_ANALYSE) --latex \
		--columns TAGGED_SCRUTINEE/EVALUATED_SCRUTINEE \
		--rows anna,cacheprof,constraints,fulsom,integrate,mandel,simple,sphere,typecheck,wang \
		$^ >$@

# Results for ticky-counters require a different nofib-analyse at the mo
NOFIB_ANALYSE2=nofib-analyse2/nofib-analyse

$(NOFIB_ANALYSE2):
	cd nofib-analyse2; ghc --make -fglasgow-exts -cpp -O -o nofib-analyse Main
datatypes.tex: $(NOFIB_RESULTS_COUNT) $(NOFIB_ANALYSE2)
	$(NOFIB_ANALYSE2) -e $^ >$@

