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