docs/build: Move install checks into individual build targets

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>
This commit is contained in:
Andrew Cooper authored and Ian Campbell committed 2015-04-22 14:47:44 +01:00
1 parent d6e4d499f8
commit 74fcdb636e
1 file changed
+26 -29
+26 -29
View 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:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.