Newer
Older
Handbook / makefile-templates / Makefile.lecture
  1. ################################################################################
  2. #
  3. # Template makefile for building a set of lecture files.
  4. #
  5. ################################################################################
  6.  
  7.  
  8. SHELL=/bin/sh
  9.  
  10.  
  11. ################################################################################
  12. #
  13. # Get path to current Makefile so we can set up self-deleting temporary
  14. # directory. Note that this MUST happen before the first include!
  15. #
  16. MAKEFILE:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
  17.  
  18.  
  19. ################################################################################
  20. #
  21. # Required Environment Variables
  22. #
  23. # TEACHING_SHARED
  24. # This variable specifies the path to the top level of the teaching
  25. # shared directory hierarchy (e.g., /path/to/Teaching/Shared).
  26. #
  27. TEACHING_SHARED?=$(error The required environment variable TEACHING_SHARED has not been defined. It should point to the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared))
  28. #
  29. # HANDBOOK_INSTALL_ROOT
  30. # This variable specifies the path to the top level directory on the web
  31. # server, under which the files for this paper will be installed (that is,
  32. # the directory that contains the individual paper directory hierarchies).
  33. # For example, \\INFO-NTS-12\DBCourses$ (this may require munging).
  34. #
  35. HANDBOOK_INSTALL_ROOT?=$(error The required environment variable HANDBOOK_INSTALL_ROOT has not been defined. It should point to the root level of the directory hierarchy on the web server (e.g., \\INFO-NTS-12\DBCourses$))
  36.  
  37.  
  38. ################################################################################
  39. #
  40. # Set up paths to makefile include directories.
  41. #
  42. # GLOBAL_HANDBOOK_INCLUDE is the global include directory in the "Shared"
  43. # hierarchy, and is defined relative to the root of that hierarchy.
  44. #
  45. GLOBAL_HANDBOOK_INCLUDE?=$(TEACHING_SHARED)/Authoring/Handbook/make-includes
  46.  
  47.  
  48. ################################################################################
  49. #
  50. # Include local system-specific configuration.
  51. #
  52. include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make
  53.  
  54.  
  55. ################################################################################
  56. #
  57. # Set up global, self-deleting temporary directory. The first time through,
  58. # TEMPDIR will be undefined, so the first part of the if will create the
  59. # variable, then recursively call the makefile again with the appropriate
  60. # targets, passing the temporary directory as an argument.
  61. #
  62. ifndef TEMPDIR
  63.  
  64. .PHONY: all
  65.  
  66. all:
  67. @TEMPDIR=$(shell $(MKTEMP) -d); \
  68. trap 'rm -rf "$$TEMPDIR"' EXIT; \
  69. $(MAKE) -f $(MAKEFILE) --no-print-directory TEMPDIR=$$TEMPDIR all
  70.  
  71. %:
  72. @TEMPDIR=$(shell $(MKTEMP) -d); \
  73. trap 'rm -rf "$$TEMPDIR"' EXIT; \
  74. $(MAKE) -f $(MAKEFILE) --no-print-directory TEMPDIR=$$TEMPDIR $@
  75.  
  76.  
  77. ################################################################################
  78. #
  79. # Normal makefile follows.
  80. #
  81. else
  82.  
  83.  
  84. ################################################################################
  85. #
  86. # Clear out the suffixes list. DO NOT ALTER THIS LINE!
  87. #
  88. .SUFFIXES:
  89. #
  90. # Add any custom suffixes here (uncomment the line below).
  91. # The "standard" suffixes list currently includes:
  92. # .svg .pdf .tex .dvi .png .tif .plo .jpg .pict .eps .ps .R .xml .pu .ipu
  93. #
  94. # .SUFFIXES:
  95.  
  96.  
  97. ################################################################################
  98. #
  99. # Define paths for various items here. The "standard" paths currently include:
  100. #
  101. # vpath %.pdf $(IMGDIR)
  102. # vpath %.png $(IMGDIR)
  103. # vpath %.tif $(IMGDIR)
  104. # vpath %.jpg $(IMGDIR)
  105. # vpath %.plo $(IMGDIR)
  106. # vpath %.ps $(IMGDIR)
  107. # vpath %.eps $(IMGDIR)
  108. # vpath %.svg $(IMGDIR)
  109. # vpath %.pict $(IMGDIR)
  110. #
  111. # There's nothing to stop you adding new paths for these file types.
  112. #
  113. # vpath foo bar
  114.  
  115.  
  116. ################################################################################
  117. #
  118. # Specify the current lecture or chapter number. THIS MUST BE DEFINED!
  119. # Set it to whatever you like if you don't use it (see below).
  120. #
  121. DOC_NUM?=$(error The required variable DOC_NUM has not been defined. Please set it to the correct chapter or lecture number as appropriate)
  122.  
  123. #
  124. # The document type is prepended onto the output filenames (e.g., "lecture_12_slides.pdf").
  125. #
  126. DOC_TYPE=lecture
  127.  
  128.  
  129. ################################################################################
  130. #
  131. # Specify the subject code and paper number. THESE MUST BE DEFINED!
  132. #
  133. SUBJECT_CODE?=$(error The required variable SUBJECT_CODE has not been defined. Please set it to the correct subject code for this set of lectures)
  134. PAPER_NUMBER?=$(error The required variable PAPER_NUMBER has not been defined. Please set it to the correct paper number for this set of lectures)
  135.  
  136.  
  137. ################################################################################
  138. #
  139. # Directory to install files into on web server. This is .../Lectures/name of
  140. # build directory, to avoid similarly-named files overwriting each other.
  141. #
  142. BUILD_DIR:=$(lastword $(subst /, ,$(CURDIR)))
  143. INSTALL_DIRECTORY:=$(HANDBOOK_INSTALL_ROOT)/$(SUBJECT_CODE)$(PAPER_NUMBER)/Lectures/$(BUILD_DIR)
  144.  
  145.  
  146. ################################################################################
  147. #
  148. # Uncomment any of the following to prevent a particular document from
  149. # being built. This is necessary if, for example, the current set of
  150. # lectures has no figures and examples.
  151. #
  152. # Alternatively, you can use this to set the base name of the output
  153. # files if this is a one-off lecture that doesn't fall into the standard
  154. # lecture or chapter conventions, or you don't want to include the document
  155. # number in the filenames. (Set DOC_NUM above to whatever you like if you don't
  156. # use it.)
  157. #
  158. # You can also alter the base name of the input file for each document by
  159. # setting SLIDES_IN, etc. (These default to $(DOC_TYPE)_slides, etc.)
  160. #
  161. # SLIDES=
  162. # FIGURES=
  163. # COMBINED=
  164. # NOTES=
  165.  
  166.  
  167. ################################################################################
  168. #
  169. # Standard file list variables.
  170. #
  171. # List of images used in the presentation as actual content.
  172. #
  173. SLIDE_IMAGES=
  174.  
  175. #
  176. # List of other files used in the presentation as actual content.
  177. # We assume that shared infrastructure files are in the parent directory;
  178. # modify as necessary.
  179. #
  180. SLIDE_FILES=../../paper_init.tex ../lecturedates.tex doc_init.tex
  181.  
  182. #
  183. # List of images used in the presentation as backgrounds or watermarks.
  184. #
  185. SLIDE_BACKGROUNDS=
  186.  
  187. #
  188. # List of images used in the figures and examples document.
  189. #
  190. FIG_IMAGES=
  191.  
  192. #
  193. # List of other files used in the figures and examples document.
  194. #
  195. FIG_FILES=../../paper_init.tex ../lecturedates.tex doc_init.tex
  196.  
  197. #
  198. # List of images used in the combined lecture material document.
  199. #
  200. COMBI_IMAGES=
  201.  
  202. #
  203. # List of other files used in the combined lecture material document.
  204. #
  205. COMBI_FILES=../../paper_init.tex ../lecturedates.tex doc_init.tex
  206.  
  207. #
  208. # List of files other than the standard ones (slides, figures, combined)
  209. # to be installed on the web server. By default, install the following
  210. # files: $(SLIDES).pdf, $(COMBINED).pdf, $(FIGURES).pdf,
  211. # $(FIGURES)-reduced.pdf. This can include files in subdirectories
  212. # (e.g., foo/bar.pdf), but the subdirectories themselves will not be
  213. # created at the other end (i.e., the directory structure will be
  214. # flattened).
  215. #
  216. INSTALL_FILES=
  217.  
  218. #
  219. # Files to be cleaned by the various "clean" targets. The "standard" values
  220. # are currently:
  221. # TIDY_FILES+=*.tmp *.out *.log *.nav *.toc *.snm *.head *.dvi *.vrb _minted* \
  222. # slides-combined.pdf slides-notes.pdf
  223. # CLEAN_FILES=*.aux *.pdf
  224. #
  225. # $(TIDY_FILES) is a list of generated intermediate files to clean up.
  226. #
  227. TIDY_FILES=
  228. #
  229. # $(CLEAN_FILES) is everything else that might need to be cleaned up.
  230. #
  231. CLEAN_FILES=
  232.  
  233.  
  234. ################################################################################
  235. #
  236. # Specify LaTeX document options. Uncomment DRAFT to set draft mode in LaTeX.
  237. # Set the values of FONT_SIZE and PAPER_SIZE to appropriate LaTeX values if
  238. # you want something other than the defaults (12pt, a4paper). Use LATEX_OPTS
  239. # (comma-separated list) for any document class options that you want to set
  240. # /other than/ draft, font size and paper size.
  241. #
  242. # DRAFT=draft
  243. # FONT_SIZE=
  244. # PAPER_SIZE=
  245. LATEX_OPTS=
  246.  
  247. #
  248. # Additional command line flags for the LaTeX command, e.g., add -shell-escape
  249. # if you're using something like minted that needs it.
  250. #
  251. LATEX_FLAGS=
  252.  
  253. #
  254. # List of "phony" build targets (remember to define rules for
  255. # them!). The "standard" list is currently:
  256. # all slides notes slides-combined slides-notes figures combined
  257. # debug test clean tidy targets
  258. #
  259. TARGETS=
  260.  
  261. #
  262. # Uncomment the following to enable Unicode mode. This forces use of XHTML,
  263. # Xe(La)TeX, etc. The value of the variable is irrelevant, it just need to be
  264. # defined.
  265. #
  266. # UNICODE=on
  267.  
  268.  
  269. ################################################################################
  270. #
  271. # Add custom variables below here as necessary.
  272. #
  273.  
  274.  
  275. ################################################################################
  276. #
  277. # Include standard variables and rules for building lectures.
  278. #
  279. include $(GLOBAL_HANDBOOK_INCLUDE)/build_lecture_rules.make
  280.  
  281.  
  282. ################################################################################
  283. #
  284. # Add custom rules below here as necessary, BEFORE the endif.
  285. #
  286.  
  287.  
  288. endif