diff --git a/make-includes/build_document_rules.make b/make-includes/build_document_rules.make index b497524..541bfcf 100755 --- a/make-includes/build_document_rules.make +++ b/make-includes/build_document_rules.make @@ -39,7 +39,8 @@ ################################################################################ # # We make quite a lot of reference to files in the handbook directory, -# so set a variable to point to it. +# so set a variable to point to it. PAPER_ROOT is defined in the include +# file paper_variables.make. # HANDBOOK_ROOT:=$(PAPER_ROOT)/Handbook @@ -116,6 +117,35 @@ ################################################################################ # +# Extract the list of included filenames from the source template. Hooray +# for the shell function and Perl! Include file paths are delimited by +# <@INC[ ]@>. All paths are relative to $(PAPER_ROOT). We don't use +# $(PAPER_ROOT)/$(SECTION), because some of the include directories may be +# in relatively arbitrary locations. +# +CONTENT_SRC:=$(shell perl -ne 'print "$(PAPER_ROOT)/$(notdir $(SECTION))/$$1\n" if /<\@INC\[([^]]+)\]@>/;' $(SOURCE_XML)) + + +################################################################################ +# +# Directory to install files into on web server. +# +INSTALL_DIRECTORY:=$(HANDBOOK_INSTALL_ROOT)/$(SUBJECT_CODE)$(PAPER_NUMBER)/www/$(SECTION)/$(BASE_NAME) + + +################################################################################ +# +# Files to be installed on web server. +# +QUESTION_INSTALL_FILES:=$(WEB_QUESTIONS_HTML) $(PRINT_QUESTIONS_PDF_1UP) \ + $(PRINT_QUESTIONS_PDF_2UP) $(wildcard *.png) + +ANSWER_INSTALL_FILES:=$(WEB_ANSWERS_HTML) $(PRINT_ANSWERS_PDF_1UP) \ + $(PRINT_ANSWERS_PDF_2UP) + + +################################################################################ +# # Lists of files for cleaning up. Add to these (using +=) as necessary in # derived makefiles. # @@ -126,21 +156,10 @@ ################################################################################ # -# Extract the list of included filenames from the source template. Hooray -# for the shell function and Perl! Include file paths are delimited by -# <@INC[ ]@>. All paths are relative to $(PAPER_ROOT). We don't use -# $(PAPER_ROOT)/$(SECTION), because some the include directories may be in -# relatively arbitrary locations. -# -CONTENT_SRC:=$(shell perl -ne 'print "$(PAPER_ROOT)/$(notdir $(SECTION))/$$1\n" if /<\@INC\[([^]]+)\]@>/;' $(SOURCE_XML)) - - -################################################################################ -# # List of possible targets. If you need to add to this for a specific # case, use TARGETS+=xxx in the actual makefile. # -TARGETS:=all content targets debug \ +TARGETS:=all content targets debug install-questions install-answers \ web web-questions web-answers \ print print-questions print-answers \ questions answers \ @@ -312,7 +331,7 @@ # content: # Of course, there's little point in doing anything if there's no content! -ifneq (,$(strip $(CONTENT_SRC))) +ifneq ($(strip $(CONTENT_SRC)),) @if test ! -f content-checked; then \ announce "Checking content for $(BASE_NAME)"; \ fi @@ -337,16 +356,47 @@ ################################################################################ # +# Install the appropriate files on the web server. This relies on the +# environment variable HANDBOOK_INSTALL_DIRECTORY being defined, and +# (assuming that this variable points to a directory on the network) the +# appropriate share has been mounted. +# +# !!! How do we get it to also install any extra files that we require +# for a particular content file (e.g., the SQL code for Tutorial 3)? !!! +# +install-questions: $(QUESTION_INSTALL_FILES) + @test -d $(HANDBOOK_INSTALL_ROOT) +ifneq ($(strip $(QUESTION_INSTALL_FILES)),) + cp $(QUESTION_INSTALL_FILES) $(INSTALL_DIRECTORY) +endif + +install-answers: $(ANSWER_INSTALL_FILES) + @test -d $(HANDBOOK_INSTALL_ROOT) +ifneq ($(strip $(ANSWER_INSTALL_FILES)),) + cp $(ANSWER_INSTALL_FILES) $(INSTALL_DIRECTORY) +endif + + +################################################################################ +# # Clean up. # clean: web-clean print-clean +ifneq ($(strip $(ALL_CLEAN_FILES)),) -rm -f $(ALL_CLEAN_FILES) +endif + web-clean: +ifneq ($(strip $(WEB_CLEAN_FILES)),) -rm -f $(WEB_CLEAN_FILES) +endif + print-clean: +ifneq ($(strip $(PRINT_CLEAN_FILES)),) -rm -f $(PRINT_CLEAN_FILES) +endif ################################################################################ @@ -354,7 +404,12 @@ # Debugging information, mostly lists of the generated variables. # debug: + @announce Externally defined variables + @echo "TEACHING_SHARED = [$(TEACHING_SHARED)]" + @echo "ALL_PAPERS_ROOT = [$(ALL_PAPERS_ROOT)]" + @echo "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @echo "NOINIT = [$(NOINIT)]" + @announce Internally defined variables @echo "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @echo "LOCAL_HANDBOOK_INCLUDE = [$(LOCAL_HANDBOOK_INCLUDE)]" @echo "SUBJECT_CODE = [$(SUBJECT_CODE)]" @@ -376,6 +431,8 @@ @echo "DERIVED_WEB_FILES = [$(DERIVED_WEB_FILES)]" @echo "DERIVED_PRINT_FILES = [$(DERIVED_PRINT_FILES)]" @echo "CONTENT_SRC = [$(CONTENT_SRC)]" + @echo "QUESTION_INSTALL_FILES = [$(QUESTION_INSTALL_FILES)]" + @echo "ANSWER_INSTALL_FILES = [$(ANSWER_INSTALL_FILES)]" @echo "WEB_CLEAN_FILES = [$(WEB_CLEAN_FILES)]" @echo "PRINT_CLEAN_FILES = [$(PRINT_CLEAN_FILES)]" @echo "ALL_CLEAN_FILES = [$(ALL_CLEAN_FILES)]"