Newer
Older
LaTeX / ouexam / Makefile
  1. ######################################################################
  2. #
  3. # Makefile for ouexam document class.
  4. #
  5. ######################################################################
  6.  
  7. SHELL=/bin/sh
  8.  
  9.  
  10. .PHONY: class doc example install tidy clean
  11.  
  12.  
  13. # commands
  14. PDFLATEX=pdflatex -shell-escape -synctex=1 -interaction=nonstopmode -file-line-error
  15.  
  16. # files
  17. EXAMPLE1_IMAGES=eg1-1.pdf eg1-2.pdf eg1-3.pdf
  18. EXAMPLE2_IMAGES=eg2-2.pdf eg2-3.pdf eg2-4.pdf eg2-5.pdf
  19.  
  20.  
  21. # Build everything.
  22. all: class doc example
  23.  
  24.  
  25. # Build the class file only.
  26. class: ouexam.cls
  27. ouexam.cls: ouexam.dtx
  28. latex ouexam.ins
  29.  
  30.  
  31. # Build the documentation only.
  32. doc: ouexam.pdf
  33.  
  34. ouexam.pdf: ouexam.dtx $(EXAMPLE1_IMAGES) $(EXAMPLE2_IMAGES)
  35. $(PDFLATEX) $<
  36. makeindex -s gglo.ist -o ouexam.gls ouexam.glo
  37. $(PDFLATEX) $<
  38. $(PDFLATEX) $<
  39.  
  40. $(EXAMPLE1_IMAGES): example1.pdf
  41. pdfjam --outfile $@ $< `echo $@ | cut -c 5`
  42.  
  43. $(EXAMPLE2_IMAGES): example2.pdf
  44. pdfjam --outfile $@ $< `echo $@ | cut -c 5`
  45.  
  46.  
  47. # Build the example only.
  48. example: example1.pdf example2.pdf
  49.  
  50. example%.pdf: example%.tex content.tex ouexam.cls
  51. $(PDFLATEX) $<
  52. $(PDFLATEX) $<
  53.  
  54.  
  55. # Install files in the appropriate locations in the texmf tree rooted at
  56. # $(TEXMFHOME). Either define this as a shell variable or pass it as
  57. # command line argument, e.g., make install TEXMFHOME=/usr/local/texmf.
  58. install: class doc example
  59. mkdir -p $(TEXMFHOME)/tex/latex/ouexam
  60. cp ouexam.cls $(TEXMFHOME)/tex/latex/ouexam
  61. mkdir -p $(TEXMFHOME)/doc/latex/ouexam/example
  62. cp eg*.pdf ouexam.pdf ouexam.dtx ouexam.ins \
  63. HISTORY.md MANIFEST README.md \
  64. $(TEXMFHOME)/doc/latex/ouexam
  65. cp Create*.pdf example*.tex example*.pdf lstlang0.sty \
  66. $(TEXMFHOME)/doc/latex/ouexam/example
  67. texhash
  68.  
  69.  
  70. # Clean up: remove temporary files.
  71. tidy:
  72. rm -f *.tmp *.aux *.out *.log *.glo *.toc *.ps \
  73. $(EXAMPLE1_IMAGES) $(EXAMPLE2_IMAGES)
  74.  
  75. # Clean up: remove everything except the original source.
  76. clean: tidy
  77. rm -f ouexam.pdf eg*.pdf example*.pdf *.cls