Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 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()}, |
| 13 | install_dir: config_host['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') |
Paolo Bonzini | bac35bf | 2020-08-11 09:07:04 +0200 | [diff] [blame^] | 37 | output_dir = meson.current_build_dir() / manual |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 38 | input_dir = meson.current_source_dir() / manual |
Paolo Bonzini | bac35bf | 2020-08-11 09:07:04 +0200 | [diff] [blame^] | 39 | |
| 40 | this_manual = custom_target(manual + ' manual', |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 41 | build_by_default: build_docs, |
Paolo Bonzini | bac35bf | 2020-08-11 09:07:04 +0200 | [diff] [blame^] | 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 |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 50 | if build_docs and manual != 'devel' |
Paolo Bonzini | bac35bf | 2020-08-11 09:07:04 +0200 | [diff] [blame^] | 51 | install_subdir(output_dir, install_dir: config_host['qemu_docdir']) |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 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', |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 62 | build_by_default: build_docs, |
| 63 | output: these_man_pages, |
Paolo Bonzini | bac35bf | 2020-08-11 09:07:04 +0200 | [diff] [blame^] | 64 | input: this_manual, |
Paolo Bonzini | f8aa24e | 2020-08-05 15:49:10 +0200 | [diff] [blame] | 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) |
| 73 | endif |