From 6cbc2e57555aaefe13b80fe0a61e5a711e4ba494 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 18 Feb 2019 13:44:38 +0100 Subject: [PATCH] doc: add automatically generated man pages for gpio-tools Extend the build files to automatically generate man pages for gpio-tools using help2man if it's present in the system and we're not cross-compiling (as the built programs must be executable for help2man to work). Signed-off-by: Bartosz Golaszewski --- .gitignore | 3 +++ Makefile.am | 8 +++++++- configure.ac | 15 +++++++++++++-- man/Makefile.am | 19 +++++++++++++++++++ man/template | 7 +++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 man/Makefile.am create mode 100644 man/template diff --git a/.gitignore b/.gitignore index f39717a..2dad305 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ stamp-h1 # unit tests gpiod-test + +# man pages +*.man diff --git a/Makefile.am b/Makefile.am index e7af429..03f844b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ # # This file is part of libgpiod. # -# Copyright (C) 2017-2018 Bartosz Golaszewski +# Copyright (C) 2017-2019 Bartosz Golaszewski # ACLOCAL_AMFLAGS = -I m4 @@ -19,6 +19,12 @@ SUBDIRS += tests endif +if WITH_TOOLS + +SUBDIRS += man + +endif + if HAS_DOXYGEN doc: diff --git a/configure.ac b/configure.ac index 49bedf4..4d86c2f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # # This file is part of libgpiod. # -# Copyright (C) 2017-2018 Bartosz Golaszewski +# Copyright (C) 2017-2019 Bartosz Golaszewski # AC_PREREQ(2.61) @@ -191,6 +191,16 @@ then AC_MSG_NOTICE([doxygen not found - documentation cannot be generated]) fi +if test "x$cross_compiling" = xno +then + AC_CHECK_PROG([has_help2man], [help2man], [true], [false]) + AM_CONDITIONAL([WITH_MANPAGES], [test "x$has_help2man" = xtrue]) + if test "x$has_help2man" = xfalse + then + AC_MSG_NOTICE([help2man not found - man pages cannot be generated automatically]) + fi +fi + AC_CONFIG_FILES([libgpiod.pc Makefile include/Makefile @@ -203,6 +213,7 @@ AC_CONFIG_FILES([libgpiod.pc bindings/cxx/Makefile bindings/cxx/examples/Makefile bindings/python/Makefile - bindings/python/examples/Makefile]) + bindings/python/examples/Makefile + man/Makefile]) AC_OUTPUT diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..426d6f5 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +# +# This file is part of libgpiod. +# +# Copyright (C) 2019 Bartosz Golaszewski +# + +if WITH_MANPAGES + +dist_man1_MANS = gpiodetect.man gpioinfo.man gpioget.man gpioset.man gpiofind.man gpiomon.man + +%.man: $(top_srcdir)/src/tools/$(*F) + help2man $(top_srcdir)/src/tools/$(*F) --include=./template --output=./$@ --no-info + +clean-local: + rm -f $(dist_man1_MANS) + +endif diff --git a/man/template b/man/template new file mode 100644 index 0000000..f1040ff --- /dev/null +++ b/man/template @@ -0,0 +1,7 @@ +[AUTHOR] +Bartosz Golaszewski + +[REPORTING BUGS] +Report bugs to: + Bartosz Golaszewski + linux-gpio -- 2.30.2