GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
1
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Handbook
Browse code
- Fixed install target for handbook root (non-section) files.
master
1 parent
1871f1a
commit
8952e6d8cbdb76a42d778d225b0188d58e78363a
nstanger
authored
on 17 Jul 2012
Patch
Showing
3 changed files
make-includes/build_lecture_rules.make
makefile-templates/Makefile.handbook
makefile-templates/install.patterns
Ignore Space
Show notes
View
make-includes/build_lecture_rules.make
################################################################################ # # File: $Id$ # # Standard variables and rules for building a set of lecture files. # Altering these definitions will affect ALL LECTURE 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! # ################################################################################ ################################################################################ # # 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 \ slides-combined.pdf slides-notes.pdf CLEAN_FILES+=*.aux *.pdf ################################################################################ # # Various environment variables. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_environment.make # # Base file names for the various documents. # SLIDES?=Chapter$(CHAPTER)slides FIGURES?=Chapter$(CHAPTER)figures COMBINED?=Chapter$(CHAPTER)combined NOTES?=Chapter$(CHAPTER)notes # # Standard files to be installed on the web server. # ifneq ($(strip $(SLIDES)),) INSTALL_FILES+=$(SLIDES).pdf endif ifneq ($(strip $(FIGURES)),) INSTALL_FILES+=$(FIGURES).pdf $(FIGURES)-reduced.pdf endif ifneq ($(strip $(COMBINED)),) INSTALL_FILES+=$(COMBINED).pdf endif # # List of standard "phony" build targets. # TARGETS+=slides notes slides-combined slides-notes figures figures2up combined # .PHONY: $(TARGETS) ################################################################################ # # Display a message if someone tries to build a target that has been # disabled (by setting the appropriate variable to empty in the makefile). # disabled_message=@$(ECHO) The \"$(1)\" target has been disabled for this chapter. ################################################################################ # # Build everything. # all: slides notes figures figures2up combined ################################################################################ # # Build presentation slides. If $(SLIDES) is empty, these rules are ignored. # ifneq ($(strip $(SLIDES)),) # # Set the prerequisites for the "slides" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) SLIDES_PREREQS:=$(SLIDES).pdf else SLIDES_PREREQS:=figures $(SLIDES).pdf endif # # Build the slides for the presentation. # slides: $(SLIDES_PREREQS) $(SLIDES).pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(PDFLATEX) --jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES)}' else slides: $(call disabled_message,$@) endif ################################################################################ # # Build the presentation notes. If $(NOTES) is empty, these rules are # ignored. # ifneq ($(strip $(NOTES)),) # # Build the slides with notes. # slides-notes: slides-notes.pdf slides-notes.pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(PDFLATEX) --jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES)}' # # Build the slides with notes, 6-up. # notes: $(NOTES).pdf $(NOTES).pdf: $(NOTES).tex slides-notes.pdf $(PDFLATEX) $< $(PDFLATEX) $< else notes slides-notes: $(call disabled_message,$@) endif ################################################################################ # # Build the complete combined lecture document. If $(COMBINED) is empty, # these rules are ignored. # ifneq ($(strip $(COMBINED)),) # # Set the prerequisites for the "combined" build target, depending on # whether the figures document exists. If $(FIGURES) is empty, they are # omitted from the combined document. # ifeq ($(strip $(FIGURES)),) COMBINED_PREREQS:=$(COMBINED).tex slides-combined.pdf else COMBINED_PREREQS:=$(COMBINED).tex slides-combined.pdf $(FIGURES).pdf endif # # Build the slides for the combined document. # slides-combined: slides-combined.pdf slides-combined.pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(PDFLATEX) --jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES)}' # # Build the complete combined document. # combined: $(COMBINED).pdf $(COMBINED).pdf: $(COMBINED_PREREQS) $(COMBI_IMAGES) $(COMBI_FILES) $(PDFLATEX) $< $(PDFLATEX) $< else combined slides-combined: $(call disabled_message,$@) endif ################################################################################ # # Build the figures and examples document. If $(FIGURES) is empty, these # rules are ignored. # ifneq ($(strip $(FIGURES)),) figures: $(FIGURES).pdf $(FIGURES).pdf: $(FIGURES).tex $(FIG_IMAGES) $(FIG_FILES) $(PDFLATEX) $< $(PDFLATEX) $< figures2up: $(FIGURES)-reduced.pdf $(FIGURES)-reduced.pdf: $(FIGURES).pdf $(PDFNUP) $< --nup 2x1 --outfile $@ else figures figures2up: $(call disabled_message,$@) endif ################################################################################ # # Build the test document. # test: test.pdf test.pdf: test.tex ################################################################################ # # Link the appropriate files to the deployment directory, then synchronise this # with Blackboard. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and that it points to a valid directory. Note that all existing # symbolic links under the install directory are deleted first to ensure that # there are no dangling links. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # # Note that this won't do anything clever if you give it files that are # in subdirectories of the current directory. Everything will be flattened # at the other end. That is, something like "images/foo.pdf" will go into # the installation directory as "foo.pdf", not "images/foo.pdf". # install: @$(ANNOUNCE) "Building deployment links" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(FIND) $(INSTALL_DIRECTORY) -type l -delete @$(foreach f,$(INSTALL_FILES),if $(TEST) ! -f $(INSTALL_DIRECTORY)/$(f) -o $(CURDIR)/$(f) -nt $(INSTALL_DIRECTORY)/$(f); then $(ECHO) "Linking $(f)"; $(LN_S) -f $(CURDIR)/$(f) $(INSTALL_DIRECTORY); fi;) @$(ANNOUNCE) "Synchronising with Blackboard" @$(SITECOPY) --update Blackboard$(PAPER_NUMBER) ################################################################################ # # Debugging: print the values of the standard variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ECHO) "CHAPTER = [$(CHAPTER)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "SLIDE_IMAGES = [$(SLIDE_IMAGES)]" @$(ECHO) "SLIDE_BACKGROUNDS = [$(SLIDE_BACKGROUNDS)]" @$(ECHO) "SLIDE_FILES = [$(SLIDE_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "FIG_FILES = [$(FIG_FILES)]" @$(ECHO) "TIDY_FILES = [$(TIDY_FILES)]" @$(ECHO) "CLEAN_FILES = [$(CLEAN_FILES)]" @$(ECHO) "DRAFT = [$(DRAFT)]" @$(ECHO) "LATEX_OPTS = [$(LATEX_OPTS)]" @$(ECHO) "SLIDES = [$(SLIDES)]" @$(ECHO) "FIGURES = [$(FIGURES)]" @$(ECHO) "COMBINED = [$(COMBINED)]" @$(ECHO) "NOTES = [$(NOTES)]" @$(ECHO) "SLIDES_PREREQS = [$(SLIDES_PREREQS)]" @$(ECHO) "COMBINED_PREREQS = [$(COMBINED_PREREQS)]" @$(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
################################################################################ # # File: $Id$ # # Standard variables and rules for building a set of lecture files. # Altering these definitions will affect ALL LECTURE 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! # ################################################################################ ################################################################################ # # 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 \ slides-combined.pdf slides-notes.pdf CLEAN_FILES+=*.aux *.pdf ################################################################################ # # Various environment variables. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_environment.make # # Base file names for the various documents. # SLIDES?=Chapter$(CHAPTER)slides FIGURES?=Chapter$(CHAPTER)figures COMBINED?=Chapter$(CHAPTER)combined NOTES?=Chapter$(CHAPTER)notes # # Standard files to be installed on the web server. # ifneq ($(strip $(SLIDES)),) INSTALL_FILES+=$(SLIDES).pdf endif ifneq ($(strip $(FIGURES)),) INSTALL_FILES+=$(FIGURES).pdf $(FIGURES)-reduced.pdf endif ifneq ($(strip $(COMBINED)),) INSTALL_FILES+=$(COMBINED).pdf endif # # List of standard "phony" build targets. # TARGETS+=slides notes slides-combined slides-notes figures figures2up combined # .PHONY: $(TARGETS) ################################################################################ # # Display a message if someone tries to build a target that has been # disabled (by setting the appropriate variable to empty in the makefile). # disabled_message=@$(ECHO) The \"$(1)\" target has been disabled for this chapter. ################################################################################ # # Build everything. # all: slides notes figures figures2up combined ################################################################################ # # Build presentation slides. If $(SLIDES) is empty, these rules are ignored. # ifneq ($(strip $(SLIDES)),) # # Set the prerequisites for the "slides" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) SLIDES_PREREQS:=$(SLIDES).pdf else SLIDES_PREREQS:=figures $(SLIDES).pdf endif # # Build the slides for the presentation. # slides: $(SLIDES_PREREQS) $(SLIDES).pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(PDFLATEX) --jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES)}' else slides: $(call disabled_message,$@) endif ################################################################################ # # Build the presentation notes. If $(NOTES) is empty, these rules are # ignored. # ifneq ($(strip $(NOTES)),) # # Build the slides with notes. # slides-notes: slides-notes.pdf slides-notes.pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(PDFLATEX) --jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES)}' # # Build the slides with notes, 6-up. # notes: $(NOTES).pdf $(NOTES).pdf: $(NOTES).tex slides-notes.pdf $(PDFLATEX) $< $(PDFLATEX) $< else notes slides-notes: $(call disabled_message,$@) endif ################################################################################ # # Build the complete combined lecture document. If $(COMBINED) is empty, # these rules are ignored. # ifneq ($(strip $(COMBINED)),) # # Set the prerequisites for the "combined" build target, depending on # whether the figures document exists. If $(FIGURES) is empty, they are # omitted from the combined document. # ifeq ($(strip $(FIGURES)),) COMBINED_PREREQS:=$(COMBINED).tex slides-combined.pdf else COMBINED_PREREQS:=$(COMBINED).tex slides-combined.pdf $(FIGURES).pdf endif # # Build the slides for the combined document. # slides-combined: slides-combined.pdf slides-combined.pdf: $(SLIDES).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(PDFLATEX) --jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES)}' $(PDFLATEX) --jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES)}' # # Build the complete combined document. # combined: $(COMBINED).pdf $(COMBINED).pdf: $(COMBINED_PREREQS) $(COMBI_IMAGES) $(COMBI_FILES) $(PDFLATEX) $< $(PDFLATEX) $< else combined slides-combined: $(call disabled_message,$@) endif ################################################################################ # # Build the figures and examples document. If $(FIGURES) is empty, these # rules are ignored. # ifneq ($(strip $(FIGURES)),) figures: $(FIGURES).pdf $(FIGURES).pdf: $(FIGURES).tex $(FIG_IMAGES) $(FIG_FILES) $(PDFLATEX) $< $(PDFLATEX) $< figures2up: $(FIGURES)-reduced.pdf $(FIGURES)-reduced.pdf: $(FIGURES).pdf $(PDFNUP) $< --nup 2x1 --outfile $@ else figures figures2up: $(call disabled_message,$@) endif ################################################################################ # # Build the test document. # test: test.pdf test.pdf: test.tex ################################################################################ # # Link the appropriate files to the deployment directory, then synchronise this # with Blackboard. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and that it points to a valid directory. Note that all existing # symbolic links in the entire lectures deployment tree are deleted first. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # # Note that this won't do anything clever if you give it files that are # in subdirectories of the current directory. Everything will be flattened # at the other end. That is, something like "images/foo.pdf" will go into # the installation directory as "foo.pdf", not "images/foo.pdf". # install: @$(ANNOUNCE) "Building deployment links" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(FIND) $(INSTALL_DIRECTORY) -type l -delete @$(foreach f,$(INSTALL_FILES),if $(TEST) ! -f $(INSTALL_DIRECTORY)/$(f) -o $(CURDIR)/$(f) -nt $(INSTALL_DIRECTORY)/$(f); then $(ECHO) "Linking $(f)"; $(LN_S) -f $(CURDIR)/$(f) $(INSTALL_DIRECTORY); fi;) @$(ANNOUNCE) "Synchronising with Blackboard" @$(SITECOPY) --update Blackboard$(PAPER_NUMBER) ################################################################################ # # Debugging: print the values of the standard variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ECHO) "CHAPTER = [$(CHAPTER)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "SLIDE_IMAGES = [$(SLIDE_IMAGES)]" @$(ECHO) "SLIDE_BACKGROUNDS = [$(SLIDE_BACKGROUNDS)]" @$(ECHO) "SLIDE_FILES = [$(SLIDE_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "FIG_FILES = [$(FIG_FILES)]" @$(ECHO) "TIDY_FILES = [$(TIDY_FILES)]" @$(ECHO) "CLEAN_FILES = [$(CLEAN_FILES)]" @$(ECHO) "DRAFT = [$(DRAFT)]" @$(ECHO) "LATEX_OPTS = [$(LATEX_OPTS)]" @$(ECHO) "SLIDES = [$(SLIDES)]" @$(ECHO) "FIGURES = [$(FIGURES)]" @$(ECHO) "COMBINED = [$(COMBINED)]" @$(ECHO) "NOTES = [$(NOTES)]" @$(ECHO) "SLIDES_PREREQS = [$(SLIDES_PREREQS)]" @$(ECHO) "COMBINED_PREREQS = [$(COMBINED_PREREQS)]" @$(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
Ignore Space
Show notes
View
makefile-templates/Makefile.handbook
################################################################################ # # File: $Id$ # # Makefile for DBCOURSES handbooks. Revamped completely from old # monolithic version to a "many-makefiles" model. Each major sub-unit of # the handbook has its own makefile, and is called recursively from here. # This makes management of the whole process a bit more complex, but a lot # more flexible. It's now possible, for example, to build many of the # files for a single tutorial by going into that tutorial's directory and # running a make there. The old scheme was also wont to rebuild lots of # extraneous stuff when only one file changed (especially with graphics). # This does not appear to be (and should not) be a problem with the new # scheme. # ################################################################################ SHELL=/bin/sh ################################################################################ # # Given that we print out our own messages, I see no point in splurging # "Entering...leaving directory" messages all over the screen. It's hard # enough to figure out what's going on already :) # MAKEFLAGS=--no-print-directory ################################################################################ # # 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 pwd)/make-includes ################################################################################ # # Include local system-specific configuration. # include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make ################################################################################ # # Include variables defining the current paper. # include $(LOCAL_HANDBOOK_INCLUDE)/paper_variables.make ################################################################################ # # Directories for the major sections. Add to as necessary. Sections should # be listed in the order that they will appear in the handbook. Remember to # exclude CVS directories (doh!). # SECTION_DIRS:=$(shell $(FIND) sections -mindepth 1 -maxdepth 1 -type d -not -name CVS) ################################################################################ # # Run one-time initialisation stuff. # # Ensure that the patterns files exist. If they don't, copy the originals # across from the shared directory and abort the run so that the user can # edit them appropriately. # CHECK_ANSWERS_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/answers.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/answers.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "answers")) CHECK_QUESTIONS_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/questions.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/questions.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "questions")) CHECK_INSTALL_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/install.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/install.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "install")) CHECK_ALL_PATTERNS:=$(CHECK_ANSWERS_PATTERNS) $(CHECK_QUESTIONS_PATTERNS) $(CHECK_INSTALL_PATTERNS) ifneq "$(strip $(CHECK_ALL_PATTERNS))" "" $(error Patterns files have been restored from defaults ($(CHECK_ALL_PATTERNS)), please check them before continuing) endif # # Delete the marker file that indicates that we've already initialised the # sub-sections by removing their "content checked" marker files. There's # only one of these, so it's much easier to deal with :) # # Note: NOINIT should _not_ be exported to this sub-make, to ensure that # the sub-makefile's one-time initialisation is executed. # CLEANUP_MARKER_FILES:=$(foreach d,$(SECTION_DIRS),$(shell $(MAKE) -C $d init-clean)) ################################################################################ # # Load in patterns for which items to install. In particular, we are looking # for the value "handbook_root" to appear in either QUESTION_INSTALL_PATTERNS # or ANSWER_INSTALL_PATTERNS. This tells us whether to install links for the # questions and answers versions of the handbook, respectively. Yes, this is # a hack! # # *_INSTALL_PATTERNS defines the patterns for installing on the web server. # QUESTION_INSTALL_PATTERNS:= ANSWER_INSTALL_PATTERNS:= # # Load in the install patterns from the local make-includes directory. # include $(LOCAL_HANDBOOK_INCLUDE)/install.patterns ################################################################################ # # Lists of LaTeX files to be \input into the master LaTeX document. Just # build a single list for everything; we can extract the sections we want # at the time using make's filter function, as the sections have distinct # names. These are statically defined rather than using a find command, # because the files may not exist at the time the find command is # executed. This Would Be Non-Useful. # QUESTION_TEX_INPUTS:=$(foreach d,$(SECTION_DIRS),$d/question-manifest.tex) ANSWER_TEX_INPUTS:=$(foreach d,$(SECTION_DIRS),$d/answer-manifest.tex) LATEX_INCLUDES:=$(shell $(FIND) latex-includes -name "*.tex") ################################################################################ # # Additional options for the coursehandbook document class to set up # the details of the paper. These get included in a call to the # \papersetup macro in the template file (including the options # directly into the \documentclass is problematic --- see # coursehandbook.cls for details). The values are set in # latex-includes/paper_variables.make. # PAPER_OPTIONS:=subjectcode=$(SUBJECT_CODE),papernumber=$(PAPER_NUMBER),papertitle=$(PAPER_TITLE),paperyear=$(PAPER_YEAR),paperperiod=$(PAPER_PERIOD),authors=$(HANDBOOK_AUTHORS) ################################################################################ # # Directory to install files into on web server. # INSTALL_DIRECTORY:=$(HANDBOOK_INSTALL_ROOT)/$(SUBJECT_CODE)$(PAPER_NUMBER)/Blackboard/Handbook ################################################################################ # # Files to be installed on web server. # QUESTION_INSTALL_FILES:=handbook.pdf handbook-2up.pdf handbook-answers.pdf \ $(wildcard *.png) ANSWER_INSTALL_FILES:= handbook-answers.pdf handbook-answers-2up.pdf \ $(wildcard *.png) # Sorting gets rid of any duplicates (e.g., the PNG files). INSTALL_FILES:=$(sort $(QUESTION_INSTALL_FILES) $(ANSWER_INSTALL_FILES)) ################################################################################ # # Lists of files for cleaning up. # WEB_CLEAN_FILES:=*.png PRINT_CLEAN_FILES:=handbook.tex handbook-answers.tex \ *.pdf *.ps *.dvi *.aux *.log *.toc *.idx *.ind *.tex~ *.out ALL_CLEAN_FILES:=$(WEB_CLEAN_FILES) $(PRINT_CLEAN_FILES) ################################################################################ # # List of possible targets. # TARGETS:=all targets debug install \ web web-questions web-answers \ print print-questions print-answers \ questions answers \ section-questions section-answers \ question-pdfs answer-pdfs \ clean web-clean print-clean .PHONY: $(TARGETS) ################################################################################ # # Build everything. # all: web print ################################################################################ # # Build questions/answers only. # questions: web-questions print-questions answers: web-answers print-answers ################################################################################ # # Build web version only. NOINIT and SECTION should be exported to all # these sub-makes. # web: general-graphics web-questions web-answers web-questions: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d web-questions NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) web-answers: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d web-answers NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) ################################################################################ # # Build print version only. NOINIT and SECTION should be exported to all # these sub-makes. # print: general-graphics print-questions print-answers print-questions: section-questions handbook.pdf handbook-2up.pdf question-pdfs section-questions: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d print-questions NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) handbook.tex: handbook_template.tex $(QUESTION_TEX_INPUTS) $(LOCAL_HANDBOOK_INCLUDE)/questions.patterns $(LATEX_INCLUDES) @$(ANNOUNCE) "Generating $@" @$(ECHO) "% THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!" > $@ @$(ECHO) >> $@ @$(PERL) -p -e "s|\<\@SHOWANSWERS\@\>|hideanswers|;" \ -e "s|\<\@PAPEROPTIONS\@\>|$(PAPER_OPTIONS)|;" \ $(foreach sect,$(SECTION_DIRS),-e "s|\<\@SECTION\[$(notdir $(sect))\]\@\>|\\\\input{$(basename $(filter $(sect)/%,$(QUESTION_TEX_INPUTS)))}|;") $< >> $@ question-pdfs: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d question-pdfs NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) # # Answers # print-answers: section-answers handbook-answers.pdf handbook-answers-2up.pdf answer-pdfs section-answers: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d print-answers NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) handbook-answers.tex: handbook_template.tex $(ANSWER_TEX_INPUTS) $(LOCAL_HANDBOOK_INCLUDE)/answers.patterns $(LATEX_INCLUDES) @$(ANNOUNCE) "Generating $@" @$(ECHO) "% THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!" > $@ @$(ECHO) >> $@ @$(PERL) -p -e "s|\<\@SHOWANSWERS\@\>|showanswers|;" \ -e "s|\<\@PAPEROPTIONS\@\>|$(PAPER_OPTIONS)|;" \ $(foreach sect,$(SECTION_DIRS),-e "s|\<\@SECTION\[$(notdir $(sect))\]\@\>|\\\\input{$(basename $(filter $(sect)/%,$(ANSWER_TEX_INPUTS)))}|;") $< >> $@ answer-pdfs: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d answer-pdfs NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) # # Generic rules for print version. # %.pdf: %.tex @$(ANNOUNCE) "pdflatex $< (pass 1)" $(PDFLATEX) $< @$(ANNOUNCE) "pdflatex $< (pass 2)" $(PDFLATEX) $< %-2up.pdf: %.pdf @$(ANNOUNCE) "Generating $@" $(PDFNUP) --nup 2x1 --outfile $@ $< ################################################################################ # # Build any general graphics that are used throughout the handbook. This uses # the standard makefile for a content directory, but the only files in this # directory are graphics files. # general-graphics: @if $(MAKE) -C graphics general-graphics BUILD_DIR=$(CURDIR); then $(TRUE); else exit 1; fi ################################################################################ # # Link the appropriate files to the install directory, then synchronise this # with Blackboard. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and that it points to a valid directory. All symbolic links # under the install directory are removed first, to ensure that if we # accidentally install the answers when we don't want to, a "make # install-questions" will get rid of them again. Finally we remove any broken # links that might be created along the way. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # install: questions answers @$(ANNOUNCE) "Building deployment links" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(FIND) $(INSTALL_DIRECTORY) -type l -delete @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d $@ NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) @$(ANNOUNCE) "Creating links in $(INSTALL_DIRECTORY)" @$(foreach f,$(QUESTION_INSTALL_FILES),if $(TEST) -f $(CURDIR)/$(f) -a -n $(filter handbook_root,$QUESTION_INSTALL_PATTERNS); then $(ECHO) "Linking $(f)"; $(LN_S) -f $(CURDIR)/$(f) $(INSTALL_DIRECTORY); fi;) @$(foreach f,$(ANSWER_INSTALL_FILES),if $(TEST) -f $(CURDIR)/$(f) -a -n $(filter handbook_root,$ANSWER_INSTALL_PATTERNS); then $(ECHO) "Linking $(f)"; $(LN_S) -f $(CURDIR)/$(f) $(INSTALL_DIRECTORY); fi;) @$(FIND) $(INSTALL_DIRECTORY) -type l ! -exec test -r {} \; -delete @$(ANNOUNCE) "Synchronising with Blackboard" @$(SITECOPY) --update Blackboard$(PAPER_NUMBER) ################################################################################ # # Clean up all generated files. # "web-clean" and "print-clean" only clean up files for the web and print # versions, respectively. Note that "clean" isn't dependent on either # "web-clean" or "print-clean", to ensure that the correct target is # used when calling the sub-makefile. # clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(ALL_CLEAN_FILES)),) -$(RM) -f $(ALL_CLEAN_FILES) @$(MAKE) -C graphics clean BUILD_DIR=$(CURDIR) endif web-clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(WEB_CLEAN_FILES)),) -$(RM) -f $(WEB_CLEAN_FILES) endif print-clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(PRINT_CLEAN_FILES)),) -$(RM) -f $(PRINT_CLEAN_FILES) endif ################################################################################ # # Debugging information, mostly lists of the generated variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "LOCAL_HANDBOOK_INCLUDE = [$(LOCAL_HANDBOOK_INCLUDE)]" @$(ECHO) "SECTION_DIRS = [$(SECTION_DIRS)]" @$(ECHO) "QUESTION_TEX_INPUTS = [$(QUESTION_TEX_INPUTS)]" @$(ECHO) "ANSWER_TEX_INPUTS = [$(ANSWER_TEX_INPUTS)]" @$(ECHO) "LATEX_INCLUDES = [$(LATEX_INCLUDES)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "WEB_CLEAN_FILES = [$(WEB_CLEAN_FILES)]" @$(ECHO) "PRINT_CLEAN_FILES = [$(PRINT_CLEAN_FILES)]" @$(ECHO) "ALL_CLEAN_FILES = [$(ALL_CLEAN_FILES)]" @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "PAPER_TITLE = [$(PAPER_TITLE)]" @$(ECHO) "PAPER_YEAR = [$(PAPER_YEAR)]" @$(ECHO) "PAPER_PERIOD = [$(PAPER_PERIOD)]" @$(ECHO) "HANDBOOK_AUTHORS = [$(HANDBOOK_AUTHORS)]" @$(ECHO) "PAPER_OPTIONS = [$(PAPER_OPTIONS)]" ################################################################################ # # Print out the list of targets. Handy for when you forget! # targets: @$(ECHO) $(TARGETS)
################################################################################ # # File: $Id$ # # Makefile for DBCOURSES handbooks. Revamped completely from old # monolithic version to a "many-makefiles" model. Each major sub-unit of # the handbook has its own makefile, and is called recursively from here. # This makes management of the whole process a bit more complex, but a lot # more flexible. It's now possible, for example, to build many of the # files for a single tutorial by going into that tutorial's directory and # running a make there. The old scheme was also wont to rebuild lots of # extraneous stuff when only one file changed (especially with graphics). # This does not appear to be (and should not) be a problem with the new # scheme. # ################################################################################ SHELL=/bin/sh ################################################################################ # # Given that we print out our own messages, I see no point in splurging # "Entering...leaving directory" messages all over the screen. It's hard # enough to figure out what's going on already :) # MAKEFLAGS=--no-print-directory ################################################################################ # # 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 pwd)/make-includes ################################################################################ # # Include local system-specific configuration. # include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make ################################################################################ # # Include variables defining the current paper. # include $(LOCAL_HANDBOOK_INCLUDE)/paper_variables.make ################################################################################ # # Directories for the major sections. Add to as necessary. Sections should # be listed in the order that they will appear in the handbook. Remember to # exclude CVS directories (doh!). # SECTION_DIRS:=$(shell $(FIND) sections -mindepth 1 -maxdepth 1 -type d -not -name CVS) ################################################################################ # # Run one-time initialisation stuff. # # Ensure that the patterns files exist. If they don't, copy the originals # across from the shared directory and abort the run so that the user can # edit them appropriately. # CHECK_ANSWERS_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/answers.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/answers.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "answers")) CHECK_QUESTIONS_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/questions.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/questions.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "questions")) CHECK_INSTALL_PATTERNS:=$(shell ($(TEST) -f $(LOCAL_HANDBOOK_INCLUDE)/install.patterns) || ($(CP) $(TEACHING_SHARED)/Authoring/Handbook/makefile-templates/install.patterns $(LOCAL_HANDBOOK_INCLUDE); $(ECHO) "install")) CHECK_ALL_PATTERNS:=$(CHECK_ANSWERS_PATTERNS) $(CHECK_QUESTIONS_PATTERNS) $(CHECK_INSTALL_PATTERNS) ifneq "$(strip $(CHECK_ALL_PATTERNS))" "" $(error Patterns files have been restored from defaults ($(CHECK_ALL_PATTERNS)), please check them before continuing) endif # # Delete the marker file that indicates that we've already initialised the # sub-sections by removing their "content checked" marker files. There's # only one of these, so it's much easier to deal with :) # # Note: NOINIT should _not_ be exported to this sub-make, to ensure that # the sub-makefile's one-time initialisation is executed. # CLEANUP_MARKER_FILES:=$(foreach d,$(SECTION_DIRS),$(shell $(MAKE) -C $d init-clean)) ################################################################################ # # Lists of LaTeX files to be \input into the master LaTeX document. Just # build a single list for everything; we can extract the sections we want # at the time using make's filter function, as the sections have distinct # names. These are statically defined rather than using a find command, # because the files may not exist at the time the find command is # executed. This Would Be Non-Useful. # QUESTION_TEX_INPUTS:=$(foreach d,$(SECTION_DIRS),$d/question-manifest.tex) ANSWER_TEX_INPUTS:=$(foreach d,$(SECTION_DIRS),$d/answer-manifest.tex) LATEX_INCLUDES:=$(shell $(FIND) latex-includes -name "*.tex") ################################################################################ # # Additional options for the coursehandbook document class to set up # the details of the paper. These get included in a call to the # \papersetup macro in the template file (including the options # directly into the \documentclass is problematic --- see # coursehandbook.cls for details). The values are set in # latex-includes/paper_variables.make. # PAPER_OPTIONS:=subjectcode=$(SUBJECT_CODE),papernumber=$(PAPER_NUMBER),papertitle=$(PAPER_TITLE),paperyear=$(PAPER_YEAR),paperperiod=$(PAPER_PERIOD),authors=$(HANDBOOK_AUTHORS) ################################################################################ # # Directory to install files into on web server. # INSTALL_DIRECTORY:=$(HANDBOOK_INSTALL_ROOT)/$(SUBJECT_CODE)$(PAPER_NUMBER)/Blackboard/Handbook ################################################################################ # # Files to be installed on web server. # INSTALL_FILES:=handbook.pdf handbook-2up.pdf handbook-answers.pdf \ handbook-answers-2up.pdf $(wildcard *.png) ################################################################################ # # Lists of files for cleaning up. # WEB_CLEAN_FILES:=*.png PRINT_CLEAN_FILES:=handbook.tex handbook-answers.tex \ *.pdf *.ps *.dvi *.aux *.log *.toc *.idx *.ind *.tex~ *.out ALL_CLEAN_FILES:=$(WEB_CLEAN_FILES) $(PRINT_CLEAN_FILES) ################################################################################ # # List of possible targets. # TARGETS:=all targets debug install \ web web-questions web-answers \ print print-questions print-answers \ questions answers \ section-questions section-answers \ question-pdfs answer-pdfs \ clean web-clean print-clean .PHONY: $(TARGETS) ################################################################################ # # Build everything. # all: web print ################################################################################ # # Build questions/answers only. # questions: web-questions print-questions answers: web-answers print-answers ################################################################################ # # Build web version only. NOINIT and SECTION should be exported to all # these sub-makes. # web: general-graphics web-questions web-answers web-questions: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d web-questions NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) web-answers: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d web-answers NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) ################################################################################ # # Build print version only. NOINIT and SECTION should be exported to all # these sub-makes. # print: general-graphics print-questions print-answers print-questions: section-questions handbook.pdf handbook-2up.pdf question-pdfs section-questions: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d print-questions NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) handbook.tex: handbook_template.tex $(QUESTION_TEX_INPUTS) $(LOCAL_HANDBOOK_INCLUDE)/questions.patterns $(LATEX_INCLUDES) @$(ANNOUNCE) "Generating $@" @$(ECHO) "% THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!" > $@ @$(ECHO) >> $@ @$(PERL) -p -e "s|\<\@SHOWANSWERS\@\>|hideanswers|;" \ -e "s|\<\@PAPEROPTIONS\@\>|$(PAPER_OPTIONS)|;" \ $(foreach sect,$(SECTION_DIRS),-e "s|\<\@SECTION\[$(notdir $(sect))\]\@\>|\\\\input{$(basename $(filter $(sect)/%,$(QUESTION_TEX_INPUTS)))}|;") $< >> $@ question-pdfs: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d question-pdfs NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) # # Answers # print-answers: section-answers handbook-answers.pdf handbook-answers-2up.pdf answer-pdfs section-answers: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d print-answers NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) handbook-answers.tex: handbook_template.tex $(ANSWER_TEX_INPUTS) $(LOCAL_HANDBOOK_INCLUDE)/answers.patterns $(LATEX_INCLUDES) @$(ANNOUNCE) "Generating $@" @$(ECHO) "% THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!" > $@ @$(ECHO) >> $@ @$(PERL) -p -e "s|\<\@SHOWANSWERS\@\>|showanswers|;" \ -e "s|\<\@PAPEROPTIONS\@\>|$(PAPER_OPTIONS)|;" \ $(foreach sect,$(SECTION_DIRS),-e "s|\<\@SECTION\[$(notdir $(sect))\]\@\>|\\\\input{$(basename $(filter $(sect)/%,$(ANSWER_TEX_INPUTS)))}|;") $< >> $@ answer-pdfs: @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d answer-pdfs NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) # # Generic rules for print version. # %.pdf: %.tex @$(ANNOUNCE) "pdflatex $< (pass 1)" $(PDFLATEX) $< @$(ANNOUNCE) "pdflatex $< (pass 2)" $(PDFLATEX) $< %-2up.pdf: %.pdf @$(ANNOUNCE) "Generating $@" $(PDFNUP) --nup 2x1 --outfile $@ $< ################################################################################ # # Build any general graphics that are used throughout the handbook. This uses # the standard makefile for a content directory, but the only files in this # directory are graphics files. # general-graphics: @if $(MAKE) -C graphics general-graphics BUILD_DIR=$(CURDIR); then $(TRUE); else exit 1; fi ################################################################################ # # Link the appropriate files to the deployment directory, then synchronise this # with Blackboard. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and that it points to a valid directory. All symbolic links # under the install directory are removed first, to ensure that if we # accidentally install the answers when we don't want to, a "make # install-questions" will get rid of them again. Finally we remove any broken # links that might be created along the way. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # install: questions answers @$(ANNOUNCE) "Building deployment links" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(FIND) $(INSTALL_DIRECTORY) -type l -delete @$(foreach d,$(SECTION_DIRS),if $(MAKE) -C $d $@ NOINIT=x SECTION=$(notdir $(d)); then $(TRUE); else exit 1; fi;) @$(ANNOUNCE) "Creating links in $(INSTALL_DIRECTORY)" @$(foreach f,$(INSTALL_FILES),if $(TEST) -f $(CURDIR)/$(f); then $(ECHO) "Linking $(f)"; $(LN_S) -f $(CURDIR)/$(f) $(INSTALL_DIRECTORY); fi;) @$(FIND) $(INSTALL_DIRECTORY) -type l ! -exec test -r {} \; -delete @$(ANNOUNCE) "Synchronising with Blackboard" @$(SITECOPY) --update Blackboard$(PAPER_NUMBER) ################################################################################ # # Clean up all generated files. # "web-clean" and "print-clean" only clean up files for the web and print # versions, respectively. Note that "clean" isn't dependent on either # "web-clean" or "print-clean", to ensure that the correct target is # used when calling the sub-makefile. # clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(ALL_CLEAN_FILES)),) -$(RM) -f $(ALL_CLEAN_FILES) @$(MAKE) -C graphics clean BUILD_DIR=$(CURDIR) endif web-clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(WEB_CLEAN_FILES)),) -$(RM) -f $(WEB_CLEAN_FILES) endif print-clean: @$(foreach d,$(SECTION_DIRS),$(MAKE) -C $d $@;) ifneq ($(strip $(PRINT_CLEAN_FILES)),) -$(RM) -f $(PRINT_CLEAN_FILES) endif ################################################################################ # # Debugging information, mostly lists of the generated variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "LOCAL_HANDBOOK_INCLUDE = [$(LOCAL_HANDBOOK_INCLUDE)]" @$(ECHO) "SECTION_DIRS = [$(SECTION_DIRS)]" @$(ECHO) "QUESTION_TEX_INPUTS = [$(QUESTION_TEX_INPUTS)]" @$(ECHO) "ANSWER_TEX_INPUTS = [$(ANSWER_TEX_INPUTS)]" @$(ECHO) "LATEX_INCLUDES = [$(LATEX_INCLUDES)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "WEB_CLEAN_FILES = [$(WEB_CLEAN_FILES)]" @$(ECHO) "PRINT_CLEAN_FILES = [$(PRINT_CLEAN_FILES)]" @$(ECHO) "ALL_CLEAN_FILES = [$(ALL_CLEAN_FILES)]" @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "PAPER_TITLE = [$(PAPER_TITLE)]" @$(ECHO) "PAPER_YEAR = [$(PAPER_YEAR)]" @$(ECHO) "PAPER_PERIOD = [$(PAPER_PERIOD)]" @$(ECHO) "HANDBOOK_AUTHORS = [$(HANDBOOK_AUTHORS)]" @$(ECHO) "PAPER_OPTIONS = [$(PAPER_OPTIONS)]" ################################################################################ # # Print out the list of targets. Handy for when you forget! # targets: @$(ECHO) $(TARGETS)
Ignore Space
Show notes
View
makefile-templates/install.patterns
################################################################################ # # File: $Id$ # # Defines patterns for lists of documents to be installed on the # web server. For example, only install Tutorials 1, 2, 4, 6-9 and 11. # Patterns for different categories are kept in different files so # that rules can depend on them independently if necessary. # ################################################################################ ################################################################################ # # Which documents to install on the web server. # TUT_QUESTIONS_INSTALL_PATTERN:='tut\(0[1-9]\|1[01]\)' TUT_ANSWERS_INSTALL_PATTERN:='tut\(0[1-9]\|1[01]\)' LAB_QUESTIONS_INSTALL_PATTERN:='lab\(0[1-9]\|1[012]\)' LAB_ANSWERS_INSTALL_PATTERN:='lab\(0[1-9]\|1[012]\)' OTHER_QUESTIONS_INSTALL_PATTERNS:='handbook_root' 'course_outline' 'intro' 'case_study' OTHER_ANSWERS_INSTALL_PATTERNS:='handbook_root' 'course_outline' 'intro' 'case_study' QUESTION_INSTALL_PATTERNS+=$(TUT_QUESTIONS_INSTALL_PATTERN) \ $(LAB_QUESTIONS_INSTALL_PATTERN) $(OTHER_QUESTIONS_INSTALL_PATTERNS) ANSWER_INSTALL_PATTERNS+=$(TUT_ANSWERS_INSTALL_PATTERN) \ $(LAB_ANSWERS_INSTALL_PATTERN) $(OTHER_ANSWERS_INSTALL_PATTERNS)
################################################################################ # # File: $Id$ # # Defines patterns for lists of documents to be installed on the # web server. For example, only install Tutorials 1, 2, 4, 6-9 and 11. # Patterns for different categories are kept in different files so # that rules can depend on them independently if necessary. # ################################################################################ ################################################################################ # # Which documents to install on the web server. # TUT_QUESTIONS_INSTALL_PATTERN:='tut\(0[1-9]\|1[01]\)' TUT_ANSWERS_INSTALL_PATTERN:='tut\(0[1-9]\|1[01]\)' LAB_QUESTIONS_INSTALL_PATTERN:='lab\(0[1-9]\|1[012]\)' LAB_ANSWERS_INSTALL_PATTERN:='lab\(0[1-9]\|1[012]\)' OTHER_QUESTIONS_INSTALL_PATTERNS:='course_outline' 'intro' 'case_study' OTHER_ANSWERS_INSTALL_PATTERNS:='course_outline' 'intro' 'case_study' QUESTION_INSTALL_PATTERNS+=$(TUT_QUESTIONS_INSTALL_PATTERN) \ $(LAB_QUESTIONS_INSTALL_PATTERN) $(OTHER_QUESTIONS_INSTALL_PATTERNS) ANSWER_INSTALL_PATTERNS+=$(TUT_ANSWERS_INSTALL_PATTERN) \ $(LAB_ANSWERS_INSTALL_PATTERN) $(OTHER_ANSWERS_INSTALL_PATTERNS)
Show line notes below