Newer
Older
templates / latex / lectures / Makefile
  1. ######### Latex Command #########
  2.  
  3. LATEX=pdflatex
  4.  
  5. ######### Source Files #########
  6.  
  7. # driver files
  8. HANDOUT=handout
  9. PRESENTATION=presentations
  10. SLIDES=slides
  11.  
  12. ######### Generated files to be deleted #########
  13.  
  14. RUBBISH=*.aux *.dvi *.log *.ps *~ *.*~ *.out *.bak *-driver.* *.nav *.snm *.toc *.tmp *.fdb_latexmk *.fls
  15.  
  16.  
  17. ######### Dependencies #########
  18.  
  19. DEPENDENCIES=Makefile content.tex lecturedetails.tex preamble.tex
  20.  
  21.  
  22. ######### Default Target #########
  23.  
  24. default: slides
  25. pdf: default
  26.  
  27. ######### Phony Targets #########
  28.  
  29. .PHONY: default viewpres viewhandout viewslides clean clean-rubbish
  30.  
  31.  
  32. ######### Main Targets #########
  33.  
  34. presentation: presentation.pdf clean-rubbish
  35.  
  36. slides: slides.pdf clean-rubbish
  37.  
  38. quick: quick_pres clean-rubbish
  39.  
  40. handout: handout.pdf clean-rubbish
  41.  
  42. all: clean presentation slides handout
  43.  
  44. ######### Internal Targets #########
  45.  
  46. presentation.pdf: $(DEPENDENCIES) presentation.tex
  47.  
  48. slides.pdf: $(DEPENDENCIES) slides.tex
  49.  
  50. numbered-slides.pdf: slides.pdf
  51.  
  52. handout.pdf: numbered-slides.pdf
  53.  
  54. ######### Driver Targets #########
  55.  
  56. presentation.pdf: $(DEPENDENCIES) presentation.tex
  57. # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right)
  58. $(LATEX) presentation.tex
  59. $(LATEX) presentation.tex
  60.  
  61. # once more if there are still undefined references
  62. if [ -n "$(shell grep 'There were undefined references' presentation.log)" ]; then $(LATEX) presentation.tex ; fi
  63.  
  64. # once more if there are labels that have changed
  65. if [ -n "$(shell grep 'Label(s) may have changed' presentation.log)" ]; then $(LATEX) presentation.tex ; fi
  66.  
  67.  
  68. slides.pdf: $(DEPENDENCIES) slides.tex
  69. # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right)
  70. $(LATEX) slides.tex
  71. $(LATEX) slides.tex
  72.  
  73. # once more if there are still undefined references
  74. if [ -n "$(shell grep 'There were undefined references' slides.log)" ]; then $(LATEX) slides.tex ; fi
  75.  
  76. # once more if there are labels that have changed
  77. if [ -n "$(shell grep 'Label(s) may have changed' slides.log)" ]; then $(LATEX) slides.tex ; fi
  78.  
  79. handout.pdf: slides.pdf handout.tex
  80. $(LATEX) handout.tex
  81.  
  82. numbered-slides.pdf: slides.pdf numbered-slides.tex
  83. $(LATEX) numbered-slides.tex
  84.  
  85. # Only runs latex once - for quick (but not always correct) results
  86. quick_pres: $(DEPENDENCIES) presentation.tex
  87. $(LATEX) presentation.tex
  88.  
  89. ######### Clean #########
  90.  
  91. clean-rubbish:
  92. rm -f $(RUBBISH)
  93.  
  94. clean: clean-rubbish
  95. rm -f slides.pdf handout.pdf presentation.pdf numbered-slides.pdf