diff --git a/make-includes/build_misc_rules.make b/make-includes/build_misc_rules.make index d0be5a3..068267b 100755 --- a/make-includes/build_misc_rules.make +++ b/make-includes/build_misc_rules.make @@ -25,10 +25,21 @@ # # Required make variables. These should be defined by the calling makefile. # -# BASE_NAME -# The base name of the document source file. +# BASE_NAMES +# The base name(s) of the document source file(s). It may be a list, which +# enables multiple different documents to be built by the one Makefile. +# BASE_PDF +# BASE_PDF_2UP +# BASE_TEX +# BASE_HTML +# Lists of various source and target files, all derived from BASE_NAMES. # -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) +BASE_NAMES?=$(error The required make variable BASE_NAMES has not been defined. Please set it to the base name(s) of the document source file(s)) + +BASE_PDF:=$(foreach n,$(BASE_NAMES),$(n).pdf) +BASE_PDF_2UP:=$(foreach n,$(BASE_NAMES),$(n)-2up.pdf) +BASE_TEX:=$(foreach n,$(BASE_NAMES),$(n).tex) +BASE_HTML:=$(foreach n,$(BASE_NAMES),$(n).html) ################################################################################ @@ -72,7 +83,7 @@ # # List of standard "phony" build targets. # -TARGETS+=web print print2up +TARGETS+=web print print2up $(BASE_NAMES) # .PHONY: $(TARGETS) @@ -83,29 +94,31 @@ # all: web print print2up +$(BASE_NAMES): %: %.pdf %-2up.pdf %.html + ################################################################################ # # Build print version, 1-up or 2-up. # -print: $(BASE_NAME).pdf +print: $(BASE_PDF) -$(BASE_NAME).pdf: $(BASE_NAME).tex $(PRINT_IMAGES) $(PRINT_FILES) +$(BASE_PDF): %.pdf: %.tex $(PRINT_IMAGES) $(PRINT_FILES) -$(BASENAME).tex: $(BASE_NAME)-derived.xml +$(BASE_TEX): %.tex: %-derived.xml -print2up: $(BASE_NAME)-2up.pdf +print2up: $(BASE_PDF_2UP) -$(BASE_NAME)-2up.pdf: $(BASE_NAME).pdf +$(BASE_PDF_2UP): %-2up.pdf: %.pdf ################################################################################ # # Build web version. # -web: $(BASE_NAME).html +web: $(BASE_HTML) -$(BASE_NAME).html: $(BASE_NAME)-derived.xml $(WEB_IMAGES) $(WEB_FILES) +$(BASE_HTML): %.html: %-derived.xml $(WEB_IMAGES) $(WEB_FILES) ################################################################################ @@ -126,7 +139,11 @@ @echo "TEACHING_SHARED = [$(TEACHING_SHARED)]" @announce Internally defined variables @echo "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" - @echo "BASE_NAME = [$(BASE_NAME)]" + @echo "BASE_NAMES = [$(BASE_NAMES)]" + @echo "BASE_PDF = [$(BASE_PDF)]" + @echo "BASE_PDF_2UP = [$(BASE_PDF_2UP)]" + @echo "BASE_TEX = [$(BASE_TEX)]" + @echo "BASE_HTML = [$(BASE_HTML)]" @echo "PRINT_IMAGES = [$(PRINT_IMAGES)]" @echo "PRINT_FILES = [$(PRINT_FILES)]" @echo "WEB_IMAGES = [$(WEB_IMAGES)]"