]> mj.ucw.cz Git - libucw.git/blobdiff - build/Makebottom
ucw docs: parser units
[libucw.git] / build / Makebottom
index 38e84bce1b0366b643c82fb840a1572867d20a0a..ed4b30f7bcd3f3287d6cd5d182a2b6ab1e4b5788 100644 (file)
@@ -3,7 +3,9 @@
 
 # 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
@@ -16,7 +18,7 @@ programs: $(PROGS)
 datafiles: $(DATAFILES)
 tests: $(TESTS)
 configs: $(addprefix run/$(CONFIG_DIR)/,$(CONFIGS))
-docs: runtree $(DOCS) $(DOC_INDECES)
+docs: runtree $(DOCS) $(DOC_INDICES)
 
 tags:
        etags `find . -name "*.[ch]"`
@@ -193,19 +195,24 @@ $(DATAFILES): $(o)/%: $(s)/%
        $(Q)$(call symlink,$@,run/$(DATADIR))
 
 # Rules for documentation
-$(o)/%.html: $(o)/%.txt
-       $(M)"AD $< -> $@"
+
+
+$(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))
 
-$(patsubst %.html,%.txt,$(DOC_INDECES)): $(o)/%.txt:
-       $(M)"DD -> $@"
+# 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
+# and .deflist, so we always use the .txt's in dependencies.
+$(patsubst %.html,%.txt,$(DOC_INDICES)): $(o)/%.txt: $(patsubst %.html,%.txt,$(DOCS)) $(s)/build/doc-defs
+       $(M)"DOC-DEFS $@"
        $(Q)echo $@: $(DOC_HEAD) $(DOC_LIST) >> $(o)/depend.new
-       $(Q)$(s)/build/def-doc.pl $(DOC_HEAD) $@ $(DOC_LIST)
+       $(Q)$(s)/build/doc-defs $(DOC_HEAD) $@ $(DOC_LIST)
 
-#FIXME: this one outputs .deflist too. How do I specify that one run of the rule has multiple target files?
-$(patsubst %.html,%.txt,$(DOCS)): $(o)/%.txt: $(s)/%.txt
-       $(M)"ED $< -> $@"
-       $(Q)$(s)/build/extract-doc.pl $< $@ $(o)/depend.new $(s) $(patsubst %.txt,%.deflist,$@)
+$(patsubst %.html,%.txt,$(DOCS)): $(o)/%.txt: $(s)/%.txt $(s)/build/doc-extract
+       $(M)"DOC-EXT $<"
+       $(Q)$(s)/build/doc-extract $< $@ $(o)/depend.new $(s) $(patsubst %.txt,%.deflist,$@)
 
 # Default installation target
 
@@ -217,4 +224,4 @@ default-install:
 # 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