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 d54d67c..ee9a952 100644 (file)
@@ -477,3 +477,6 @@ MANPAGES_ALIAS += \
        #
 
 endif
+
+CLEANFILES += \
+       man/systemd.unit.xml
index f73e8a6..6e5f5af 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 b88b43a..9c50c8d 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 9c5a7db..1876794 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