all: turing.html images
	
turing.html: turing.xml bin/2html # ALWAYS
	# ispell turing.xml
	bin/2html < turing.xml > turing.html

images: eps png sref

eps: $(foreach fig, $(wildcard images/*.fig), $(basename $(fig)).eps)
png: $(foreach fig, $(wildcard images/*.fig), $(basename $(fig)).png)

%.eps: %.fig
	fig2dev -Leps $? $@

%.png: %.fig
	fig2dev -Lpng $? $@

sref: images/sref.ps images/sref-small.eps images/sref-small.gif

images/sref.dot: turing.html
images/sref.ps: images/sref.dot
	dot -Tps $? > $@

images/sref-small.dot: images/sref.dot
	cat images/sref.dot \
	| perl -pn \
	-e 's/(\s+size)=(".*")/$$1="3,3"/;' \
	-e 's/=box/=box label=""/;' \
	> $@

images/sref-small.ps: images/sref-small.dot
	dot -Tps $? > $@

images/sref-small.eps: images/sref-small.ps
	ps2eps -f $? 

images/sref-small.gif: images/sref-small.dot
	dot -Tgif $? > $@

ALWAYS:

tarball:
	tar -czvf turing.tar.gz turing.html \
	images/t7a_automation_curve-large.jpg \
	images/*.eps

