SHELL = /bin/bash

.PHONY: all

all: all.pdf all2.pdf allgraphs.pdf

all.pdf: all.tex results.done
	pdflatex all.tex

all.tex: genalltex
	./genalltex > all.tex

results.done: alldata plot plotall
	./plotall
	touch $@

all2.pdf: all2.tex results2.done
	pdflatex all2.tex

all2.tex: genalltex2
	./genalltex2 > all2.tex

results2.done: data.rda script.r
	R --no-save < script.r
	touch $@

allgraphs.pdf: results2.done
	pdfunite \
	  graphs/{R,I}{1,N}-{10:1,1:1,1:10}-{cluster,grid}-{line,torus,hcube}.pdf \
	  $@