Re: [patch] make run

Doug Evans
2013-09-30T22:36:39Z

Doug Evans writes:
> Hi.
> Since we can't agree on making gdb runnable from its build directory
> (without having to manually specify --data-directory)
> I plan to commit this patch (if there are no objections).
>
> I plan to add an entry for it in the Hints section of the
> wikified internals manual as well.
> https://sourceware.org/gdb/wiki/InternalsManual

And with the requisite .PHONY.
[thanks SamB]

2013-09-30 Doug Evans <dje@google.com>

* Makefile.in (GDBFLAGS): New variable.
(run): New rule.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1270
diff -u -p -r1.1270 Makefile.in
--- Makefile.in 25 Sep 2013 23:17:11 -0000 1.1270
+++ Makefile.in 30 Sep 2013 22:34:02 -0000
@@ -178,6 +178,9 @@ INTL_CFLAGS = @INCINTL@
# Did the user give us a --with-gdb-datadir option?
GDB_DATADIR = @GDB_DATADIR@

+# Flags to pass to gdb when invoked with "make run".
+GDBFLAGS =
+
# Helper code from gnulib.
GNULIB_BUILDDIR = build-gnulib
LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
@@ -1339,6 +1342,10 @@ data-directory/Makefile: data-directory/
CONFIG_LINKS= \
$(SHELL) config.status

+.PHONY: run
+run: Makefile
+ ./gdb$(EXEEXT) --data-directory=`pwd`/data-directory $(GDBFLAGS)
+
jit-reader.h: $(srcdir)/jit-reader.in
$(SHELL) config.status $@