Commit c78ab911 authored by Zbigniew Jędrzejewski-Szmek's avatar Zbigniew Jędrzejewski-Szmek
Browse files

build-sys: substitute strings in systemd.unit(5)

Makefile.am is updated to deal with .xml.in sources.  Nothing in the
output is really changed yet, this is just preparation.
parent 7ad94c71
......@@ -477,3 +477,6 @@ MANPAGES_ALIAS += \
#
endif
CLEANFILES += \
man/systemd.unit.xml
......@@ -503,7 +503,7 @@ CLEANFILES += \
if HAVE_PYTHON
NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES))
XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml)
XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml $(top_srcdir)/man/*.xml.in)
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
......
......@@ -44,6 +44,12 @@ HEADER = '''\
'''
CLEANFILES = '''\
CLEANFILES += \\
{cleanfiles}
'''
def man(page, number):
return 'man/{}.{}'.format(page, number)
......@@ -76,7 +82,7 @@ def create_rules(*xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
def make_makefile(rules):
def make_makefile(rules, cleanfiles):
return HEADER + '\n'.join(
(CONDITIONAL if conditional else SECTION).format(
manpages=mjoin(set(rulegroup.values())),
......@@ -85,8 +91,12 @@ def make_makefile(rules):
for k,v in sorted(rulegroup.items())
if k != v),
conditional=conditional)
for conditional,rulegroup in sorted(rules.items()))
for conditional,rulegroup in sorted(rules.items())) + \
CLEANFILES.format(cleanfiles=mjoin(cleanfiles))
if __name__ == '__main__':
rules = create_rules(*sys.argv[1:])
print(make_makefile(rules), end='')
sources = set(sys.argv[1:])
spares = set([source for source in sources
if source + '.in' in sources])
rules = create_rules(*(sources - spares))
print(make_makefile(rules, spares), end='')
/systemd.directives.xml
/systemd.index.xml
/systemd.unit.xml
/*.[13578]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment