aboutsummaryrefslogtreecommitdiffstats
path: root/doc/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'doc/meson.build')
-rw-r--r--doc/meson.build38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 00000000..bdf4493f
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,38 @@
+
+sphinx = find_program('sphinx-build', native : true, required : get_option('man-pages').enabled() or get_option('documentation').enabled())
+
+man_pages = [
+ 'flashrom.8'
+]
+
+if sphinx.found()
+ if get_option('man-pages').auto() or get_option('man-pages').enabled()
+ man_outputs = []
+ foreach page : man_pages
+ man_outputs += 'man' + page.substring(-1)
+ endforeach
+
+ custom_target(
+ 'man-pages',
+ command : [sphinx, '-b', 'man', '-q', '-d', '@PRIVATE_DIR@', '@CURRENT_SOURCE_DIR@', '@OUTDIR@'],
+ env : {'FLASHROM_VERSION' : meson.project_version() },
+ build_always_stale : true, # sphinx handles rebuilds
+ output : man_outputs,
+ install : true,
+ install_dir : get_option('mandir'),
+ )
+ endif
+
+ if get_option('documentation').auto() or get_option('documtation').enabled()
+ custom_target(
+ 'documentation',
+ command : [sphinx, '-b', 'html', '-q', '-d', '@PRIVATE_DIR@', '@CURRENT_SOURCE_DIR@', '@OUTDIR@/html'],
+ env : {'FLASHROM_VERSION' : meson.project_version() },
+ build_always_stale : true, # sphinx handles rebuilds
+ output : 'html',
+ install : true,
+ install_dir : get_option('datadir') + '/doc/flashrom'
+ )
+ endif
+
+endif