summaryrefslogtreecommitdiff
path: root/tools/make-man-rules.py
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-10 22:26:51 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-10 22:26:51 -0400
commit0177890f6369c0cb601e1d60cd5722048d34bead (patch)
treebb27f50c24628a3bf42beaea029430fe86264af4 /tools/make-man-rules.py
parent8d9cbc9d33dede2f75d24888dda2066f97ef8129 (diff)
parenta1ec5efa1f66fc7123ff89ab2bac42f6a0e874d5 (diff)
Merge branch 'notsystemd/postmove' into notsystemd/master
Diffstat (limited to 'tools/make-man-rules.py')
-rw-r--r--tools/make-man-rules.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py
index 4461630341..5e61917d60 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 = '''\
-sd.MANPAGES += \\
+MANPAGES += \\
{manpages}
-sd.MANPAGES_ALIAS += \\
+MANPAGES_ALIAS += \\
{aliases}
{rules}
{htmlrules}
'''
CONDITIONAL = '''\
-ifneq ($({conditional}),)
+if {conditional}
''' \
+ SECTION + \
'''\
@@ -44,7 +44,8 @@ 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 at-noop'
+# 2. Run 'make update-man-list'
+# 3. Run 'make man' to generate manpages
#
# To make a man page conditional on a configure switch add
# attribute conditional="ENABLE_WHAT" or conditional="WITH_WHAT"
@@ -53,19 +54,22 @@ HEADER = '''\
HTML_ALIAS_RULE = '''\
{}.html: {}.html
- $(sd.html-alias)
+ $(html-alias)
'''
FOOTER = '''\
# Really, do not edit this file.
+
+EXTRA_DIST += \\
+ {dist_files}
'''
def man(page, number):
- return '$(outdir)/{}.{}'.format(page, number)
+ return 'man/{}.{}'.format(page, number)
def xml(file):
- return '$(outdir)/{}'.format(os.path.basename(file))
+ return 'man/{}'.format(os.path.basename(file))
def add_rules(rules, name):
xml = xml_parse(name)
@@ -102,7 +106,7 @@ def create_rules(xml_files):
def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
-def make_makefile(rules):
+def make_makefile(rules, dist_files):
return HEADER + '\n'.join(
(CONDITIONAL if conditional else SECTION).format(
manpages=mjoin(set(rulegroup.values())),
@@ -115,8 +119,11 @@ def make_makefile(rules):
if k != v),
conditional=conditional)
for conditional,rulegroup in sorted(rules.items())
- ) + FOOTER
+ ) + FOOTER.format(dist_files=mjoin(sorted(dist_files)))
if __name__ == '__main__':
rules = create_rules(sys.argv[1:])
- print(make_makefile(rules), end='')
+ 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='')