################################################################################ # # Template makefile for building a particular document within a section of # the handbook (e.g., Tutorials 5). Place a copy of this file in the # directory for each document, and modify as appropriate. The default # makefile checks (and rebuilds if necessary) all of the content files for # the current document, using recursive make calls to each content file. # Most of the work is done by the include files, and should cater for # almost all cases. However, if custom rules are needed for a section, # they can be appended to the end of the document's makefile. # ################################################################################ SHELL=/bin/sh ################################################################################ # # Get path to current Makefile so we can set up self-deleting temporary # directory. Note that this MUST happen before the first include! # MAKEFILE:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) ################################################################################ # # Required Environment Variables # # TEACHING_SHARED # This variable specifies the path to the top level of the teaching # shared directory hierarchy (e.g., /path/to/Teaching/Shared). # 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)) # # ALL_PAPERS_ROOT # This variable specifies the path to the top level directory for all # papers taught, i.e., the directory that contains the individual paper # directory hierarchies. For example, /path/to/Teaching/2005. # ALL_PAPERS_ROOT?=$(error The required environment variable ALL_PAPERS_ROOT has not been defined. It should point to the root level of the current teaching directory hierarchy (e.g., /path/to/Teaching/2005)) # # HANDBOOK_INSTALL_ROOT # This variable specifies the path to the top level directory on the web # server, under which the files for this paper will be installed (that is, # the directory that contains the individual paper directory hierarchies). # For example, \\INFO-NTS-12\DBCourses$ (this may require munging). # 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$)) ################################################################################ # # Set up paths to makefile include directories. # # GLOBAL_HANDBOOK_INCLUDE is the global include directory in the "Shared" # hierarchy, and is defined relative to the root of that hierarchy. # # LOCAL_HANDBOOK_INCLUDE is the local include directory for this # particular paper, and is defined relative to the current execution # directory. We are assuming a fixed directory structure here! We can't # really do this as an environment variable because the full path will be # different for each paper, and we can't use the variables from # paper_variables.make to set the path, because that file is in the # include directory! <head spins> We will, however, allow for the # possibility of someone wanting to define this as an environment variable # by making it a conditional assignment. # GLOBAL_HANDBOOK_INCLUDE?=$(TEACHING_SHARED)/Authoring/Handbook/make-includes export LOCAL_HANDBOOK_INCLUDE?=$(shell cd ../../..; pwd)/make-includes ################################################################################ # # Include local system-specific configuration. # include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make ################################################################################ # # Set up global, self-deleting temporary directory. The first time through, # TEMPDIR will be undefined, so the first part of the if will create the # variable, then recursively call the makefile again with the appropriate # targets, passing the temporary directory as an argument. # ifndef TEMPDIR .PHONY: all all: @TEMPDIR=$(shell $(MKTEMP) -d); \ trap 'rm -rf "$$TEMPDIR"' EXIT; \ $(MAKE) -f $(MAKEFILE) --no-print-directory TEMPDIR=$$TEMPDIR all %: @TEMPDIR=$(shell $(MKTEMP) -d); \ trap 'rm -rf "$$TEMPDIR"' EXIT; \ $(MAKE) -f $(MAKEFILE) --no-print-directory TEMPDIR=$$TEMPDIR $@ ################################################################################ # # Normal makefile follows. # else ################################################################################ # # Include standard variables and rules for building a document. # include $(GLOBAL_HANDBOOK_INCLUDE)/build_document_rules.make ################################################################################ # # Add custom rules below here, as necessary, BEFORE the endif. Add files to be # deleted to the variables below, as appropriate. # # WEB_CLEAN_FILES+= # PRINT_CLEAN_FILES+= # ALL_CLEAN_FILES+= endif