X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=make-man-rules.py;h=9f53b55bbd3ff32ceeefe44d9febf3e9360dd279;hp=9c50c8dec2d0af8bf8736cee9730bd8b4c398231;hb=e75dcf5737ea7c12522d31b55fe0ca193b9dcc21;hpb=c78ab91132aab9193f3c17a9a206f8825ff4be84;ds=sidebyside diff --git a/make-man-rules.py b/make-man-rules.py index 9c50c8dec..9f53b55bb 100644 --- a/make-man-rules.py +++ b/make-man-rules.py @@ -21,6 +21,7 @@ from __future__ import print_function import xml.etree.ElementTree as tree import collections import sys +import os SECTION = '''\ MANPAGES += \\ @@ -28,6 +29,7 @@ MANPAGES += \\ MANPAGES_ALIAS += \\ {aliases} {rules} +{htmlrules} ''' CONDITIONAL = '''\ @@ -40,7 +42,7 @@ endif HEADER = '''\ # Do not edit. Generated by make-man-rules.py. -# Regenerate with 'make update-man-list'. +# Regenerate with 'make all update-man-list'. ''' @@ -50,6 +52,11 @@ CLEANFILES += \\ {cleanfiles} ''' +HTML_ALIAS_RULE = '''\ +{}.html: {}.html + $(html-alias) +''' + def man(page, number): return 'man/{}.{}'.format(page, number) @@ -90,13 +97,17 @@ def make_makefile(rules, cleanfiles): rules='\n'.join('{}: {}'.format(k,v) for k,v in sorted(rulegroup.items()) if k != v), + htmlrules='\n'.join(HTML_ALIAS_RULE.format(k[:-2],v[:-2]) + for k,v in sorted(rulegroup.items()) + if k != v), conditional=conditional) for conditional,rulegroup in sorted(rules.items())) + \ CLEANFILES.format(cleanfiles=mjoin(cleanfiles)) if __name__ == '__main__': sources = set(sys.argv[1:]) + basenames = [os.path.basename(source) for source in sources] spares = set([source for source in sources - if source + '.in' in sources]) + if os.path.basename(source) + '.in' in basenames]) rules = create_rules(*(sources - spares)) print(make_makefile(rules, spares), end='')