]> xenbits.xensource.com Git - xen.git/commitdiff
docs/build: Move install checks into individual build targets
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 Apr 2015 15:47:05 +0000 (16:47 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 22 Apr 2015 13:47:44 +0000 (14:47 +0100)
For top-level targets which use more than a single program to produce content
(txt already, pdf once pandoc is supported), these current checks are
unsuitable.

By moving the the install checks to the rules which actually use the programs,
it is now possible to build a subset of a top-level target depending on the
installed programs.

As a bonus, it removes the need to recurse for txt, man-pages and pdf targets.

A side effect of this is that every individual source which cannot be
generated will have a specific message logged, giving the file and program.
As such, these message are updated to consistently report the target file
which was not generated.

Finally, update "ifdef foo" to "ifneq($(foo),)" to be more resilient to errors
caused by having foo defined as an empty string.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
docs/Makefile

index 6de05e4514ff12c86577fc97442d9b3770b5437f..4306a9548b2f5d475513cb85a6f1376c3f6a2f35 100644 (file)
@@ -41,36 +41,21 @@ build: html txt pdf man-pages figs
 html: $(DOC_HTML) html/index.html
 
 .PHONY: txt
-txt:
-ifdef POD2TEXT
-       $(MAKE) $(DOC_TXT)
-else
-       @echo "pod2text not installed; skipping text outputs."
-endif
+txt: $(DOC_TXT)
 
 .PHONY: figs
 figs:
-ifdef FIG2DEV
+ifneq ($(FIG2DEV),)
        set -x; $(MAKE) -C figs
 else
        @echo "fig2dev (transfig) not installed; skipping figs."
 endif
 
 .PHONY: man-pages
-man-pages:
-ifdef POD2MAN
-       $(MAKE) $(DOC_MAN1) $(DOC_MAN5)
-else
-       @echo "pod2man not installed; skipping man-pages."
-endif
+man-pages: $(DOC_MAN1) $(DOC_MAN5)
 
 .PHONY: pdf
-pdf:
-ifdef PANDOC
-       $(MAKE) $(DOC_PDF)
-else
-       @echo "pandoc not installed; skipping pdfs."
-endif
+pdf: $(DOC_PDF)
 
 .PHONY: clean
 clean:
@@ -103,22 +88,30 @@ install: install-man-pages install-html
 
 # Individual file build targets
 man1/%.1: man/%.pod.1 Makefile
+ifneq ($(POD2MAN),)
        @$(INSTALL_DIR) $(@D)
        $(POD2MAN) --release=$(VERSION) --name=$* -s 1 -c "Xen" $< $@
+else
+       @echo "pod2man not installed; skipping $@"
+endif
 
 man5/%.5: man/%.pod.5 Makefile
+ifneq ($(POD2MAN),)
        @$(INSTALL_DIR) $(@D)
        $(POD2MAN) --release=$(VERSION) --name=$* -s 5 -c "Xen" $< $@
+else
+       @echo "pod2man not installed; skipping $@"
+endif
 
 html/index.html: $(DOC_HTML) $(CURDIR)/gen-html-index INDEX
        $(PERL) -w -- $(CURDIR)/gen-html-index -i INDEX html $(DOC_HTML)
 
 html/%.html: %.markdown
-ifdef MARKDOWN
+ifneq ($(MARKDOWN),)
        @$(INSTALL_DIR) $(@D)
        $(MARKDOWN) $< > $@
 else
-       @echo "markdown not installed; skipping $*.html."
+       @echo "markdown not installed; skipping $@"
 endif
 
 html/%.txt: %.txt
@@ -126,19 +119,19 @@ html/%.txt: %.txt
        $(INSTALL_DATA) $< $@
 
 html/man/%.1.html: man/%.pod.1 Makefile
-ifdef POD2HTML
+ifneq ($(POD2HTML),)
        @$(INSTALL_DIR) $(@D)
        $(POD2HTML) --infile=$< --outfile=$@
 else
-       @echo "pod2html not installed; skipping $<."
+       @echo "pod2html not installed; skipping $@"
 endif
 
 html/man/%.5.html: man/%.pod.5 Makefile
-ifdef POD2HTML
+ifneq ($(POD2HTML),)
        @$(INSTALL_DIR) $(@D)
        $(POD2HTML) --infile=$< --outfile=$@
 else
-       @echo "pod2html not installed; skipping $<."
+       @echo "pod2html not installed; skipping $@"
 endif
 
 # For non-x86 arches exclude the subarch whole x86 arch.
@@ -165,24 +158,28 @@ txt/%.txt: %.markdown
        $(INSTALL_DATA) $< $@
 
 txt/man/%.1.txt: man/%.pod.1 Makefile
-ifdef POD2TEXT
+ifneq ($(POD2TEXT),)
        @$(INSTALL_DIR) $(@D)
        $(POD2TEXT) $< $@
 else
-       @echo "pod2text not installed; skipping $<."
+       @echo "pod2text not installed; skipping $@"
 endif
 
 txt/man/%.5.txt: man/%.pod.5 Makefile
-ifdef POD2TEXT
+ifneq ($(POD2TEXT),)
        @$(INSTALL_DIR) $(@D)
        $(POD2TEXT) $< $@
 else
-       @echo "pod2text not installed; skipping $<."
+       @echo "pod2text not installed; skipping $@"
 endif
 
 pdf/%.pdf: %.markdown
+ifneq ($(PANDOC),)
        @$(INSTALL_DIR) $(@D)
        $(PANDOC) --number-sections --toc --standalone $< --output $@
+else
+       @echo "pandoc not installed; skipping $@"
+endif
 
 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 $(XEN_ROOT)/config/Docs.mk: