meson.build 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. if 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. sphinxdocs = []
  27. sphinxmans = []
  28. foreach manual : manuals
  29. private_dir = meson.current_build_dir() / (manual + '.p')
  30. output_dir = meson.current_build_dir() / manual
  31. input_dir = meson.current_source_dir() / manual
  32. this_manual = custom_target(manual + ' manual',
  33. build_by_default: build_docs,
  34. output: [manual + '.stamp'],
  35. input: [files('conf.py'), files(manual / 'conf.py')],
  36. depfile: manual + '.d',
  37. depend_files: sphinx_extn_depends,
  38. command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
  39. '-Ddepfile_stamp=@OUTPUT0@',
  40. '-b', 'html', '-d', private_dir,
  41. input_dir, output_dir])
  42. sphinxdocs += this_manual
  43. if build_docs and manual != 'devel'
  44. install_subdir(output_dir, install_dir: qemu_docdir)
  45. endif
  46. these_man_pages = []
  47. install_dirs = []
  48. foreach page, section : man_pages.get(manual, {})
  49. these_man_pages += page
  50. install_dirs += section == '' ? false : get_option('mandir') / section
  51. endforeach
  52. if these_man_pages.length() > 0
  53. sphinxmans += custom_target(manual + ' man pages',
  54. build_by_default: build_docs,
  55. output: these_man_pages,
  56. input: this_manual,
  57. install: build_docs,
  58. install_dir: install_dirs,
  59. command: [SPHINX_ARGS, '-b', 'man', '-d', private_dir,
  60. input_dir, meson.current_build_dir()])
  61. endif
  62. endforeach
  63. alias_target('sphinxdocs', sphinxdocs)
  64. alias_target('html', sphinxdocs)
  65. alias_target('man', sphinxmans)
  66. endif