[RFA 06/13] Move unittests object files to unittests subdirectory

Tom Tromey tom@tromey.com
Tue Nov 21 22:10:00 GMT 2017


Move the object files corresponding to unittests/*.c to the unittests
subdirectory in the build tree.

ChangeLog
2017-11-21  Tom Tromey  <tom@tromey.com>

	* Makefile.in (SUBDIR_UNITTESTS_OBS): Redefine.
	(%.o): Remove unittests rule.
	(CONFIG_SRC_SUBDIR): Add unittests.
---
 gdb/ChangeLog   |  6 ++++++
 gdb/Makefile.in | 20 ++------------------
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 77821d356e..aef015d9cf 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -490,19 +490,7 @@ SUBDIR_UNITTESTS_SRCS = \
 	unittests/scoped_restore-selftests.c \
 	unittests/xml-utils-selftests.c
 
-SUBDIR_UNITTESTS_OBS = \
-	array-view-selftests.o \
-	common-utils-selftests.o \
-	environ-selftests.o \
-	function-view-selftests.o \
-	lookup_name_info-selftests.o \
-	memory-map-selftests.o \
-	memrange-selftests.o \
-	offset-type-selftests.o \
-	optional-selftests.o \
-	ptid-selftests.o \
-	scoped_restore-selftests.o \
-	xml-utils-selftests.o
+SUBDIR_UNITTESTS_OBS = $(patsubst %.c,%.o,$(SUBDIR_UNITTESTS_SRCS))
 
 # Opcodes currently live in one of two places.  Either they are in the
 # opcode library, typically ../opcodes, or they are in a header file
@@ -593,7 +581,7 @@ CONFIG_INSTALL = @CONFIG_INSTALL@
 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
 HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 
-CONFIG_SRC_SUBDIR = arch cli mi compile tui
+CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests
 CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
 
 # -I. for config files.
@@ -1906,10 +1894,6 @@ $(CONFIG_DEP_SUBDIR):
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ${srcdir}/unittests/%.c
-	$(COMPILE) $<
-	$(POSTCOMPILE)
-
 # Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
 # object file generate by gdb/agent.c.
 common-agent.o: $(srcdir)/common/agent.c
-- 
2.13.6



More information about the Gdb-patches mailing list