# The run tree
-runtree: run/.tree-stamp $(addsuffix /.dir-stamp,$(addprefix $(o)/,$(DIRS)))
+DOCDIR=doc
+
+runtree: run/.tree-stamp $(addsuffix /.dir-stamp,$(addprefix $(o)/,$(DIRS)) $(addprefix run/$(DOCDIR)/,$(DOC_MODULES)))
run/.tree-stamp: $(o)/config.mk
$(M)Creating runtree
# Rules for documentation
-$(o)/%.html: $(o)/%.txt $(s)/build/asciidoc.conf $(s)/build/asciidoc-xhtml.conf
+$(o)/%.html: $(o)/%.txt $(s)/build/asciidoc.conf $(s)/build/asciidoc-xhtml.conf run/$(DOCDIR)/$(DOC_MODULE)/.dir-stamp
$(M)"DOC-HTML $<"
$(Q)asciidoc -e -f $(s)/build/asciidoc.conf -f $(s)/build/asciidoc-xhtml.conf -f /etc/asciidoc/asciidoc.conf -f /etc/asciidoc/xhtml11.conf $<
+ $(Q)$(call symlink,$@,run/$(DOCDIR)/$(DOC_MODULE))
# In reality, we do not depend on the .txt files, but on the corresponding .deflist's.
# However, the Makefile language cannot express that doc-extract generates both .txt
# when searching for implicit rules and thence targets considered intermediate.
.SECONDARY:
-.PHONY: all clean distclean runtree programs api datafiles force tags configs dust install default-install
+.PHONY: all clean distclean runtree programs api datafiles force tags configs dust install default-install docs