summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorJulien Rioux <jrioux@physics.utoronto.ca>2011-12-18 18:09:37 -0500
committerGraham Percival <graham@percival-music.ca>2011-12-25 18:34:46 -0800
commit0f5f5f062fda87919c5ee46dffb58e0e5798b7f4 (patch)
tree4e5f9865ca8882752d6bcc11c07f7f58b11129fe /make
parent4615135bf10e1a78b3658162575c46aca2f73a38 (diff)
Build: Dependencies for make website (issue 2027).
Diffstat (limited to 'make')
-rw-r--r--make/website.make36
1 files changed, 32 insertions, 4 deletions
diff --git a/make/website.make b/make/website.make
index 36fd7a55a5..18da8feba8 100644
--- a/make/website.make
+++ b/make/website.make
@@ -98,6 +98,34 @@ MANUALS_WEB := web.texi $(WEB_LANGS:%=web.%.texi)
MANUALS_BASE = $(basename $(MANUALS) $(MANUALS_WEB))
+#######################
+### Dependency tracking
+
+# Find the file $(1) within the texinfo include dirs and return its path.
+# If not found, i.e. it is a generated file, then the file is ignored.
+find-texi = \
+$(firstword \
+ $(wildcard $(dir $<)$(1)) \
+ $(wildcard $(top-src-dir)/Documentation/$(1)) \
+)
+
+# Recursively scan the file $(1) for @include, search for included files
+# within the texinfo include dirs, and return all dependencies.
+scan-texi = \
+ $(foreach f, $(shell echo | sed -ne "/^@include[[:space:]]/s/@include//p" $(1)), \
+ $(call find-texi,$(f)) \
+ $(call scan-texi,$(call find-texi,$(f))) \
+)
+
+# Find dependencies for the target $@, based on the texinfo source file $<,
+# and write the dependencies to a .dep file.
+DO_TEXI_DEP = ( mkdir -p $(dir $@) && echo ./$@: $(call scan-texi,$<) > $@.dep ) &&
+
+# This is where we import the .dep files so that `make' knows about
+# the various dependencies.
+-include dummy.dep $(wildcard $(OUT)/*.dep) $(wildcard $(OUT)/*/*.dep)
+
+
###################
### Generated files
@@ -174,10 +202,10 @@ $(OUT)/pictures: $(OUT)/website/pictures
ln -sf website/pictures $(OUT)/pictures
# Generated itexi files
-$(OUT)/version.itexi: #FIXME: add dependencies
+$(OUT)/version.itexi: $(top-src-dir)/VERSION
$(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
-$(OUT)/weblinks.itexi: #FIXME: add dependencies
+$(OUT)/weblinks.itexi: $(top-src-dir)/VERSION
$(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
$(bib-files): $(OUT)/%.itexi: $(top-src-dir)/Documentation/web/%.bib
@@ -211,12 +239,12 @@ $(OUT)/web.%.xref-map: $(top-src-dir)/Documentation/%/web.texi
$(DO_TEXI_DEP) $(EXTRACT_TEXI_FILENAMES) --split=node $<
# Build the English website
-$(OUT)/index.html: $(top-src-dir)/Documentation/web.texi
+$(OUT)/index.html: $(top-src-dir)/Documentation/web.texi $(xref-files)
$(DO_TEXI_DEP) $(TEXI2HTML) $<
# Build translated websites
$(eval $(foreach l,$(WEB_LANGS),\
-$(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi; \
+$(eval $(OUT)/$(l)/index.html: $(top-src-dir)/Documentation/$(l)/web.texi $(xref-files); \
$$(DO_TEXI_DEP) $$(TEXI2HTML) --lang="$(l)" $$<; ) \
))