From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] sim: hw-config.h: move generation to top-level
Date: Wed, 21 Dec 2022 00:33:21 -0500 [thread overview]
Message-ID: <20221221053321.18033-3-vapier@gentoo.org> (raw)
In-Reply-To: <20221221053321.18033-1-vapier@gentoo.org>
In order to compile arch objects from the top-level, we need to
generate the hw-config.h header, so move that logic up to the top
level first.
---
sim/Makefile.in | 45 ++++++++++++++++++++++++++++-----------
sim/common/Make-common.in | 18 ----------------
sim/common/local.mk | 21 ++++++++++++++++++
3 files changed, 54 insertions(+), 30 deletions(-)
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index ff4e17102024..52cc3c926f7f 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -197,7 +197,6 @@ endif
all_object_files = $(LIB_OBJS) $(SIM_RUN_OBJS)
generated_files = \
$(SIM_EXTRA_DEPS) \
- hw-config.h \
modules.c
# Ensure that generated files are created early. Use order-only
@@ -212,22 +211,6 @@ endif
# Dependencies.
-include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files))
-# FIXME This is one very simple-minded way of generating the file hw-config.h
-hw-config.h: stamp-hw ; @true
-stamp-hw: Makefile.in $(srccom)/Make-common.in $(config.status) Makefile
- $(ECHO_STAMP) hw-config.h
- $(SILENCE) ( \
- sim_hw="$(SIM_HW_DEVICES)" ; \
- echo "/* generated by Makefile */" ; \
- printf "extern const struct hw_descriptor dv_%s_descriptor[];\n" $$sim_hw ; \
- echo "const struct hw_descriptor * const hw_descriptors[] = {" ; \
- printf " dv_%s_descriptor,\n" $$sim_hw ; \
- echo " NULL," ; \
- echo "};" \
- ) > tmp-hw.h
- $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-hw.h hw-config.h
- $(SILENCE) touch $@
-
test-hw-events: $(srccom)/hw-events.c libsim.a
$(ECHO_CCLD) $(LIBTOOL) $(AM_V_lt) --tag=CC --mode=link \
$(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \
@@ -290,7 +273,6 @@ TAGS: force
mostlyclean clean: $(SIM_EXTRA_CLEAN)
rm -f *.[oa] *~ core \
run$(EXEEXT) libsim.a \
- hw-config.h stamp-hw \
modules.c stamp-modules \
tmp-mloop.hin tmp-mloop.h tmp-mloop.cin tmp-mloop.c
diff --git a/sim/common/local.mk b/sim/common/local.mk
index bf9b97d04d71..caffca9b02d3 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -110,6 +110,27 @@ SIM_NEW_COMMON_OBJS += \
AM_MAKEFLAGS += SIM_HW_DEVICES_="$(SIM_HW_DEVICES)"
endif
+# FIXME This is one very simple-minded way of generating the file hw-config.h.
+%/hw-config.h: %/stamp-hw ; @true
+%/stamp-hw: Makefile
+ $(AM_V_GEN)set -e; \
+ ( \
+ sim_hw="$(SIM_HW_DEVICES) $($(@D)_SIM_EXTRA_HW_DEVICES)" ; \
+ echo "/* generated by Makefile */" ; \
+ printf "extern const struct hw_descriptor dv_%s_descriptor[];\n" $$sim_hw ; \
+ echo "const struct hw_descriptor * const hw_descriptors[] = {" ; \
+ printf " dv_%s_descriptor,\n" $$sim_hw ; \
+ echo " NULL," ; \
+ echo "};" \
+ ) > $@.tmp; \
+ $(SHELL) $(srcroot)/move-if-change $@.tmp $(@D)/hw-config.h; \
+ touch $@
+.PRECIOUS: %/stamp-hw
+
+%C%_HW_CONFIG_H_TARGETS = $(patsubst %,%/hw-config.h,$(SIM_ENABLED_ARCHES))
+MOSTLYCLEANFILES += $(%C%_HW_CONFIG_H_TARGETS) $(patsubst %,%/stamp-hw,$(SIM_ENABLED_ARCHES))
+SIM_ALL_RECURSIVE_DEPS += $(%C%_HW_CONFIG_H_TARGETS)
+
LIBIBERTY_LIB = ../libiberty/libiberty.a
BFD_LIB = ../bfd/libbfd.la
OPCODES_LIB = ../opcodes/libopcodes.la
--
2.39.0
prev parent reply other threads:[~2022-12-21 5:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 5:33 [PATCH 1/3] sim: build: hoist lists of common objects up Mike Frysinger
2022-12-21 5:33 ` [PATCH 2/3] sim: build: hoist lists of hw devices up Mike Frysinger
2022-12-21 5:33 ` Mike Frysinger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221221053321.18033-3-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).