aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-14 04:39:39 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-05 10:09:27 -0400
commit5bea0c32765c297541290a5e2bef6b24a86a069d (patch)
tree16ab7b95a9b8d4d3f541c6b19dee2f762c567bc5 /sim/common
parentad4bd975fc27a996b16b4d94706d1bf70574590c (diff)
downloadgdb-5bea0c32765c297541290a5e2bef6b24a86a069d.zip
gdb-5bea0c32765c297541290a5e2bef6b24a86a069d.tar.gz
gdb-5bea0c32765c297541290a5e2bef6b24a86a069d.tar.bz2
sim: common: start dedicated local.mk
This provides a space to generate things that we only need to build once per-arch. Some day that will be all of common/, but for now, we move the version.c management in.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/Make-common.in13
-rw-r--r--sim/common/local.mk37
3 files changed, 49 insertions, 9 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 4ce0c4c..ac34874 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+2021-06-05 Mike Frysinger <vapier@gentoo.org>
+
+ * Make-common.in (COMMON_OBJS): Define.
+ (LIB_OBJS): Replace version.o with $(COMMON_OBJS).
+ (version.c): Delete target.
+ (generated_files): Delete version.c.
+ * local.mk: New file.
+
2021-05-29 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (EXTRA_LIBS): Add $(LIBGNU_EXTRA_LIBS).
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 160e912..b17b2e0 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -255,8 +255,9 @@ 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)
-LIB_OBJS = callback.o modules.o syscall.o targ-map.o version.o \
- $(SIM_OBJS)
+COMMON_OBJS = ../common/version.o
+
+LIB_OBJS = callback.o modules.o syscall.o targ-map.o $(COMMON_OBJS) $(SIM_OBJS)
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
@@ -297,11 +298,6 @@ stamp-tvals: gentmap
$(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c
touch stamp-tvals
-version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/sim/common/create-version.sh
- $(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb $@.tmp
- $(SHELL) $(srcroot)/move-if-change $@.tmp $@
- touch $@
-
#
# Rules for building sim-* components. Triggered by listing the corresponding
# .o file in the list of simulator targets.
@@ -429,8 +425,7 @@ generated_files = \
hw-config.h \
modules.c \
targ-map.c \
- targ-vals.h \
- version.c
+ targ-vals.h
# Ensure that generated files are created early. Use order-only
# dependencies if available. They require GNU make 3.80 or newer,
diff --git a/sim/common/local.mk b/sim/common/local.mk
new file mode 100644
index 0000000..357be75
--- /dev/null
+++ b/sim/common/local.mk
@@ -0,0 +1,37 @@
+## See sim/Makefile.am.
+#
+# Copyright (C) 1997-2021 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Parts of the common/ sim code that have been unified.
+# Most still lives in common/Make-common.in.
+
+AM_CPPFLAGS += -I$(srcdir)/%D%
+
+# This makes sure common parts are available before building the arch-subdirs
+# which will refer to these.
+SIM_ALL_RECURSIVE_DEPS += \
+ %D%/libcommon.a
+
+# 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_SOURCES = \
+ %D%/version.c
+
+%D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh
+ $(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp
+ $(SHELL) $(srcroot)/move-if-change $@.tmp $@
+ touch $@