doc: use more implicit rules to build manpages

Use implicit dependency rules to translate asciidoc inputs to HTML and
manpage outputs. We should only have to declare explicit dependencies
for odd cases, e.g. the PKGBUILD documentation has an additional include
file and isn't a 1:1 conversion.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dave Reisner 2018-08-19 17:43:02 -04:00 committed by Allan McRae
parent 9fde55c0c7
commit 3e9a62e721

View file

@ -3,7 +3,7 @@
# files listed in EXTRA_DIST no matter what. However, we only add them to
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
ASCIIDOC_MANS = \
MANPAGES = \
alpm-hooks.5 \
pacman.8 \
makepkg.8 \
@ -66,11 +66,11 @@ EXTRA_DIST = \
submitting-patches.asciidoc \
translation-help.asciidoc \
Doxyfile \
$(ASCIIDOC_MANS) \
$(MANPAGES) \
$(DOXYGEN_MANS)
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8 website.tar.gz
MOSTLYCLEANFILES = *.xml $(MANPAGES) $(HTML_DOCS) repo-remove.8 website.tar.gz
# Ensure manpages are fresh when building a dist tarball
dist-hook:
@ -85,7 +85,7 @@ REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif
man_MANS =
dist_man_MANS = $(ASCIIDOC_MANS)
dist_man_MANS = $(MANPAGES)
if USE_DOXYGEN
man_MANS += $(DOXYGEN_MANS)
@ -96,6 +96,7 @@ doxygen.in:
$(DOXYGEN) $(srcdir)/Doxyfile
endif
man: $(MANPAGES)
html: $(HTML_DOCS)
website: website.tar.gz
@ -129,11 +130,12 @@ A2X_OPTS = \
-f manpage \
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
# These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.asciidoc Makefile.am
# Generate manpages
%: %.asciidoc asciidoc.conf footer.asciidoc Makefile.am
$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.asciidoc
%.html: %.asciidoc
# Generate HTML pages
%.html: %.asciidoc asciidoc.conf footer.asciidoc Makefile.am
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.asciidoc | \
sed -e 's/\r$$//' > $@
@ -142,27 +144,15 @@ HACKING.html: ../HACKING
sed -e 's/\r$$//' > $@
# Customizations for certain HTML docs
$(HTML_MANPAGES): asciidoc.conf footer.asciidoc Makefile.am
$(HTML_OTHER): asciidoc.conf Makefile.am
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons -a max-width=960px -a stylesheet=asciidoc-override.css
%.8.html: ASCIIDOC_OPTS += -d manpage
%.5.html: ASCIIDOC_OPTS += -d manpage
%.3.html: ASCIIDOC_OPTS += -d manpage
# Dependency rules
alpm-hooks.5 alpm-hooks.5.html: alpm-hooks.5.asciidoc
pacman.8 pacman.8.html: pacman.8.asciidoc
makepkg.8 makepkg.8.html: makepkg.8.asciidoc
makepkg-template.1 makepkg-template.1.html: makepkg-template.1.asciidoc
repo-add.8 repo-add.8.html: repo-add.8.asciidoc
vercmp.8 vercmp.8.html: vercmp.8.asciidoc
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.asciidoc
pacman-key.8 pacman-key.8.html: pacman-key.8.asciidoc
# Custom dependency rules
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.asciidoc PKGBUILD-example.txt
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.asciidoc
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.asciidoc
libalpm.3 libalpm.3.html: libalpm.3.asciidoc
# this one is just a symlink
# Manpages as symlinks
repo-remove.8: repo-add.8
$(RM) repo-remove.8
$(LN_S) repo-add.8 repo-remove.8