######### Latex Command ######### LATEX=pdflatex ######### Source Files ######### # driver files HANDOUT=handout PRESENTATION=presentations SLIDES=slides ######### Generated files to be deleted ######### RUBBISH=*.aux *.dvi *.log *.ps *~ *.*~ *.out *.bak *-driver.* *.nav *.snm *.toc *.tmp *.fdb_latexmk ######### Dependencies ######### DEPENDENCIES=Makefile content.tex lecturedetails.tex preamble.tex ######### Default Target ######### default: slides pdf: default ######### Phony Targets ######### .PHONY: default viewpres viewhandout viewslides clean clean-rubbish ######### Main Targets ######### presentation: presentation.pdf clean-rubbish slides: slides.pdf clean-rubbish quick: quick_pres clean-rubbish handout: handout.pdf clean-rubbish all: clean presentation slides handout ######### Internal Targets ######### presentation.pdf: $(DEPENDENCIES) presentation.tex slides.pdf: $(DEPENDENCIES) slides.tex handout.pdf: slides.pdf handout.tex ######### Driver Targets ######### presentation.pdf: $(DEPENDENCIES) presentation.tex # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right) $(LATEX) presentation.tex $(LATEX) presentation.tex # once more if there are still undefined references if [ -n "$(shell grep 'There were undefined references' presentation.log)" ]; then $(LATEX) presentation.tex ; fi # once more if there are labels that have changed if [ -n "$(shell grep 'Label(s) may have changed' presentation.log)" ]; then $(LATEX) presentation.tex ; fi slides.pdf: $(DEPENDENCIES) slides.tex # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right) $(LATEX) slides.tex $(LATEX) slides.tex # once more if there are still undefined references if [ -n "$(shell grep 'There were undefined references' slides.log)" ]; then $(LATEX) slides.tex ; fi # once more if there are labels that have changed if [ -n "$(shell grep 'Label(s) may have changed' slides.log)" ]; then $(LATEX) slides.tex ; fi handout.pdf: slides.pdf handout.tex $(LATEX) handout.tex # Only runs latex once - for quick (but not always correct) results quick_pres: $(DEPENDENCIES) presentation.tex $(LATEX) presentation.tex ######### Clean ######### clean-rubbish: rm -f $(RUBBISH) clean: clean-rubbish rm -f slides.pdf handout.pdf presentation.pdf