chiark / gitweb /
build-sys: substitute strings in systemd.unit(5)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Feb 2013 15:31:20 +0000 (10:31 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 7 Feb 2013 04:16:17 +0000 (23:16 -0500)
Makefile.am is updated to deal with .xml.in sources.  Nothing in the
output is really changed yet, this is just preparation.

Makefile-man.am
Makefile.am
make-man-rules.py
man/.gitignore
man/systemd.unit.xml.in [moved from man/systemd.unit.xml with 100% similarity]

index d54d67cf119b26e427cf59083b7820aa3db0c79a..ee9a952765581c88e968bffd79c8f9bd5921aa58 100644 (file)
@@ -477,3 +477,6 @@ MANPAGES_ALIAS += \
        #
 
 endif
+
+CLEANFILES += \
+       man/systemd.unit.xml
index f73e8a6e74303459a75eb816a78d31d1f0960b28..6e5f5af9ac04a009281e2eabbb4971ea07fc9bfe 100644 (file)
@@ -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
index b88b43ac3d2a6b02f1e2222c834e7dec67aefde6..9c50c8dec2d0af8bf8736cee9730bd8b4c398231 100644 (file)
@@ -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='')
index 9c5a7db1cc77a4ea8c877943c2a884a0f2d47994..18767949c1719c78e53b0ecd3da7792a728a3844 100644 (file)
@@ -1,3 +1,4 @@
 /systemd.directives.xml
 /systemd.index.xml
+/systemd.unit.xml
 /*.[13578]
similarity index 100%
rename from man/systemd.unit.xml
rename to man/systemd.unit.xml.in