docs/man: Fix/simplify generation of manpages

The original intent of this patch was to rename xen-vbd-interface.markdown.7
to xen-vbd-interface.pandoc.7 to remove the final markdown file from the docs/
tree.

The DOC_MANx lists are broken.  They contain MANxSRC-y twice, the first half
with a partial %.pod substituation, and the second half with a partial
%.markdown substitution.  This is also the root cause behind the filtering
activity in the uninstall-man$(i)-pages rule.

Furthermore, the logic for generating the manpage targets is unnecesserily
repetative, owing to the layout of source files in the man/ directory.

Therefore, tackle the problem by renaming all of our manpage source files from
"$FORMAT.$SECTION" to "$SECTION.$FORMAT".  For the two xl.cfg.5 and xl.1 which
are preprocessed by autoconf to contain path information, this requires
updating configure.ac and .gitignore.  The markdown to pandoc conversion is
performed as well, as it is also a straight rename.

An ancillary benefit of this renaming is that text editors stand a chance of
being able to work out the correct mode to use.

As for the makefile:

1) Break the MAN_SECTIONS list out of the GENERATE_MANPAGE_RULES loop, as we
   are going to use it a second time.
2) Do away with the individaul MANxSRC-y variables.  Use a single list,
   derived from all *.pod and *.pandoc files, with their format suffixes
   removed.
3) Use a $(foreach ...) to generate the DOC_MANx lists, filling them with the
   correct content.
4) The DOC_HTML and DOC_TXT can now include all manpages with a single
   substitution, as they don't need to separate the manpages by
   section-numbered-directory.
5) Fix up the filenames in the manpage metarule to match the renaming.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Andrew Cooper committed 2019-01-02 17:50:36 +00:00
1 parent d661611d08
commit 8410fcb54a
25 files changed
+23 -43

No files matched your search

