summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-29 14:22:27 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-29 20:30:21 -0400
commit1a13e31d275430ffba713c8a68ee7f22093c29e0 (patch)
tree66b0b3e91d22fce58affea603c2a5cbf6eb0c6a9 /Makefile.am
parent4e7b3c20e00c40372c551bd42c57e40500f4ceb4 (diff)
build-sys,man: use XML entities to substite strings
This makes it easier to add substitutions to man pages, avoiding the separate transformation step. mkdir -p's are removed from the rule, because xsltproc will will create directories on it's own. All in all, two or three forks per man page are avoided, which should make things marginally faster. Unfortunately python parsers must too be tweaked to handle entities. This isn't particularly easy: with lxml a custom Resolver can be used, but the stdlib etree doesn't support external entities *at all*. So when running without lxml, the entities are just removed. Right now it doesn't matter, since the entities are not indexed anyway. But I intend to add indexing of filenames in the near future, and then the index generated without lxml might be missing a few lines. Oh well.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am43
1 files changed, 27 insertions, 16 deletions
diff --git a/Makefile.am b/Makefile.am
index d5b319e2cb..92bd542767 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,6 +97,7 @@ rootbindir=$(rootprefix)/bin
rootlibexecdir=$(rootprefix)/lib/systemd
CLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES =
EXTRA_DIST =
BUILT_SOURCES =
INSTALL_EXEC_HOOKS =
@@ -556,9 +557,10 @@ noinst_DATA += \
CLEANFILES += \
man/index.html
+XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml)
NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES))
+SOURCE_XML_FILES = $(filter-out man/systemd.directives.xml,$(NON_INDEX_XML_FILES))
-XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml)
update-man-list: make-man-rules.py $(XML_GLOB)
$(AM_V_GEN)$(PYTHON) $^ > $(top_srcdir)/Makefile-man.tmp
$(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
@@ -566,11 +568,11 @@ update-man-list: make-man-rules.py $(XML_GLOB)
man/systemd.index.xml: make-man-index.py $(NON_INDEX_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(PYTHON) $^ > $@
+ $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
-man/systemd.directives.xml: make-directive-index.py $(filter-out man/systemd.directives.xml,$(NON_INDEX_XML_FILES))
+man/systemd.directives.xml: make-directive-index.py $(SOURCE_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(PYTHON) $^ > $@
+ $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
EXTRA_DIST += \
man/systemd.index.xml \
@@ -591,7 +593,8 @@ EXTRA_DIST += \
$(HTML_ALIAS) \
$(dist_MANS) \
make-man-index.py \
- make-directive-index.py
+ make-directive-index.py \
+ xml_helper.py
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
@@ -3819,38 +3822,46 @@ CLEANFILES += \
# ------------------------------------------------------------------------------
if ENABLE_MANPAGES
+man/custom-entities.ent: Makefile
+ $(AM_V_GEN)$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
+ echo '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">,$(substitutions))))') \
+ > $@ # '
+
+DISTCLEANFILES += \
+ man/custom-entities.ent
+
XSLTPROC_FLAGS = \
--nonet \
--stringparam man.output.quietly 1 \
--stringparam funcsynopsis.style ansi \
--stringparam man.authors.section.enabled 0 \
--stringparam man.copyright.section.enabled 0 \
- --stringparam systemd.version $(VERSION)
+ --stringparam systemd.version $(VERSION) \
+ --path '$(builddir)/man:$(srcdir)/man'
XSLTPROC_PROCESS_MAN = \
- $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
- $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
+ $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
XSLTPROC_PROCESS_HTML = \
- $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
- $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
+ $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
-man/%.1: man/%.xml man/custom-man.xsl
+man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.3: man/%.xml man/custom-man.xsl
+man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.5: man/%.xml man/custom-man.xsl
+man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.7: man/%.xml man/custom-man.xsl
+man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.8: man/%.xml man/custom-man.xsl
+man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_MAN)
-man/%.html: man/%.xml man/custom-html.xsl
+man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
$(XSLTPROC_PROCESS_HTML)
define html-alias