]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/meson.build
meson: add rule to generate custom-entities.ent
[thirdparty/systemd.git] / man / meson.build
1 # -*- mode: meson -*-
2
3 # This is lame, I know, but meson has no other include mechanism
4 subdir('rules')
5
6 # TODO: add regeneration rule:
7 # python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build
8
9 xsltproc = find_program('xsltproc')
10 xsltproc_flags = [
11 '--nonet',
12 '--xinclude',
13 '--stringparam', 'man.output.quietly', '1',
14 '--stringparam', 'funcsynopsis.style', 'ansi',
15 '--stringparam', 'man.authors.section.enabled', '0',
16 '--stringparam', 'man.copyright.section.enabled', '0',
17 '--stringparam', 'systemd.version', '@0@'.format(meson.project_version()),
18 '--path',
19 '@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())]
20
21 custom_man_xsl = files('custom-man.xsl')
22 custom_html_xsl = files('custom-man.xsl')
23
24 custom_entities_ent = configure_file(
25 input : 'custom-entities.ent.in',
26 output : 'custom-entities.ent',
27 configuration : conf)
28
29 foreach tuple : manpages
30 stem = tuple[0]
31 section = tuple[1]
32 aliases = tuple[2]
33 condition = tuple[3]
34
35 xml = stem + '.xml'
36 html = stem + '.html'
37 man = stem + '.' + section
38
39 manaliases = []
40 htmlaliases = []
41 foreach alias : aliases
42 manaliases += [alias + '.' + section]
43 htmlaliases += [alias + '.html']
44 endforeach
45
46 mandirn = get_option('mandir') + '/man' + section
47
48 install = condition == '' or conf.get(condition, 0) == 1
49
50 custom_target(
51 man,
52 input : xml,
53 output : [man] + manaliases,
54 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
55 depend_files : custom_entities_ent,
56 install : install,
57 install_dir : mandirn)
58
59 custom_target(
60 html,
61 input : xml,
62 output : [html] + htmlaliases,
63 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'],
64 depend_files : custom_entities_ent)
65
66 if not install
67 message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, install))
68 endif
69 endforeach
70
71 ############################################################
72
73 source_xml_files = files()
74 foreach tuple : manpages
75 source_xml_files += files(tuple[0] + '.xml')
76 endforeach
77
78 systemd_directives_xml = custom_target(
79 'systemd.directives.xml',
80 input : source_xml_files,
81 output : 'systemd.directives.xml',
82 command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files)
83
84 nonindex_xml_files = source_xml_files + [systemd_directives_xml]
85 systemd_index_xml = custom_target(
86 'systemd.index.xml',
87 input : nonindex_xml_files,
88 output : 'systemd.index.xml',
89 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
90
91 foreach tuple : [['systemd.directives', '7', systemd_directives_xml],
92 ['systemd.index', '7', systemd_index_xml]]
93 stem = tuple[0]
94 section = tuple[1]
95 xml = tuple[2]
96
97 html = stem + '.html'
98 man = stem + '.' + section
99
100 mandirn = get_option('mandir') + '/man' + section
101
102 custom_target(
103 man,
104 input : xml,
105 output : man,
106 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
107 install : install,
108 install_dir : mandirn)
109
110 custom_target(
111 html,
112 input : xml,
113 output : html,
114 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'])
115 endforeach