[1/2] sim: unify sim-load.o building

Message ID 20210613033914.32283-1-vapier@gentoo.org
State New
Headers show
Series
  • [1/2] sim: unify sim-load.o building
Related show

Commit Message

Simon Marchi via Gdb-patches June 13, 2021, 3:39 a.m.
Since this file does not rely on any port-specific settings, move it
up to building as part of the common step so we only do it once in a
multibuild.
---
 sim/Makefile.in           | 50 ++++++++++++++++++++++++++++++++++++---
 sim/common/Make-common.in |  6 +++--
 sim/common/defs.h         |  4 ++++
 sim/common/local.mk       |  6 +++++
 4 files changed, 61 insertions(+), 5 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 999b1eea00a9..8454d165830f 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -179,7 +179,6 @@  SIM_NEW_COMMON_OBJS = \
 	sim-hrw.o \
 	sim-io.o \
 	sim-info.o \
-	sim-load.o \
 	sim-memopt.o \
 	sim-model.o \
 	sim-module.o \
@@ -254,7 +253,10 @@  LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
 	$(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
 
-COMMON_OBJS = ../common/version.o
+COMMON_OBJS_NAMES = \
+	sim-load.o \
+	version.o
+COMMON_OBJS = $(COMMON_OBJS_NAMES:%=../common/common_libcommon_a-%)
 
 LIB_OBJS = callback.o modules.o syscall.o targ-map.o $(COMMON_OBJS) $(SIM_OBJS)
 
diff --git a/sim/common/defs.h b/sim/common/defs.h
index 4b5da7bfa369..21ad2a44d3ba 100644
--- a/sim/common/defs.h
+++ b/sim/common/defs.h
@@ -37,6 +37,8 @@ 
 /* Include arch-specific sim's various configure tests.  */
 #include "config.h"
 
+#ifndef SIM_COMMON_BUILD
+
 /* Reset macros that our config.h will provide.  */
 #undef PACKAGE
 #undef PACKAGE_BUGREPORT
@@ -52,3 +54,5 @@ 
 #endif
 
 #endif
+
+#endif
diff --git a/sim/common/local.mk b/sim/common/local.mk
index 357be755578f..a340febfcdd1 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -28,7 +28,13 @@  SIM_ALL_RECURSIVE_DEPS += \
 # NB: libcommon.a isn't used directly by ports.  We need a target for common
 # objects to be a part of, and ports use the individual objects directly.
 noinst_LIBRARIES += %D%/libcommon.a
+%C%_libcommon_a_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-DSIM_COMMON_BUILD \
+	-I../bfd \
+	-I..
 %C%_libcommon_a_SOURCES = \
+	%D%/sim-load.c \
 	%D%/version.c
 
 %D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh