aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-11-06 22:57:06 +0700
committerMike Frysinger <vapier@gentoo.org>2022-12-21 22:21:25 -0500
commitf4ac2306058aecab760b05e425d089a1c86e0618 (patch)
tree005aeb69d37d4afa1d25e8c071ed013f29d28453 /sim/common
parent3d0421178673d74a790637e31fed944bf48aa3aa (diff)
downloadgdb-f4ac2306058aecab760b05e425d089a1c86e0618.zip
gdb-f4ac2306058aecab760b05e425d089a1c86e0618.tar.gz
gdb-f4ac2306058aecab760b05e425d089a1c86e0618.tar.bz2
sim: hw-config.h: move generation to top-level
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.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/Make-common.in18
-rw-r--r--sim/common/local.mk21
2 files changed, 21 insertions, 18 deletions
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index ff4e171..52cc3c9 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 bf9b97d..caffca9 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