diff --git a/make-includes/build_document_rules.make b/make-includes/build_document_rules.make index 4bb19f6..45cef18 100755 --- a/make-includes/build_document_rules.make +++ b/make-includes/build_document_rules.make @@ -366,20 +366,27 @@ # (assuming that this variable points to a directory on the network) the # appropriate share has been mounted. # +# This checks each file in the build directory against the corresponding +# file in the install directory. The local file is only copied to the +# install directory if it is newer, or the remote file doesn't exist. I +# was going to do the "newer" testing using a target rule that dealt with +# each file individually, but for some weird reason it would ignore any +# additional files appended to the *_INSTALL_FILES variables. So I've done +# it with a foreach instead, which _does_ work. (Ick, although ironically +# the code is shorter.) +# # !!! 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) +install-questions: @test -d $(HANDBOOK_INSTALL_ROOT) -ifneq ($(strip $(QUESTION_INSTALL_FILES)),) - cp $(QUESTION_INSTALL_FILES) $(INSTALL_DIRECTORY) -endif + @mkdir -p $(INSTALL_DIRECTORY) + @$(foreach f,$(QUESTION_INSTALL_FILES),if test ! -f $(INSTALL_DIRECTORY)/$(f) -o $(f) -nt $(INSTALL_DIRECTORY)/$(f); then echo "Installing $(f)"; cp $(f) $(INSTALL_DIRECTORY); fi;) -install-answers: $(ANSWER_INSTALL_FILES) +install-answers: @test -d $(HANDBOOK_INSTALL_ROOT) -ifneq ($(strip $(ANSWER_INSTALL_FILES)),) - cp $(ANSWER_INSTALL_FILES) $(INSTALL_DIRECTORY) -endif + @mkdir -p $(INSTALL_DIRECTORY) + @$(foreach f,$(ANSWER_INSTALL_FILES),if test ! -f $(INSTALL_DIRECTORY)/$(f) -o $(f) -nt $(INSTALL_DIRECTORY)/$(f); then echo "Installing $(f)"; cp $(f) $(INSTALL_DIRECTORY); fi;) ################################################################################ @@ -436,6 +443,7 @@ @echo "DERIVED_WEB_FILES = [$(DERIVED_WEB_FILES)]" @echo "DERIVED_PRINT_FILES = [$(DERIVED_PRINT_FILES)]" @echo "CONTENT_SRC = [$(CONTENT_SRC)]" + @echo "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @echo "QUESTION_INSTALL_FILES = [$(QUESTION_INSTALL_FILES)]" @echo "ANSWER_INSTALL_FILES = [$(ANSWER_INSTALL_FILES)]" @echo "WEB_CLEAN_FILES = [$(WEB_CLEAN_FILES)]"