]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Improve man page generation
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 4 Mar 2018 09:45:50 +0000 (10:45 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 4 Mar 2018 09:45:50 +0000 (10:45 +0100)
* 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
Makefile.in
dev.mk.in
doc/INSTALL.md

index fb7d3985fec2354992626bcbc9f5d30f13ae8986..c82bc5b9e6b27c4b9de2d01d83c325725edc06e7 100644 (file)
@@ -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.*
index b7dbd43989f772b84220f442de1ece8343141304..3c52843a20b0b4a0794cd57b23249de0597645b6 100644 (file)
@@ -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:
index 24ea01d9eafcdb74f1f7460f3c43c05d8ccf18b0..a0775f33e837fe8eb3974df0d851d45b9b945c6d 100644 (file)
--- 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!<literal>(.*?)</literal>!<emphasis role="strong">\1</emphasis>!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:
index 50627042a9326d3de1051dbb3cb604a3866bff37..d05319439c145ae74c4a1fda0f7e9426d150f0cb 100644 (file)
@@ -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: