From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15160 invoked by alias); 2 Mar 2011 14:46:57 -0000 Received: (qmail 15150 invoked by uid 22791); 2 Mar 2011 14:46:55 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,SARE_SUB_RAND_LETTRS4,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Mar 2011 14:46:51 +0000 Received: (qmail 10976 invoked from network); 2 Mar 2011 14:46:48 -0000 Received: from unknown (HELO ?192.168.0.101?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 2 Mar 2011 14:46:48 -0000 Message-ID: <4D6E5854.4020103@codesourcery.com> Date: Wed, 02 Mar 2011 14:46:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Joel Brobecker CC: gdb-patches@sourceware.org Subject: Re: Include dir intl when building libcommon.a for gdb References: <4D6C90AC.9010003@codesourcery.com> <20110302121407.GO30306@adacore.com> In-Reply-To: <20110302121407.GO30306@adacore.com> Content-Type: multipart/mixed; boundary="------------020502080902000808010306" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00094.txt.bz2 This is a multi-part message in MIME format. --------------020502080902000808010306 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 1929 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 (齐尧) --------------020502080902000808010306 Content-Type: text/x-patch; name="common-conf-make-0302.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="common-conf-make-0302.patch" Content-length: 3251 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]) --------------020502080902000808010306--