This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa/rfc] Build libcommon.a for gdb and gdbserver


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]