public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] debugedit: Add manual using help2man
@ 2021-04-29 16:27 Mark Wielaard
  2021-04-29 16:36 ` Dmitry V. Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2021-04-29 16:27 UTC (permalink / raw)
  To: debugedit; +Cc: Mark Wielaard

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugedit: Add manual using help2man
  2021-04-29 16:27 [PATCH] debugedit: Add manual using help2man Mark Wielaard
@ 2021-04-29 16:36 ` Dmitry V. Levin
  2021-04-29 18:47   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2021-04-29 16:36 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: debugedit

On Thu, Apr 29, 2021 at 06:27:22PM +0200, Mark Wielaard wrote:
> 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.
[...]
> 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)

The usual way of generating debugedit.1 would be to make it depend on
debugedit$(EXEEXT) instead.  Is this written to avoid any attempts to
regenerate debugedit.1 at build time?


-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugedit: Add manual using help2man
  2021-04-29 16:36 ` Dmitry V. Levin
@ 2021-04-29 18:47   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2021-04-29 18:47 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: debugedit

Hi Dmitry,

On Thu, 2021-04-29 at 19:36 +0300, Dmitry V. Levin wrote: 
> > +# 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)
> 
> The usual way of generating debugedit.1 would be to make it depend on
> debugedit$(EXEEXT) instead.  Is this written to avoid any attempts to
> regenerate debugedit.1 at build time?

Yes, that is the idea. It is also what the automake manual recommends
because the man page is a generated file that is distributed.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-29 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 16:27 [PATCH] debugedit: Add manual using help2man Mark Wielaard
2021-04-29 16:36 ` Dmitry V. Levin
2021-04-29 18:47   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).