xref: /aosp_15_r20/external/flashrom/doc/meson.build (revision 0d6140be3aa665ecc836e8907834fcd3e3b018fc)
1
2sphinx = find_program('sphinx-build', native : true, required : get_option('man-pages').enabled() or get_option('documentation').enabled())
3sphinx_wrapper = meson.current_source_dir() / 'sphinx-wrapper.sh'
4
5man_pages = [
6  'flashrom.8'
7]
8
9if sphinx.found()
10  if get_option('man-pages').auto() or get_option('man-pages').enabled()
11    man_outputs = []
12    foreach page : man_pages
13      man_outputs += 'man' + page.substring(-1)
14    endforeach
15
16    custom_target(
17      'man-pages',
18      command : [sphinx_wrapper, '@OUTDIR@', ' '.join(man_outputs), sphinx, '-b', 'man', '-q', '-d', '@PRIVATE_DIR@', '-Drelease=' + flashrom_version, '@CURRENT_SOURCE_DIR@', '@OUTDIR@'],
19      build_always_stale : true, # sphinx handles rebuilds
20      output  : man_outputs,
21      install : true,
22      install_dir : get_option('mandir'),
23    )
24  endif
25
26  if get_option('documentation').auto() or get_option('documentation').enabled()
27    custom_target(
28      'documentation',
29      command : [sphinx, '-b', 'html', '-q', '-d', '@PRIVATE_DIR@', '-Drelease=' + flashrom_version,'@CURRENT_SOURCE_DIR@', '@OUTDIR@/html'],
30      build_always_stale : true, # sphinx handles rebuilds
31      output  : 'html',
32      install : true,
33      install_dir : get_option('datadir') + '/doc/flashrom'
34    )
35  endif
36
37endif
38