summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--build-aux/Makefile.each.tail/50-sd.mk18
-rw-r--r--build-aux/Makefile.each.tail/60-am.mk16
-rw-r--r--build-aux/Makefile.each.tail/70-sd.mk58
-rw-r--r--build-aux/Makefile.once.head/20-sd.mk78
-rw-r--r--build-aux/Makefile.once.head/30-am.mk12
-rw-r--r--discard.mk74
-rw-r--r--man/.gitignore1
-rw-r--r--man/Makefile33
-rw-r--r--tools/make-man-rules.py27
-rw-r--r--tools/xml_helper.py7
11 files changed, 204 insertions, 121 deletions
diff --git a/.gitignore b/.gitignore
index 658e74f34b..704624e98b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -313,3 +313,4 @@ stamp-*
/config.mk
/gnustandards.mk
/gitfiles.mk
+Makefile-man.mk
diff --git a/build-aux/Makefile.each.tail/50-sd.mk b/build-aux/Makefile.each.tail/50-sd.mk
index 35b9168570..9de3a86e90 100644
--- a/build-aux/Makefile.each.tail/50-sd.mk
+++ b/build-aux/Makefile.each.tail/50-sd.mk
@@ -90,3 +90,21 @@ $(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
$(outdir)/%: $(outdir)/%.m4 $(top_builddir)/config.status
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
+
+$(outdir)/%.1: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.3: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.5: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.7: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.8: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.html: $(srcdir)/%.xml $(topsrcdir)/man/custom-html.xsl $(topoutdir)/man/custom-entities.ent
+ $(sd.XSLTPROC_PROCESS_HTML)
diff --git a/build-aux/Makefile.each.tail/60-am.mk b/build-aux/Makefile.each.tail/60-am.mk
index fda38d8877..a843c01779 100644
--- a/build-aux/Makefile.each.tail/60-am.mk
+++ b/build-aux/Makefile.each.tail/60-am.mk
@@ -8,6 +8,22 @@ zshcompletion_DATA ?=
dist_bashcompletion_DATA := $(sort $(bashcompletion_DATA) $(rootbin_PROGRAMS) $(bin_PROGRAMS) $(bin_SCRIPTS))
dist_zshcompletion_DATA := $(sort $(zshcompletion_DATA) $(addprefix _,$(rootbin_PROGRAMS) $(bin_PROGRAMS) $(bin_SCRIPTS)))
+man_MANS ?=
+_am.man_MANS := $(man_MANS)
+undefine man_MANS
+man0_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .0,$(suffix $(_am.tmp))),$(_am.tmp)))
+man1_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .1,$(suffix $(_am.tmp))),$(_am.tmp)))
+man2_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .2,$(suffix $(_am.tmp))),$(_am.tmp)))
+man3_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .3,$(suffix $(_am.tmp))),$(_am.tmp)))
+man4_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .4,$(suffix $(_am.tmp))),$(_am.tmp)))
+man5_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .5,$(suffix $(_am.tmp))),$(_am.tmp)))
+man6_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .6,$(suffix $(_am.tmp))),$(_am.tmp)))
+man7_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .7,$(suffix $(_am.tmp))),$(_am.tmp)))
+man8_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .8,$(suffix $(_am.tmp))),$(_am.tmp)))
+man9_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .9,$(suffix $(_am.tmp))),$(_am.tmp)))
+manl_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .l,$(suffix $(_am.tmp))),$(_am.tmp)))
+mann_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .n,$(suffix $(_am.tmp))),$(_am.tmp)))
+
$(eval \
$(foreach p,$(am.primaries) ,$(call _am.per_primary,$p)$(at.nl)))
$(eval \
diff --git a/build-aux/Makefile.each.tail/70-sd.mk b/build-aux/Makefile.each.tail/70-sd.mk
new file mode 100644
index 0000000000..9acce2f55a
--- /dev/null
+++ b/build-aux/Makefile.each.tail/70-sd.mk
@@ -0,0 +1,58 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+mod.sd.depends += files write-atomic
+
+_sd.man_xml = $(foreach _sd.tmp,$(filter %.xml,$(files.src.src)),$(if $(findstring /,$(_sd.tmp)),,$(_sd.tmp)))
+
+ifneq ($(_sd.man_xml),)
+#$(info $(outdir)/_sd.man_xml: «$(_sd.man_xml)»)
+
+$(srcdir)/Makefile-man.mk: $(topsrcdir)/tools/make-man-rules.py $(topsrcdir)/tools/xml_helper.py $(topsrcdir)/man/custom-entities.ent.in $(outdir)/.var._sd.man_xml $(call at.addprefix,$(srcdir),$(_sd.man_xml))
+ $(AM_V_GEN)$(PYTHON) $< $(filter %.xml,$^) | $(WRITE_ATOMIC) $@
+files.src.gen += Makefile-man.mk
+
+sd.MANPAGES =
+sd.MANPAGES_ALIAS =
+-include $(srcdir)/Makefile-man.mk
+
+_sd.XML_FILES = \
+ ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(sd.MANPAGES)}}}}}
+sd.HTML_FILES = \
+ ${_sd.XML_FILES:.xml=.html}
+sd.HTML_ALIAS = \
+ ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(sd.MANPAGES_ALIAS)}}}}}
+
+ifneq ($(ENABLE_MANPAGES),)
+man_MANS = \
+ $(sd.MANPAGES) \
+ $(sd.MANPAGES_ALIAS)
+
+noinst_DATA += \
+ $(sd.HTML_FILES) \
+ $(sd.HTML_ALIAS)
+endif # ENABLE_MANPAGES
+
+at.subdirs += $(abspath $(topoutdir)/man)
+
+endif # _sd.man_xml
diff --git a/build-aux/Makefile.once.head/20-sd.mk b/build-aux/Makefile.once.head/20-sd.mk
index 7ee0b62ea6..3c4d6bfd5c 100644
--- a/build-aux/Makefile.once.head/20-sd.mk
+++ b/build-aux/Makefile.once.head/20-sd.mk
@@ -47,18 +47,17 @@ sd.COMPILE = $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
sd.LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
sd.LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(sd.ALL_CFLAGS) $(sd.ALL_LDFLAGS) -o $@
-am.INSTALL_PROGRAMS = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
-am.INSTALL_SCRIPTS = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
-am.INSTALL_LTLIBRARIES = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
-am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
-am.INSTALL_HEADERS = $(AM_V_HEADER)$(INSTALL_DATA) $< $@
-
CC ?= c99
CCLD ?= c99
LIBTOOL ?= libtool
V ?=
+AM_V_at ?= $(AM_V_at_$(V))
+AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at_0 ?= @
+AM_V_at_1 ?=
+
AM_V_M4 ?= $(AM_V_M4_$(V))
AM_V_M4_ ?= $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
AM_V_M4_0 ?= @echo " M4 " $@;
@@ -114,10 +113,23 @@ AM_V_GEN_ ?= $(AM_V_GEN_$(AM_DEFAULT_VERBOSITY))
AM_V_GEN_0 ?= @echo " GEN " $@;
AM_V_GEN_1 ?=
-AM_V_DATA ?= $(AM_V_DATA_$(V))
-AM_V_DATA_ ?= $(AM_V_DATA_$(AM_DEFAULT_VERBOSITY))
-AM_V_DATA_0 ?= @echo " DATA " $@;
-AM_V_DATA_1 ?=
+INTLTOOL_V_MERGE ?= $(INTLTOOL_V_MERGE_$(V))
+INTLTOOL_V_MERGE_OPTIONS ?= $(intltool_v_merge_options_$(V))
+INTLTOOL_V_MERGE_ ?= $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY))
+INTLTOOL_V_MERGE_0 ?= @echo " ITMRG " $@;
+INTLTOOL_V_MERGE_1 ?=
+
+am.INSTALL_PROGRAMS = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPTS = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
+am.INSTALL_LTLIBRARIES = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
+am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
+am.INSTALL_HEADERS = $(AM_V_HEADER)$(INSTALL_DATA) $< $@
+am.INSTALL_MANS = $(AM_V_MAN)$(INSTALL_DATA) $< $@
+
+AM_V_lt ?= $(AM_V_lt_$(V))
+AM_V_lt_ ?= $(AM_V_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt_0 ?= --silent
+AM_V_lt_1 ?=
AM_V_PROG ?= $(AM_V_PROG_$(V))
AM_V_PROG_ ?= $(AM_V_PROG_$(AM_DEFAULT_VERBOSITY))
@@ -134,26 +146,20 @@ AM_V_LIB_ ?= $(AM_V_LIB_$(AM_DEFAULT_VERBOSITY))
AM_V_LIB_0 ?= @echo " LIB " $@;
AM_V_LIB_1 ?=
+AM_V_DATA ?= $(AM_V_DATA_$(V))
+AM_V_DATA_ ?= $(AM_V_DATA_$(AM_DEFAULT_VERBOSITY))
+AM_V_DATA_0 ?= @echo " DATA " $@;
+AM_V_DATA_1 ?=
+
AM_V_HEADER ?= $(AM_V_HEADER_$(V))
AM_V_HEADER_ ?= $(AM_V_HEADER_$(AM_DEFAULT_VERBOSITY))
AM_V_HEADER_0 ?= @echo " HEADER " $@;
AM_V_HEADER_1 ?=
-AM_V_at ?= $(AM_V_at_$(V))
-AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
-AM_V_at_0 ?= @
-AM_V_at_1 ?=
-
-AM_V_lt ?= $(AM_V_lt_$(V))
-AM_V_lt_ ?= $(AM_V_lt_$(AM_DEFAULT_VERBOSITY))
-AM_V_lt_0 ?= --silent
-AM_V_lt_1 ?=
-
-INTLTOOL_V_MERGE ?= $(INTLTOOL_V_MERGE_$(V))
-INTLTOOL_V_MERGE_OPTIONS ?= $(intltool_v_merge_options_$(V))
-INTLTOOL_V_MERGE_ ?= $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY))
-INTLTOOL_V_MERGE_0 ?= @echo " ITMRG " $@;
-INTLTOOL_V_MERGE_1 ?=
+AM_V_MAN ?= $(AM_V_MAN_$(V))
+AM_V_MAN_ ?= $(AM_V_MAN_$(AM_DEFAULT_VERBOSITY))
+AM_V_MAN_0 ?= @echo " MAN " $@;
+AM_V_MAN_1 ?=
sd.substitutions = \
'|rootlibexecdir=$(rootlibexecdir)|' \
@@ -217,7 +223,29 @@ sd.substitutions = \
'|binfmtdir=$(binfmtdir)|' \
'|modulesloaddir=$(modulesloaddir)|'
+sd.substitution_keys := $(subst |,,$(shell printf '%s\n' $(sd.substitutions) | cut -d= -f1))
+
sd.SED_PROCESS = \
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(sd.substitutions)))) \
< $< > $@
+
+sd.XSLTPROC_FLAGS = \
+ --nonet \
+ --xinclude \
+ --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) \
+ --path '$(outdir):$(srcdir):$(topoutdir)/man:$(topsrcdir)/man'
+
+sd.XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
+sd.XSLTPROC_PROCESS_MAN = \
+ $(AM_V_XSLT)$(sd.XSLT) -o $@ $(sd.XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
+
+sd.XSLTPROC_PROCESS_HTML = \
+ $(AM_V_XSLT)$(sd.XSLT) -o $@ $(sd.XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
+
+sd.html-alias = \
+ $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk
index dcccca6da4..3663e07093 100644
--- a/build-aux/Makefile.once.head/30-am.mk
+++ b/build-aux/Makefile.once.head/30-am.mk
@@ -15,10 +15,14 @@ am.sys2out_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1)))
am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD
am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD
-am.INSTALL_PROGRAM ?= $(INSTALL_PROGRAM) $< $@
-am.INSTALL_SCRIPT ?= $(INSTALL) $< $@
-am.INSTALL_LTLIBRARY ?= $(INSTALL) $< $@
-am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@
+# So these are reasonable defaults, to keep my sanity. They get overridden by
+# `libtool`/`AM_V_*`-aware versions in `*-sd.mk`
+am.INSTALL_PROGRAMS ?= $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPTS ?= $(INSTALL) $< $@
+am.INSTALL_LTLIBRARIES ?= $(INSTALL) $< $@
+am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@
+am.INSTALL_HEADERS ?= $(INSTALL_DATA) $< $@
+am.INSTALL_MANS ?= $(INSTALL_DATA) $< $@
am.LDFLAGS =
diff --git a/discard.mk b/discard.mk
index b692c27b94..3ac08a6621 100644
--- a/discard.mk
+++ b/discard.mk
@@ -513,32 +513,11 @@ EXTRA_DIST += \
# ------------------------------------------------------------------------------
-MANPAGES =
-MANPAGES_ALIAS =
-
include Makefile-man.am
.PHONY: man update-man-list
man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
-XML_FILES = \
- ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
-HTML_FILES = \
- ${XML_FILES:.xml=.html}
-HTML_ALIAS = \
- ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}}
-
-ifneq ($(ENABLE_MANPAGES),)
-man_MANS = \
- $(MANPAGES) \
- $(MANPAGES_ALIAS)
-
-noinst_DATA += \
- $(HTML_FILES) \
- $(HTML_ALIAS) \
- docs/html/man
-endif # ENABLE_MANPAGES
-
CLEANFILES += \
$(man_MANS) \
$(HTML_FILES) \
@@ -564,14 +543,6 @@ XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml)
NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES))
SOURCE_XML_FILES = ${patsubst %,$(top_srcdir)/%,$(filter-out man/systemd.directives.xml,$(NON_INDEX_XML_FILES))}
-# This target should only be run manually. It recreates Makefile-man.am
-# file in the source directory based on all man/*.xml files. Run it after
-# adding, removing, or changing the conditional in a man page.
-update-man-list: $(top_srcdir)/tools/make-man-rules.py $(XML_GLOB) man/custom-entities.ent
- $(AM_V_GEN)$(PYTHON) $< $(XML_GLOB) > $(top_srcdir)/Makefile-man.tmp
- $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
- @echo "Makefile-man.am has been regenerated"
-
$(outdir)/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
@@ -864,54 +835,9 @@ EXTRA_DIST += \
$(polkitpolicy_in_in_files)
# ------------------------------------------------------------------------------
-$(outdir)/custom-entities.ent: configure.ac
- $(AM_V_GEN)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
- printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
- > $@ # '
-
CLEANFILES += \
man/custom-entities.ent
-XSLTPROC_FLAGS = \
- --nonet \
- --xinclude \
- --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) \
- --path '$(builddir)/man:$(srcdir)/man'
-
-XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
-XSLTPROC_PROCESS_MAN = \
- $(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
-
-XSLTPROC_PROCESS_HTML = \
- $(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
-
-$(outdir)/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_MAN)
-
-$(outdir)/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_MAN)
-
-$(outdir)/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_MAN)
-
-$(outdir)/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_MAN)
-
-$(outdir)/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_MAN)
-
-$(outdir)/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
- $(XSLTPROC_PROCESS_HTML)
-
-define html-alias
- $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
-endef
-
EXTRA_DIST += \
man/custom-html.xsl \
man/custom-man.xsl
diff --git a/man/.gitignore b/man/.gitignore
index d928e5a83f..1e3a647575 100644
--- a/man/.gitignore
+++ b/man/.gitignore
@@ -3,3 +3,4 @@
/*.[13578]
/*.html
/custom-entities.ent
+/custom-entities.ent.in
diff --git a/man/Makefile b/man/Makefile
new file mode 100644
index 0000000000..87dee0b725
--- /dev/null
+++ b/man/Makefile
@@ -0,0 +1,33 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+$(srcdir)/custom-entities.ent.in: $(outdir)/.var.sd.substitution_keys
+ $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
+ printf '<!ENTITY %s "@%s@">\n' $(foreach v,$(sd.substitution_keys),$v $v)) \
+ > $@
+files.src.gen += custom-entities.ent.in
+sd.sed_files += custom-entities.ent
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py
index 5e61917d60..4461630341 100644
--- a/tools/make-man-rules.py
+++ b/tools/make-man-rules.py
@@ -24,16 +24,16 @@ import os.path
from xml_helper import *
SECTION = '''\
-MANPAGES += \\
+sd.MANPAGES += \\
{manpages}
-MANPAGES_ALIAS += \\
+sd.MANPAGES_ALIAS += \\
{aliases}
{rules}
{htmlrules}
'''
CONDITIONAL = '''\
-if {conditional}
+ifneq ($({conditional}),)
''' \
+ SECTION + \
'''\
@@ -44,8 +44,7 @@ HEADER = '''\
# Do not edit. Generated by make-man-rules.py.
# To regenerate:
# 1. Create, update, or remove source .xml files in man/
-# 2. Run 'make update-man-list'
-# 3. Run 'make man' to generate manpages
+# 2. Run 'make at-noop'
#
# To make a man page conditional on a configure switch add
# attribute conditional="ENABLE_WHAT" or conditional="WITH_WHAT"
@@ -54,22 +53,19 @@ HEADER = '''\
HTML_ALIAS_RULE = '''\
{}.html: {}.html
- $(html-alias)
+ $(sd.html-alias)
'''
FOOTER = '''\
# Really, do not edit this file.
-
-EXTRA_DIST += \\
- {dist_files}
'''
def man(page, number):
- return 'man/{}.{}'.format(page, number)
+ return '$(outdir)/{}.{}'.format(page, number)
def xml(file):
- return 'man/{}'.format(os.path.basename(file))
+ return '$(outdir)/{}'.format(os.path.basename(file))
def add_rules(rules, name):
xml = xml_parse(name)
@@ -106,7 +102,7 @@ def create_rules(xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
-def make_makefile(rules, dist_files):
+def make_makefile(rules):
return HEADER + '\n'.join(
(CONDITIONAL if conditional else SECTION).format(
manpages=mjoin(set(rulegroup.values())),
@@ -119,11 +115,8 @@ def make_makefile(rules, dist_files):
if k != v),
conditional=conditional)
for conditional,rulegroup in sorted(rules.items())
- ) + FOOTER.format(dist_files=mjoin(sorted(dist_files)))
+ ) + FOOTER
if __name__ == '__main__':
rules = create_rules(sys.argv[1:])
- dist_files = (xml(file) for file in sys.argv[1:]
- if not file.endswith(".directives.xml") and
- not file.endswith(".index.xml"))
- print(make_makefile(rules, dist_files), end='')
+ print(make_makefile(rules), end='')
diff --git a/tools/xml_helper.py b/tools/xml_helper.py
index e87126f2f7..598b33f655 100644
--- a/tools/xml_helper.py
+++ b/tools/xml_helper.py
@@ -17,12 +17,17 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+import os.path
from lxml import etree as tree
class CustomResolver(tree.Resolver):
def resolve(self, url, id, context):
+ topsrcdir = os.path.dirname(os.path.dirname(__file__))
if 'custom-entities.ent' in url:
- return self.resolve_filename('man/custom-entities.ent', context)
+ return self.resolve_filename(os.path.join(topsrcdir, 'man/custom-entities.ent.in'), context)
+ f = os.path.join(topsrcdir, 'man', os.path.basename(url))
+ if os.path.isfile(f):
+ return self.resolve_filename(f, context)
_parser = tree.XMLParser()
_parser.resolvers.add(CustomResolver())