sepdebugcrcfix_LDADD = @LIBELF_LIBS@
# Manual pages are generated for dist
-dist_man_MANS = debugedit.1
+dist_man_MANS = debugedit.1 sepdebugcrcfix.1
debugedit.1: tools/debugedit.c $(top_srcdir)/configure.ac
$(MAKE) $(AM_MAKEFLAGS) debugedit$(EXEEXT)
--name='debug source path manipulation tool' \
./debugedit$(EXEEXT)
+sepdebugcrcfix.1: tools/sepdebugcrcfix.c $(top_srcdir)/configure.ac
+ $(MAKE) $(AM_MAKEFLAGS) sepdebugcrcfix$(EXEEXT)
+ $(HELP2MAN) -N --output=$@ \
+ --name='fixes CRC for separate .debug files' \
+ ./sepdebugcrcfix$(EXEEXT)
+
noinst_HEADERS= tools/ansidecl.h \
tools/hashtab.h \
tools/md5.h \
return false;
}
+static void
+version (void)
+{
+ printf("sepdebugcrcfix %s\n", VERSION);
+ exit(EXIT_SUCCESS);
+}
+
+static const char *helpText =
+ "Usage: %s DEBUG_DIR FILEs\n" \
+ "Fixes CRC in .debug files under DEBUG_DIR for the given FILEs\n" \
+ "\n" \
+ "DEBUG_DIR is usually \"usr/lib/debug\".\n" \
+ "FILEs should have relative paths.\n" \
+ "The relative paths will be used to find the corresponding .debug\n" \
+ "files under DEBUGDIR\n";
+
+static void
+help (const char *progname, bool error)
+{
+ FILE *f = error ? stderr : stdout;
+ fprintf (f, helpText, progname);
+ exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
int
main (int argc, char **argv)
{
+ if (argc == 2 && strcmp (argv[1], "--version") == 0)
+ version ();
+ if (argc == 2 && strcmp (argv[1], "--help") == 0)
+ help (argv[0], false);
if (argc < 2)
- error (1, 0, _("usr/lib/debug [<relative filenames>...]"));
+ help (argv[0], true);
+
usr_lib_debug = argv[1];
if (elf_version (EV_CURRENT) == EV_NONE)
error (1, 0, _("error initializing libelf: %s"), elf_errmsg (-1));