From 7c73f2a20ed1d9fcea65521fd38d31b3b5f9c02e Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 4 Mar 2018 10:45:50 +0100 Subject: [PATCH] Improve man page generation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Use AsciiDoc’s a2x tool instead of running xsltproc explicitly. * Stow away ccache.1 in doc. * Make AsciiDoc literals stand out as bold in the man page. We can now use properly literals instead of emphasis in the manual. --- .gitignore | 2 +- Makefile.in | 4 ++-- dev.mk.in | 21 ++++++++++++--------- doc/INSTALL.md | 1 - 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index fb7d3985f..c82bc5b9e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ Makefile autom4te.cache ccache ccache-*.tar.* -ccache.1 config.cache config.h config.h.in @@ -18,6 +17,7 @@ config.status configure dev.mk dev_mode_disabled +doc/ccache.1 perfdir.* src/version.c testdir.* diff --git a/Makefile.in b/Makefile.in index b7dbd4398..3c52843a2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,11 +96,11 @@ ccache$(EXEEXT): $(ccache_objs) $(extra_libs) $(CC) $(all_cflags) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS) .PHONY: install -install: all $(srcdir)/ccache.1 +install: all $(srcdir)/doc/ccache.1 $(installcmd) -d $(DESTDIR)$(bindir) $(installcmd) -m 755 ccache$(EXEEXT) $(DESTDIR)$(bindir) $(installcmd) -d $(DESTDIR)$(mandir)/man1 - -$(installcmd) -m 644 $(srcdir)/ccache.1 $(DESTDIR)$(mandir)/man1/ + -$(installcmd) -m 644 $(srcdir)/doc/ccache.1 $(DESTDIR)$(mandir)/man1/ .PHONY: clean clean: diff --git a/dev.mk.in b/dev.mk.in index 24ea01d9e..a0775f33e 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -3,17 +3,13 @@ all_cflags += -Werror all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d +A2X = a2x ASCIIDOC = asciidoc CPPCHECK = cppcheck CPPCHECK_SUPPRESSIONS = misc/cppcheck-suppressions.txt SCAN_BUILD = scan-build DOCKER = docker GPERF = gperf -XSLTPROC = xsltproc -MANPAGE_XSL = $(shell if [ -e /usr/local/etc/asciidoc/docbook-xsl/manpage.xsl ]; \ - then echo /usr/local/etc/asciidoc/docbook-xsl/manpage.xsl; \ - else echo /etc/asciidoc/docbook-xsl/manpage.xsl; fi) - version := \ $(shell (git --git-dir=$(srcdir)/.git describe --dirty || git --git-dir=$(srcdir)/.git describe || echo vunknown) \ @@ -27,7 +23,12 @@ ifneq ($(shell uname), Darwin) dist_archives += ccache-$(version).tar.xz endif -generated_docs = ccache.1 doc/AUTHORS.html LICENSE.html doc/MANUAL.html doc/NEWS.html +generated_docs = \ + LICENSE.html \ + doc/AUTHORS.html \ + doc/MANUAL.html \ + doc/NEWS.html \ + doc/ccache.1 built_dist_files = $(generated_docs) headers = \ @@ -155,10 +156,12 @@ docs: $(generated_docs) $(ASCIIDOC) -a revnumber=$(version) -a toc -b xhtml11 $< %.xml: %.adoc - $(ASCIIDOC) -a revnumber=$(version) -d manpage -b docbook $< +# Make literals stand out as bold in the man page: + $(ASCIIDOC) -a revnumber=$(version) -d manpage -b docbook -o - $< | \ + perl -pe 's!(.*?)!\1!g' >$@ -ccache.1: doc/MANUAL.xml - $(XSLTPROC) --nonet $(MANPAGE_XSL) $< +doc/ccache.1: doc/MANUAL.xml + $(A2X) --doctype manpage --format manpage $< .PHONY: update-authors update-authors: diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 50627042a..d05319439 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -11,7 +11,6 @@ To build ccache from the source repository, you need: - [AsciiDoc](http://www.methods.co.nz/asciidoc/) to build the documentation. - [Autoconf](http://www.gnu.org/software/autoconf/) - [gperf](http://www.gnu.org/software/gperf/) -- [xsltproc](http://xmlsoft.org/XSLT/xsltproc2.html) It is also recommended that you have: -- 2.47.2