Newer
Older
Handbook / make-includes / build_misc_rules.make
nstanger on 19 Feb 2009 4 KB - Added cleaning for temporary PDFs.
################################################################################
#
# File: $Id$
#
# Standard variables and rules for building a general standalone document
# that doesn't fall into any partcular category (such as lecture, tutorial).
# The makefile assumes a single document source file. Anything more
# complex than this will need to be handled by a custom makefile.
#
# Altering these definitions will affect ALL MAKEFILES FOR ALL PAPERS!! If
# you need to do something specific for a particular paper, include a
# custom rule in its makefile. DON'T add it here!
#
################################################################################


################################################################################
#
# Include XSLT functions.
#
include $(TEACHING_SHARED)/Authoring/Handbook/make-includes/xslt_functions.make


################################################################################
#
# Required make variables. These should be defined by the calling makefile.
#
# BASE_NAME
#	The base name of the document source file.
#
BASE_NAME?=$(error The required make variable BASE_NAME has not been defined. Please set it to the base name of the document source file)


################################################################################
#
# Add standard file suffixes.
#
include $(GLOBAL_HANDBOOK_INCLUDE)/standard_suffixes.make


################################################################################
#
# Standard directories.
#
IMGDIR=images


################################################################################
#
# Standard paths.
#
include $(GLOBAL_HANDBOOK_INCLUDE)/standard_paths.make


################################################################################
#
# Files to be cleaned by the various "clean" targets. Note that we don't
# "tidy" .aux files because they may be needed by the xr package for inter-
# document cross references, but won't get regenerated if the final target
# PDF files exist. They will be caught by by the "clean" target though.
#
TIDY_FILES+=*.tmp *.out *.log *.nav *.toc *.snm *.head *.dvi \
	*-derived.xml $(IMGDIR)/*-tmp.pdf
CLEAN_FILES+=*.aux *.pdf *.html


################################################################################
#
# Various environment variables.
#
include $(GLOBAL_HANDBOOK_INCLUDE)/standard_environment.make
#
# List of standard "phony" build targets.
#
TARGETS+=web print print2up
#
.PHONY: $(TARGETS)


################################################################################
#
# Build everything.
#
all: web print print2up


################################################################################
#
# Build print version, 1-up or 2-up.
#
print: $(BASE_NAME).pdf

$(BASE_NAME).pdf: $(BASE_NAME).tex $(PRINT_IMAGES) $(PRINT_FILES)

$(BASENAME).tex: $(BASE_NAME)-derived.xml

print2up: $(BASE_NAME)-2up.pdf

$(BASE_NAME)-2up.pdf: $(BASE_NAME).pdf


################################################################################
#
# Build web version.
#
web: $(BASE_NAME).html

$(BASE_NAME).html: $(BASE_NAME)-derived.xml $(WEB_IMAGES) $(WEB_FILES)


################################################################################
#
# Build the test document.
#
test: test.pdf

test.pdf: test.tex


################################################################################
#
# Debugging: print the values of the standard variables.
#
debug:
	@announce Externally defined variables
	@echo "TEACHING_SHARED = [$(TEACHING_SHARED)]"
	@announce Internally defined variables
	@echo "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]"
	@echo "BASE_NAME = [$(BASE_NAME)]"
	@echo "PRINT_IMAGES = [$(PRINT_IMAGES)]"
	@echo "PRINT_FILES = [$(PRINT_FILES)]"
	@echo "WEB_IMAGES = [$(WEB_IMAGES)]"
	@echo "WEB_FILES = [$(WEB_FILES)]"
	@echo "TIDY_FILES = [$(TIDY_FILES)]"
	@echo "CLEAN_FILES = [$(CLEAN_FILES)]"
	@echo "DRAFT = [$(DRAFT)]"
	@echo "LATEX_OPTS = [$(LATEX_OPTS)]"
	@echo "TARGETS = [$(TARGETS)]"


################################################################################
#
# Clean up: get rid of all the temporary files.
#
tidy:
	rm -f $(TIDY_FILES)
#
# Clean up: get rid of everything except the original source.
#
clean: tidy
	rm -f $(CLEAN_FILES)


################################################################################
#
# List all "phony" build targets.
#
targets:
	@echo "targets: $(TARGETS)"


################################################################################
#
# Standard default rules.
#
include $(GLOBAL_HANDBOOK_INCLUDE)/standard_rules.make