summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xman/html.in12
-rwxr-xr-xman/man.in15
-rw-r--r--man/meson.build12
-rw-r--r--meson.build1
4 files changed, 40 insertions, 0 deletions
diff --git a/man/html.in b/man/html.in
new file mode 100755
index 0000000000..d4debcc340
--- /dev/null
+++ b/man/html.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+ echo "Use: $0 page-name (with no section suffix)"
+ exit 1
+fi
+
+target="man/$1.html"
+ninja -C "@BUILD_ROOT@" "$target"
+set -x
+exec xdg-open build/"$target"
diff --git a/man/man.in b/man/man.in
new file mode 100755
index 0000000000..5700a642bd
--- /dev/null
+++ b/man/man.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+ echo "Use: $0 page-name (with no section suffix)"
+ exit 1
+fi
+
+target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$1\.[0-9]$" | awk '{print $2}')
+if [ -z "$target" ]; then
+ echo "Cannot find page $1"
+ exit 1
+fi
+ninja -C "@BUILD_ROOT@" "$target"
+exec man build/"$target"
diff --git a/man/meson.build b/man/meson.build
index ae9c941fcd..f3992b2834 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -204,3 +204,15 @@ if git.found()
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
depend_files : custom_entities_ent)
endif
+
+############################################################
+
+configure_file(
+ input : 'man.in',
+ output : 'man',
+ configuration : substs)
+
+configure_file(
+ input : 'html.in',
+ output : 'html',
+ configuration : substs)
diff --git a/meson.build b/meson.build
index eaf0eddcb1..35f8992345 100644
--- a/meson.build
+++ b/meson.build
@@ -283,6 +283,7 @@ substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-loc
substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
+substs.set('BUILD_ROOT', meson.current_build_dir())
#####################################################################