]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/meson.build
meson: avoid detecting m4 dir as a program
[thirdparty/systemd.git] / man / meson.build
CommitLineData
5c23128d
ZJS
1# -*- mode: meson -*-
2
3# This is lame, I know, but meson has no other include mechanism
4subdir('rules')
5
6# TODO: add regeneration rule:
7# python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build
8
9xsltproc = find_program('xsltproc')
10xsltproc_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
21custom_man_xsl = files('custom-man.xsl')
22custom_html_xsl = files('custom-man.xsl')
23custom_entities_ent = files('custom-entities.ent')
24
25foreach tuple : manpages
26 stem = tuple[0]
27 section = tuple[1]
28 aliases = tuple[2]
29 condition = tuple[3]
30
31 xml = stem + '.xml'
32 html = stem + '.html'
33 man = stem + '.' + section
34
35 manaliases = []
36 htmlaliases = []
37 foreach alias : aliases
38 manaliases += [alias + '.' + section]
39 htmlaliases += [alias + '.html']
40 endforeach
41
42 mandirn = get_option('mandir') + '/man' + section
43
44 install = condition == '' or conf.get(condition, 0) == 1
45
46 custom_target(
47 man,
48 input : xml,
49 output : [man] + manaliases,
50 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
51 install : install,
52 install_dir : mandirn)
53
54 custom_target(
55 html,
56 input : xml,
57 output : [html] + htmlaliases,
58 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'])
59
60 if not install
61 message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, install))
62 endif
63endforeach
64
65############################################################
66
67source_xml_files = files()
68foreach tuple : manpages
69 source_xml_files += files(tuple[0] + '.xml')
70endforeach
71
72systemd_directives_xml = custom_target(
73 'systemd.directives.xml',
74 input : source_xml_files,
75 output : 'systemd.directives.xml',
76 command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files)
77
78nonindex_xml_files = source_xml_files + [systemd_directives_xml]
79systemd_index_xml = custom_target(
80 'systemd.index.xml',
81 input : nonindex_xml_files,
82 output : 'systemd.index.xml',
83 command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files)
84
85foreach tuple : [['systemd.directives', '7', systemd_directives_xml],
86 ['systemd.index', '7', systemd_index_xml]]
87 stem = tuple[0]
88 section = tuple[1]
89 xml = tuple[2]
90
91 html = stem + '.html'
92 man = stem + '.' + section
93
94 mandirn = get_option('mandir') + '/man' + section
95
96 custom_target(
97 man,
98 input : xml,
99 output : man,
100 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
101 install : install,
102 install_dir : mandirn)
103
104 custom_target(
105 html,
106 input : xml,
107 output : html,
108 command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'])
109endforeach