This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfa/rfc] Build libcommon.a for gdb and gdbserver
- From: Yao Qi <yao at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Joel Brobecker <brobecker at adacore dot com>, Pedro Alves <pedro at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Thu, 03 Mar 2011 13:59:53 +0800
- Subject: Re: [rfa/rfc] Build libcommon.a for gdb and gdbserver
- References: <m3wrlgdcxc.fsf@fleche.redhat.com> <4D550834.6080807@codesourcery.com> <m3sjvul875.fsf@fleche.redhat.com> <4D55FAB4.7090001@codesourcery.com> <m3pqquhcis.fsf@fleche.redhat.com> <m3r5bafqhl.fsf@fleche.redhat.com> <4D648A5F.8050607@codesourcery.com> <m3oc62k8wy.fsf@fleche.redhat.com> <4D65D5B7.1000902@codesourcery.com> <m3tyfo82a8.fsf@fleche.redhat.com> <20110301044144.GH30306@adacore.com> <4D6C882B.7010801@codesourcery.com> <m38vwy7vrr.fsf@fleche.redhat.com> <4D6DCA56.4030008@codesourcery.com> <m3oc5t4mhc.fsf@fleche.redhat.com>
On 03/02/2011 10:37 PM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
>
> Yao> gdb/
> Yao> * Makefile.in (configure-common): Remove. Let Makefile
> Yao> in dir common to rebuild itself.
> Yao> (common/Makefile): Likewise.
>
> This part looks ok.
Applied this part first.
> But the code still has:
>
> Yao> $(LIBCOMMON): $(LIBCOMMON_DIR)/Makefile
> Yao> @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=common subdir_do
>
> Now there isn't a rule to build $(LIBCOMMON_DIR)/Makefile.
>
> I suspect the $(LIBCOMMON) target isn't needed, but removing it may
> require some other changes.
The current dependency relationship is like this,
all: gdb$(EXEEXT) $(CONFIG_ALL)
@$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed
's/testsuite//'`" subdir_do
gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
while CDEPS includes $(LIBGNU) and $(LIBCOMMON)
CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
$(LIBCOMMON)
so target $(LIBCOMMON) and $(LIBGNU) is needed in target gdb$(EXEEXT),
before going to subdir to build in `all:'.
We can fix this problem by 1) removing $(LIBGNU) and $(LIBCOMMON) from
CDEPS, 2) leaving to Makefile in gnulib/ and common/ to build lib as
needed in target gdb$(EXEEXT).
--
Yao (éå)
gdb/
* Makefile.in (CLIBS): Remove LIBGNU and LIBCOMMON.
(BUILD_SUBDIRS): New.
Remove targets $(LIBCOMMON) and $(LIBGNU).
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 00d624f..4c2d7e3 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -475,8 +475,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER
$(LIBEXPAT) \
$(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBCOMMON)
CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
- $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
- $(LIBCOMMON)
+ $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS)
ADD_FILES = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
ADD_DEPS = $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
@@ -896,6 +895,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
TSOBS = inflow.o
+BUILD_SUBDIRS = common gnulib
SUBDIRS = doc @subdirs@ data-directory
CLEANDIRS = $(SUBDIRS) gnulib
@@ -1154,6 +1154,7 @@ init.c: $(INIT_FILES)
# Removing the old gdb first works better if it is running, at least on SunOS.
gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
rm -f gdb$(EXEEXT)
+ @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=$(BUILD_SUBDIRS)" subdir_do
$(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
-o gdb$(EXEEXT) gdb.o libgdb.a \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
@@ -1165,15 +1166,11 @@ $(TUI)$(EXEEXT): tui-main.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
# Convenience rule to handle recursion.
-$(LIBGNU) $(GNULIB_H): all-lib
+$(GNULIB_H): all-lib
all-lib: gnulib/Makefile
@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=gnulib subdir_do
.PHONY: all-lib
-#
-$(LIBCOMMON): $(LIBCOMMON_DIR)/Makefile
- @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=common subdir_do
-
# Convenience rule to handle recursion.
.PHONY: all-data-directory
all-data-directory: data-directory/Makefile