xref: /openbmc/qemu/docs/meson.build (revision 8fa3b702)
1SPHINX_ARGS = [config_host['SPHINX_BUILD'],
2               '-Dversion=' + meson.project_version(),
3               '-Drelease=' + config_host['PKGVERSION']]
4
5if get_option('werror')
6  SPHINX_ARGS += [ '-W' ]
7endif
8
9if build_docs
10  configure_file(output: 'index.html',
11                 input: files('index.html.in'),
12                 configuration: {'VERSION': meson.project_version()},
13                 install_dir: qemu_docdir)
14  manuals = [ 'devel', 'interop', 'tools', 'specs', 'system', 'user' ]
15  man_pages = {
16    'interop' : {
17        'qemu-ga.8': (have_tools ? 'man8' : ''),
18    },
19    'tools': {
20        'qemu-img.1': (have_tools ? 'man1' : ''),
21        'qemu-nbd.8': (have_tools ? 'man8' : ''),
22        'qemu-trace-stap.1': (config_host.has_key('CONFIG_TRACE_SYSTEMTAP') ? 'man1' : ''),
23        'virtfs-proxy-helper.1': (have_virtfs_proxy_helper ? 'man1' : ''),
24        'virtiofsd.1': (have_virtiofsd ? 'man1' : ''),
25    },
26    'system': {
27        'qemu.1': 'man1',
28        'qemu-block-drivers.7': 'man7',
29        'qemu-cpu-models.7': 'man7'
30    },
31  }
32
33  sphinxdocs = []
34  sphinxmans = []
35  foreach manual : manuals
36    private_dir = meson.current_build_dir() / (manual + '.p')
37    output_dir = meson.current_build_dir() / manual
38    input_dir = meson.current_source_dir() / manual
39
40    this_manual = custom_target(manual + ' manual',
41                build_by_default: build_docs,
42                output: [manual + '.stamp'],
43                input: [files('conf.py'), files(manual / 'conf.py')],
44                depfile: manual + '.d',
45                command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
46                          '-Ddepfile_stamp=@OUTPUT0@',
47                          '-b', 'html', '-d', private_dir,
48                          input_dir, output_dir])
49    sphinxdocs += this_manual
50    if build_docs and manual != 'devel'
51      install_subdir(output_dir, install_dir: qemu_docdir)
52    endif
53
54    these_man_pages = []
55    install_dirs = []
56    foreach page, section : man_pages.get(manual, {})
57      these_man_pages += page
58      install_dirs += section == '' ? false : get_option('mandir') / section
59    endforeach
60    if these_man_pages.length() > 0
61      sphinxmans += custom_target(manual + ' man pages',
62                         build_by_default: build_docs,
63                         output: these_man_pages,
64                         input: this_manual,
65                         install: build_docs,
66                         install_dir: install_dirs,
67                         command: [SPHINX_ARGS, '-b', 'man', '-d', private_dir,
68                                   input_dir, meson.current_build_dir()])
69    endif
70  endforeach
71  alias_target('sphinxdocs', sphinxdocs)
72  alias_target('man', sphinxmans)
73endif
74