.SUFFIXES: .ps .pdf .tex $(SUFFIXES)

.tex.dvi:
	rm -f $*.ps $*.pdf
	latex $< || { rm -f $*.dvi $*.aux $*.idx && false ; }
	while grep 'Rerun to get cross-references right.' $*.log ; do \
	  latex $< || { rm -f $*.dvi $*.aux $*.idx && false ; } ; done
	-killall -USR1 xdvi xdvi.bin xdvi-xaw3d.bin 2>/dev/null || true
.dvi.ps:
	dvips -Ppdf -G0 $<
.ps.pdf:
	ps2pdf $< $@

TARGETS=ladder.pdf realarith.pdf scheduling.pdf sculpt.pdf shells.pdf

all: $(TARGETS)
	@echo
	@echo 'Type "make install" to copy the PDF files onto the web site.'

# directory where the resulting PDF files will be published
# when "make install" is called
PUBLICDIR=/anfs/www/html/teaching/projects/modelprojs

install: $(TARGETS)
	scp $^ rhee.cl.cam.ac.uk:$(PUBLICDIR)/

clean:
	rm -f *.dvi *.ps *.log *.aux *~
