This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Include dir intl when building libcommon.a for gdb
On 03/02/2011 08:14 PM, Joel Brobecker wrote:
>
> This part, however, makes me uncomfortable. There are a couple
> of reasons. The current code is:
>
> if test x"$enable_gdbserver" = xyes; then
> GDB_FLAGS="-DGDBSERVER"
> GDB_INCLUDE="-I\$(srcdir)/../gdbserver/"
> else
> GDB_FLAGS=""
> GDB_INCLUDE="-I\$(srcdir)/../ -I\$(BFD_DIR)"
> fi
>
> The first question is: I don't understand why we have different
> include and compilation flags. I can see how -DGDBSERVER is used
> to select between gdb's "defs.h" and gdbserver's "server.h". So,
> OK for now. But for the rest, why do we maintain different include
> paths depending on whether we build it for GDB or for GDBserver?
> It's like a circular dependency. I can explain that we need to
> select either $(srcdir)/../gdbserver/ or $(srcdir)/../ for the
> same reason as above (including "defs.h" or "server.h").
To your first question, because common/signals.c uses "ifdef GDBSERVER",
which makes a lot troubles here. I think of this problem again, and
find that root cause of this problem is that files in common dir
includes some gdb-specific or gdbserver specific code.
If we move gdb-specific part of common/signals.c out of it, the include
and compilation flags can be unique.
This patch is to move gdb-specific code out of common/signals.c.
http://sourceware.org/ml/gdb-patches/2011-02/msg00669.html
Once this patch above is applied, we can remove these conditional
includes and flags setting code.
> For the rest, I think that the -I flags should be the same regardless
> of who we build these files for. In my mind, it's supposed to be
> actually independent from both GDB and GDBserver. And unfortunately,
> right now, it is dependent on both :-(.
>
Yes, we should keep libcommon.a compilation flags the same. As I said
above, we can make it independent via moving some of codes out of signals.c.
--
Yao (éå)
gdb/
* common/Makefile.in: Remove BFD_DIR, BFD_SRC, BFD_CFLAGS.
(INCLUDES): Remove GDB_INCLUDE.
(COMPILE): Remove GDB_FLAGS.
* common/configure.ac: Remove conditionals to set includes
and compilation flags.
* common/configure: Regenerate.
diff --git a/gdb/common/Makefile.in b/gdb/common/Makefile.in
index 9230b87..6782631 100644
--- a/gdb/common/Makefile.in
+++ b/gdb/common/Makefile.in
@@ -27,11 +27,7 @@ COMMON_CPU_OBJ = @COMMON_CPU_OBJ@
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
CFLAGS = @CFLAGS@
-BFD_DIR = ../../bfd
-BFD_SRC = $(srcdir)/$(BFD_DIR)
-BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC)
-
-INCLUDES = -I. -I../ -I$(srcdir) -I$(srcdir)/../../include @GDB_INCLUDE@
+INCLUDES = -I. -I../ -I$(srcdir) -I$(srcdir)/../../include
libcommon_a_OBJS = signals.o $(COMMON_CPU_OBJ)
libcommon_a_SOURCES = signals.c $(COMMON_CPU_SRC)
@@ -42,7 +38,7 @@ signals.o: $(srcdir)/signals.c
$(COMPILE) $(srcdir)/signals.c
COMPILE = source='$<' object='$@' libtool=no $(CC) $(DEFS) $(INCLUDES) \
- @GDB_FLAGS@ $(CPPFLAGS) $(ALL_CFLAGS) $(CFLAGS) -c
+ $(CPPFLAGS) $(ALL_CFLAGS) $(CFLAGS) -c
# Implicit rules
diff --git a/gdb/common/configure b/gdb/common/configure
index 957dcc3..31b353e 100755
--- a/gdb/common/configure
+++ b/gdb/common/configure
@@ -553,8 +553,6 @@ PACKAGE_URL=
ac_unique_file="."
ac_subst_vars='LTLIBOBJS
LIBOBJS
-GDB_INCLUDE
-GDB_FLAGS
COMMON_CPU_SRC
COMMON_CPU_OBJ
SET_MAKE
@@ -625,7 +623,6 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
-enable_gdbserver
'
ac_precious_vars='build_alias
host_alias
@@ -1244,12 +1241,6 @@ if test -n "$ac_init_help"; then
cat <<\_ACEOF
-Optional Features:
- --disable-option-checking ignore unrecognized --enable/--with options
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-gdbserver build libcommon.a for gdbserver
-
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@@ -2952,26 +2943,6 @@ case "$host_cpu" in
;;
esac
-# Determine whether or not build libcommon.a for gdbserver
-# Check whether --enable-gdbserver was given.
-if test "${enable_gdbserver+set}" = set; then :
- enableval=$enable_gdbserver;
-else
- enable_gdbserver=no
-fi
-
-
-if test x"$enable_gdbserver" = xyes; then
- GDB_FLAGS="-DGDBSERVER"
- GDB_INCLUDE="-I\$(srcdir)/../gdbserver/"
-else
- GDB_FLAGS=""
- GDB_INCLUDE="-I\$(srcdir)/../ -I\$(BFD_DIR)"
-fi
-
-
-
-
ac_config_files="$ac_config_files Makefile"
diff --git a/gdb/common/configure.ac b/gdb/common/configure.ac
index 1ef85fe..4f0d904 100644
--- a/gdb/common/configure.ac
+++ b/gdb/common/configure.ac
@@ -53,22 +53,6 @@ case "$host_cpu" in
;;
esac
-# Determine whether or not build libcommon.a for gdbserver
-AC_ARG_ENABLE(gdbserver,
-[ --enable-gdbserver build libcommon.a for gdbserver],
-[], [enable_gdbserver=no])
-
-if test x"$enable_gdbserver" = xyes; then
- GDB_FLAGS="-DGDBSERVER"
- GDB_INCLUDE="-I\$(srcdir)/../gdbserver/"
-else
- GDB_FLAGS=""
- GDB_INCLUDE="-I\$(srcdir)/../ -I\$(BFD_DIR)"
-fi
-
-AC_SUBST(GDB_FLAGS)
-AC_SUBST(GDB_INCLUDE)
-
AC_EXEEXT
AC_OUTPUT([Makefile])