all: slides.pdf handout.pdf %.pdf: %.tex pdflatex $< while grep -E -q 'No file.*\.toc' $(<:%.tex=%.log); do \ pdflatex $<; \ done slides.pdf: slides.tex main.tex handout.pdf: handout.tex main.tex clean: rm -f *.aux *.log *.nav *.out *.snm *.toc *.vrb rm -f slides.pdf handout.pdf .PHONY: all clean