summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/make-man-rules.py27
-rw-r--r--tools/xml_helper.py7
2 files changed, 16 insertions, 18 deletions
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())