[PATCH] debugedit: Add manual using help2man

Mark Wielaard mark@klomp.org
Thu Apr 29 16:27:22 GMT 2021


This generates a debugedit.1 man page using help2man based on the
debugedit --help output.  The generated file is included in the dist
so help2man isn't normally needed to build debugedit.

	* .gitignore: Add debugedit.1
	* configure.ac: Add AM_MISSING_PROG for help2man.
	* Makefile.am (dist_man_MANS): Add debugedit.1
	(debugedit.1): New rules.
	* tools/debugedit (helpText): Add FILE argument.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 .gitignore        | 1 +
 Makefile.am       | 9 +++++++++
 configure.ac      | 1 +
 tools/debugedit.c | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 7225070..55d4bfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@ missing
 .dirstamp
 
 debugedit
+debugedit.1
 sepdebugcrcfix
 
 atconfig
diff --git a/Makefile.am b/Makefile.am
index bd28eba..5042785 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,6 +38,15 @@ sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
 sepdebugcrcfix_CFLAGS = @LIBELF_CFLAGS@ $(AM_CFLAGS)
 sepdebugcrcfix_LDADD = @LIBELF_LIBS@
 
+# Manual pages are generated for dist
+dist_man_MANS = debugedit.1
+
+debugedit.1: tools/debugedit.c $(top_srcdir)/configure.ac
+	$(MAKE) $(AM_MAKEFLAGS) debugedit$(EXEEXT)
+	$(HELP2MAN) -N --output=$@ \
+	  --name='debug source path manipulation tool' \
+	  ./debugedit$(EXEEXT)
+
 noinst_HEADERS= tools/ansidecl.h \
 		tools/hashtab.h \
 		tools/md5.h \
diff --git a/configure.ac b/configure.ac
index c5adadf..e7a7989 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,7 @@ AC_PROG_AWK
 AC_PROG_CC_C99
 AC_PROG_LN_S
 AC_CHECK_TOOL([LD], [ld])
+AM_MISSING_PROG(HELP2MAN, help2man)
 
 # Only really an issue on 32bit platforms. Makes sure we'll get large off_t.
 AC_SYS_LARGEFILE
diff --git a/tools/debugedit.c b/tools/debugedit.c
index f84c7ef..c6975b2 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -3034,7 +3034,7 @@ static struct option optionsTable[] =
 static const char *optionsChars = "b:d:l:is:nV?";
 
 static const char *helpText =
-  "Usage: %s [OPTION...]\n"
+  "Usage: %s [OPTION...] FILE\n"
   "  -b, --base-dir=STRING           base build directory of objects\n"
   "  -d, --dest-dir=STRING           directory to rewrite base-dir into\n"
   "  -l, --list-file=STRING          file where to put list of source and \n"
-- 
2.18.4



More information about the Debugedit mailing list