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