[prev in list] [next in list] [prev in thread] [next in thread]
List: gdb-patches
Subject: [PATCH] sim: common: start dedicated local.mk
From: Mike Frysinger via Gdb-patches <gdb-patches () sourceware ! org>
Date: 2021-05-29 22:49:21
Message-ID: 20210529224921.7794-1-vapier () gentoo ! org
[Download RAW message or body]
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.
---
sim/Makefile.am | 7 +++
sim/Makefile.in | 102 ++++++++++++++++++++++++++++++--------
sim/common/Make-common.in | 13 ++---
sim/common/local.mk | 37 ++++++++++++++
sim/igen/local.mk | 2 +-
5 files changed, 130 insertions(+), 31 deletions(-)
create mode 100644 sim/common/local.mk
diff --git a/sim/Makefile.am b/sim/Makefile.am
index 80a6d310bd59..79274beabd8d 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -40,6 +40,10 @@ AM_CPPFLAGS = -I$(srcroot)/include
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
+# Deps to add to the all-recursive target. These are built before descending
+# into any subdirs.
+SIM_ALL_RECURSIVE_DEPS =
+
# Generate nltvals.def for newlib/libgloss using devo and build tree.
# This file is shipped with distributions so we build in the source dir.
# Use `make nltvals' to rebuild.
@@ -55,7 +59,10 @@ pkginclude_HEADERS = \
$(srcroot)/include/sim/callback.h \
$(srcroot)/include/sim/sim.h
+include common/local.mk
if SIM_ENABLE_IGEN
include igen/local.mk
endif
include testsuite/local.mk
+
+all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 160e9121a6d3..b17b2e0f4530 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 000000000000..357be755578f
--- /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 $@
diff --git a/sim/igen/local.mk b/sim/igen/local.mk
index f2245727a270..a7e278661b7b 100644
--- a/sim/igen/local.mk
+++ b/sim/igen/local.mk
@@ -21,7 +21,7 @@
# This makes sure igen is available before building the arch-subdirs which
# need to run the igen tool.
-all-recursive: igen/igen$(EXEEXT)
+SIM_ALL_RECURSIVE_DEPS += igen/igen$(EXEEXT)
# Alias for developers.
igen: %D%/igen$(EXEEXT)
--
2.31.1
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic