Newer
Older
templates / lectures / Makefile
Mark on 22 Jul 2014 2 KB Existing templates.
  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
  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. handout.pdf: slides.pdf handout.tex
  51.  
  52. ######### Driver Targets #########
  53.  
  54. presentation.pdf: $(DEPENDENCIES) presentation.tex
  55. # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right)
  56. $(LATEX) presentation.tex
  57. $(LATEX) presentation.tex
  58.  
  59. # once more if there are still undefined references
  60. if [ -n "$(shell grep 'There were undefined references' presentation.log)" ]; then $(LATEX) presentation.tex ; fi
  61.  
  62. # once more if there are labels that have changed
  63. if [ -n "$(shell grep 'Label(s) may have changed' presentation.log)" ]; then $(LATEX) presentation.tex ; fi
  64.  
  65.  
  66. slides.pdf: $(DEPENDENCIES) slides.tex
  67. # run pdflatex as many times as needed to get references correct (at least twice to get PDF bookmarks right)
  68. $(LATEX) slides.tex
  69. $(LATEX) slides.tex
  70.  
  71. # once more if there are still undefined references
  72. if [ -n "$(shell grep 'There were undefined references' slides.log)" ]; then $(LATEX) slides.tex ; fi
  73.  
  74. # once more if there are labels that have changed
  75. if [ -n "$(shell grep 'Label(s) may have changed' slides.log)" ]; then $(LATEX) slides.tex ; fi
  76.  
  77. handout.pdf: slides.pdf handout.tex
  78. $(LATEX) handout.tex
  79.  
  80. # Only runs latex once - for quick (but not always correct) results
  81. quick_pres: $(DEPENDENCIES) presentation.tex
  82. $(LATEX) presentation.tex
  83.  
  84. ######### Clean #########
  85.  
  86. clean-rubbish:
  87. rm -f $(RUBBISH)
  88.  
  89. clean: clean-rubbish
  90. rm -f slides.pdf handout.pdf presentation.pdf