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 'qemu-ga-ref.7': 'man7', 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') 38 output_dir = meson.current_build_dir() / manual 39 input_dir = meson.current_source_dir() / manual 40 41 this_manual = custom_target(manual + ' manual', 42 build_by_default: build_docs, 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 51 if build_docs and manual != 'devel' 52 install_subdir(output_dir, install_dir: qemu_docdir) 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', 63 build_by_default: build_docs, 64 output: these_man_pages, 65 input: this_manual, 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) 74endif 75