+2 -2
View File
@@ -45,8 +45,8 @@ build-*
dist/*
docs/tmp.*
docs/html/
docs/man/xl.cfg.pod.5
docs/man/xl.pod.1
docs/man/xl.cfg.5.pod
docs/man/xl.1.pod
docs/man1/
docs/man5/
docs/man7/
+16 -36
View File
@@ -6,12 +6,10 @@ VERSION := $(shell $(MAKE) -C $(XEN_ROOT)/xen --no-print-directory xenversion)
DATE := $(shell date +%Y-%m-%d)
DOC_ARCHES := arm x86_32 x86_64
MAN_SECTIONS := 1 5 7 8
# Documentation sources to build
MAN1SRC-y := $(sort $(wildcard man/*.pod.1 man/*.markdown.1))
MAN5SRC-y := $(sort $(wildcard man/*.pod.5 man/*.markdown.5))
MAN7SRC-y := $(sort $(wildcard man/*.pod.7 man/*.markdown.7))
MAN8SRC-y := $(sort $(wildcard man/*.pod.8 man/*.markdown.8))
MAN-SRC-y := $(sort $(basename $(wildcard man/*.pod man/*.pandoc)))
MARKDOWNSRC-y := $(sort $(shell find misc -name '*.markdown' -print))
@@ -20,38 +18,20 @@ TXTSRC-y := $(sort $(shell find misc -name '*.txt' -print))
PANDOCSRC-y := $(sort $(shell find designs/ features/ misc/ process/ specs/ -name '*.pandoc' -print))
# Documentation targets
DOC_MAN1 := $(patsubst man/%.pod.1,man1/%.1,$(MAN1SRC-y)) \
$(patsubst man/%.markdown.1,man1/%.1,$(MAN1SRC-y))
DOC_MAN5 := $(patsubst man/%.pod.5,man5/%.5,$(MAN5SRC-y)) \
$(patsubst man/%.markdown.5,man5/%.5,$(MAN5SRC-y))
DOC_MAN7 := $(patsubst man/%.pod.7,man7/%.7,$(MAN7SRC-y)) \
$(patsubst man/%.markdown.7,man7/%.7,$(MAN7SRC-y))
DOC_MAN8 := $(patsubst man/%.pod.8,man8/%.8,$(MAN8SRC-y)) \
$(patsubst man/%.markdown.8,man8/%.8,$(MAN8SRC-y))
$(foreach i,$(MAN_SECTIONS), \
$(eval DOC_MAN$(i) := $(patsubst man/%.$(i),man$(i)/%.$(i), \
$(filter %.$(i),$(MAN-SRC-y)))))
DOC_HTML := html/SUPPORT.html \
$(patsubst %.markdown,html/%.html,$(MARKDOWNSRC-y)) \
$(patsubst %.pandoc,html/%.html,$(PANDOCSRC-y)) \
$(patsubst man/%.markdown.1,html/man/%.1.html,$(MAN1SRC-y)) \
$(patsubst man/%.markdown.5,html/man/%.5.html,$(MAN5SRC-y)) \
$(patsubst man/%.markdown.7,html/man/%.7.html,$(MAN7SRC-y)) \
$(patsubst man/%.markdown.8,html/man/%.8.html,$(MAN8SRC-y)) \
$(patsubst man/%.pod.1,html/man/%.1.html,$(MAN1SRC-y)) \
$(patsubst man/%.pod.5,html/man/%.5.html,$(MAN5SRC-y)) \
$(patsubst man/%.pod.7,html/man/%.7.html,$(MAN7SRC-y)) \
$(patsubst man/%.pod.8,html/man/%.8.html,$(MAN8SRC-y)) \
$(patsubst %,html/%.html,$(MAN-SRC-y)) \
$(patsubst %.txt,html/%.txt,$(TXTSRC-y)) \
$(patsubst %,html/hypercall/%/index.html,$(DOC_ARCHES))
DOC_TXT := $(patsubst %.txt,txt/%.txt,$(TXTSRC-y)) \
$(patsubst %.markdown,txt/%.txt,$(MARKDOWNSRC-y)) \
$(patsubst %.pandoc,txt/%.txt,$(PANDOCSRC-y)) \
$(patsubst man/%.markdown.1,txt/man/%.1.txt,$(MAN1SRC-y)) \
$(patsubst man/%.markdown.5,txt/man/%.5.txt,$(MAN5SRC-y)) \
$(patsubst man/%.markdown.7,txt/man/%.7.txt,$(MAN7SRC-y)) \
$(patsubst man/%.markdown.8,txt/man/%.8.txt,$(MAN8SRC-y)) \
$(patsubst man/%.pod.1,txt/man/%.1.txt,$(MAN1SRC-y)) \
$(patsubst man/%.pod.5,txt/man/%.5.txt,$(MAN5SRC-y)) \
$(patsubst man/%.pod.7,txt/man/%.7.txt,$(MAN7SRC-y)) \
$(patsubst man/%.pod.8,txt/man/%.8.txt,$(MAN8SRC-y))
$(patsubst %,txt/%.txt,$(MAN-SRC-y))
DOC_PDF := $(patsubst %.markdown,pdf/%.pdf,$(MARKDOWNSRC-y)) \
$(patsubst %.pandoc,pdf/%.pdf,$(PANDOCSRC-y))
@@ -99,7 +79,7 @@ distclean: clean
define GENERATE_MANPAGE_RULES
# Real manpages
man$(1)/%.$(1): man/%.pod.$(1) Makefile
man$(1)/%.$(1): man/%.$(1).pod Makefile
ifneq ($(POD2MAN),)
@$(INSTALL_DIR) $$(@D)
$(POD2MAN) --release=$(VERSION) --name=$$* -s $(1) -c "Xen" $$< $$@
@@ -107,7 +87,7 @@ else
@echo "pod2man not installed; skipping $$@"
endif
man$(1)/%.$(1): man/%.markdown.$(1) Makefile
man$(1)/%.$(1): man/%.$(1).pandoc Makefile
ifneq ($(PANDOC),)
@$(INSTALL_DIR) $$(@D)
$(PANDOC) --standalone -V title=$$* -V section=$(1) \
@@ -118,7 +98,7 @@ else
endif
# HTML manpages
html/man/%.$(1).html: man/%.pod.$(1) Makefile
html/man/%.$(1).html: man/%.$(1).pod Makefile
ifneq ($(POD2HTML),)
@$(INSTALL_DIR) $$(@D)
$(POD2HTML) --infile=$$< --outfile=$$@
@@ -126,7 +106,7 @@ else
@echo "pod2html not installed; skipping $$@"
endif
html/man/%.$(1).html: man/%.markdown.$(1) Makefile
html/man/%.$(1).html: man/%.$(1).pandoc Makefile
ifneq ($(PANDOC),)
@$(INSTALL_DIR) $$(@D)
$(PANDOC) --standalone $$< -t html --toc --output $$@
@@ -135,7 +115,7 @@ else
endif
# Text manpages
txt/man/%.$(1).txt: man/%.pod.$(1) Makefile
txt/man/%.$(1).txt: man/%.$(1).pod Makefile
ifneq ($(POD2TEXT),)
@$(INSTALL_DIR) $$(@D)
$(POD2TEXT) $$< $$@
@@ -143,7 +123,7 @@ else
@echo "pod2text not installed; skipping $$@"
endif
txt/man/%.$(1).txt: man/%.markdown.$(1) Makefile
txt/man/%.$(1).txt: man/%.$(1).pandoc Makefile
ifneq ($(PANDOC),)
@$(INSTALL_DIR) $$(@D)
$(PANDOC) --standalone $$< -t plain --output $$@
@@ -169,7 +149,7 @@ clean-man$(1)-pages:
# Uninstall
.PHONY: uninstall-man$(1)-pages
uninstall-man$(1)-pages:
rm -f $(addprefix $(DESTDIR)$(mandir)/man$(1)/, $(filter-out %.pod.$(1) %.markdown.$(1), $(notdir $(DOC_MAN$(1)))))
rm -f $(addprefix $(DESTDIR)$(mandir)/,$(DOC_MAN$(1)))
# Link buld/install/clean to toplevel rules
man-pages: man$(1)-pages
@@ -180,7 +160,7 @@ uninstall-man-pages: uninstall-man$(1)-pages
endef
# Generate manpage rules for each section
$(foreach i,1 5 7 8,$(eval $(call GENERATE_MANPAGE_RULES,$(i))))
$(foreach i,$(MAN_SECTIONS),$(eval $(call GENERATE_MANPAGE_RULES,$(i))))
.PHONY: install-html
install-html: html txt figs
+3 -3
View File
@@ -1752,7 +1752,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.pod.5 man/xl.pod.1"
ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod"
ac_aux_dir=
for ac_dir in ../ "$srcdir"/../; do
@@ -3031,8 +3031,8 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"../config/Docs.mk") CONFIG_FILES="$CONFIG_FILES ../config/Docs.mk" ;;
"man/xl.cfg.pod.5") CONFIG_FILES="$CONFIG_FILES man/xl.cfg.pod.5" ;;
"man/xl.pod.1") CONFIG_FILES="$CONFIG_FILES man/xl.pod.1" ;;
"man/xl.cfg.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.cfg.5.pod" ;;
"man/xl.1.pod") CONFIG_FILES="$CONFIG_FILES man/xl.1.pod" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
+2 -2
View File
@@ -7,8 +7,8 @@ AC_INIT([Xen Hypervisor Documentation], m4_esyscmd([../version.sh ../xen/Makefil
AC_CONFIG_SRCDIR([misc/xen-command-line.markdown])
AC_CONFIG_FILES([
../config/Docs.mk
man/xl.cfg.pod.5
man/xl.pod.1
man/xl.cfg.5.pod
man/xl.1.pod
])
AC_CONFIG_AUX_DIR([../])
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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.