Newer
Older
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. $(PDFLATEX) $<
  37. $(PDFLATEX) $<
  38.  
  39. $(EXAMPLE1_IMAGES): example1.pdf
  40. pdfjam --outfile $@ $< `echo $@ | cut -c 5`
  41.  
  42. $(EXAMPLE2_IMAGES): example2.pdf
  43. pdfjam --outfile $@ $< `echo $@ | cut -c 5`
  44.  
  45.  
  46. # Build the example only.
  47. example: example1.pdf example2.pdf
  48.  
  49. example%.pdf: example%.tex content.tex ouexam.cls
  50. $(PDFLATEX) $<
  51. $(PDFLATEX) $<
  52.  
  53.  
  54. # Install files in the appropriate locations in the texmf tree rooted at
  55. # $(TEXMFHOME). Either define this as a shell variable or pass it as
  56. # command line argument, e.g., make install TEXMFHOME=/usr/local/texmf.
  57. install: class doc example
  58. mkdir -p $(TEXMFHOME)/tex/latex/ouexam
  59. cp ouexam.cls $(TEXMFHOME)/tex/latex/ouexam
  60. mkdir -p $(TEXMFHOME)/doc/latex/ouexam/example
  61. cp eg*.pdf ouexam.pdf ouexam.dtx ouexam.ins \
  62. HISTORY.md MANIFEST README.md \
  63. $(TEXMFHOME)/doc/latex/ouexam
  64. cp Create*.pdf example*.tex example*.pdf lstlang0.sty \
  65. $(TEXMFHOME)/doc/latex/ouexam/example
  66. texhash
  67.  
  68.  
  69. # Clean up: remove temporary files.
  70. tidy:
  71. rm -f *.tmp *.aux *.out *.log *.glo *.toc *.ps \
  72. $(EXAMPLE1_IMAGES) $(EXAMPLE2_IMAGES)
  73.  
  74. # Clean up: remove everything except the original source.
  75. clean: tidy
  76. rm -f ouexam.pdf eg*.pdf example*.pdf *.cls