sim: modules: trigger generation from top-level
authorMike Frysinger <vapier@gentoo.org>
Sun, 25 Dec 2022 19:40:47 +0000 (14:40 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 10 Jan 2023 06:15:23 +0000 (01:15 -0500)
Add rules for tracking generated subdir modules.c files.  This doesn't
actually generate the file from the top-level, but allows us to add
rules that need to be ordered wrt it.  Once those changes land, we can
rework this to actually generate from the top-level.

This currently builds off of the objects that go into the libsim.a as
we don't build those from the top-level either.  Once we migrate that
up, we can switch this to the source files directly.  It's a bit hacky
overall, but makes it easier to migrate things in smaller chunks, and
we aren't going to keep this logic long term.

18 files changed:
sim/Makefile.in
sim/bpf/local.mk
sim/common/Make-common.in
sim/common/local.mk
sim/cr16/local.mk
sim/cris/local.mk
sim/d10v/local.mk
sim/frv/local.mk
sim/iq2000/local.mk
sim/lm32/local.mk
sim/m32c/local.mk
sim/m32r/local.mk
sim/m68hc11/local.mk
sim/mips/local.mk
sim/mn10300/local.mk
sim/or1k/local.mk
sim/sh/local.mk
sim/v850/local.mk

index 96305a397ce9b77349884984a7acc23660240467..d04260f0e7409625163ef196860fb3262299b819 100644 (file)
@@ -1271,7 +1271,9 @@ CLEANFILES = common/version.c common/version.c-stamp \
        testsuite/common/bits64m63.c
 DISTCLEANFILES = $(am__append_76)
 MOSTLYCLEANFILES = core $(common_HW_CONFIG_H_TARGETS) $(patsubst \
-       %,%/stamp-hw,$(SIM_ENABLED_ARCHES)) $(am__append_7) \
+       %,%/stamp-hw,$(SIM_ENABLED_ARCHES)) \
+       $(common_GEN_MODULES_C_TARGETS) $(patsubst \
+       %,%/stamp-modules,$(SIM_ENABLED_ARCHES)) $(am__append_7) \
        site-sim-config.exp testrun.log testrun.sum $(am__append_16) \
        $(am__append_21) $(am__append_27) $(am__append_32) \
        $(am__append_40) $(am__append_46) $(am__append_51) \
@@ -1287,12 +1289,13 @@ AM_CPPFLAGS_FOR_BUILD = -I$(srcroot)/include $(SIM_HW_CFLAGS) \
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 SIM_ALL_RECURSIVE_DEPS = common/libcommon.a \
-       $(common_HW_CONFIG_H_TARGETS) $(am__append_4) $(am__append_15) \
-       $(am__append_19) $(am__append_26) $(am__append_30) \
-       $(am__append_39) $(am__append_45) $(am__append_50) \
-       $(am__append_53) $(am__append_59) $(am__append_63) \
-       $(am__append_74) $(am__append_80) $(am__append_86) \
-       $(am__append_95) $(am__append_100)
+       $(common_HW_CONFIG_H_TARGETS) $(common_GEN_MODULES_C_TARGETS) \
+       $(am__append_4) $(am__append_15) $(am__append_19) \
+       $(am__append_26) $(am__append_30) $(am__append_39) \
+       $(am__append_45) $(am__append_50) $(am__append_53) \
+       $(am__append_59) $(am__append_63) $(am__append_74) \
+       $(am__append_80) $(am__append_86) $(am__append_95) \
+       $(am__append_100)
 SIM_INSTALL_DATA_LOCAL_DEPS = 
 SIM_INSTALL_EXEC_LOCAL_DEPS = $(am__append_34)
 SIM_UNINSTALL_LOCAL_DEPS = $(am__append_35)
@@ -1328,6 +1331,13 @@ SIM_NEW_COMMON_OBJS = sim-arange.o sim-bits.o sim-close.o \
        sim-watch.o $(am__append_2)
 SIM_HW_DEVICES = cfi core pal glue
 common_HW_CONFIG_H_TARGETS = $(patsubst %,%/hw-config.h,$(SIM_ENABLED_ARCHES))
+am_arch_d = $(subst -,_,$(@D))
+GEN_MODULES_C_SRCS = \
+       $(wildcard \
+               $(patsubst %.o,$(abs_srcdir)/%.c,$($(am_arch_d)_libsim_a_OBJECTS) $($(am_arch_d)_libsim_a_LIBADD)) \
+               $(filter-out %.o,$(patsubst $(@D)/%.o,$(abs_srcdir)/common/%.c,$($(am_arch_d)_libsim_a_LIBADD))))
+
+common_GEN_MODULES_C_TARGETS = $(patsubst %,%/modules.c,$(filter-out ppc,$(SIM_ENABLED_ARCHES)))
 LIBIBERTY_LIB = ../libiberty/libiberty.a
 BFD_LIB = ../bfd/libbfd.la
 OPCODES_LIB = ../opcodes/libopcodes.la
@@ -3370,6 +3380,8 @@ common/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(src
        $(SHELL) $(srcroot)/move-if-change $@.tmp $(@D)/hw-config.h; \
        touch $@
 .PRECIOUS: %/stamp-hw
+%/modules.c:
+       $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) GEN_MODULES_C_SRCS="$(GEN_MODULES_C_SRCS)" -C $(@D) $(@F)
 
 # Alias for developers.
 @SIM_ENABLE_IGEN_TRUE@igen: $(IGEN)
@@ -3502,6 +3514,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_bfin_TRUE@    ) > $@.tmp
 @SIM_ENABLE_ARCH_bfin_TRUE@    $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(srcdir)/bfin/linux-fixed-code.h
 @SIM_ENABLE_ARCH_bfin_TRUE@    $(AM_V_at)touch $(srcdir)/bfin/linux-fixed-code.h
+@SIM_ENABLE_ARCH_bpf_TRUE@bpf/modules.c: | $(bpf_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_bpf_TRUE@bpf/mloop-le.c bpf/eng-le.h: bpf/stamp-mloop-le ; @true
 @SIM_ENABLE_ARCH_bpf_TRUE@bpf/stamp-mloop-le: $(srccom)/genmloop.sh bpf/mloop.in
@@ -3549,6 +3562,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_bpf_TRUE@bpf/cgen-decode-be:
 @SIM_ENABLE_ARCH_bpf_TRUE@     $(AM_V_GEN)isa=ebpfbe cpu=bpfbf mach=bpf FLAGS="with-scache" SUFFIX="-be" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_DECODE)
 @SIM_ENABLE_ARCH_bpf_TRUE@bpf/sem-be.c bpf/decode-be.c bpf/decode-be.h: @CGEN_MAINT@ bpf/cgen-decode-be
+@SIM_ENABLE_ARCH_cr16_TRUE@cr16/modules.c: | $(cr16_BUILD_OUTPUTS)
 
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_cr16_TRUE@cr16/gencode$(EXEEXT): $(cr16_gencode_OBJECTS) $(cr16_gencode_DEPENDENCIES) cr16/$(am__dirstamp)
@@ -3565,6 +3579,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_cr16_TRUE@cr16/table.c: cr16/gencode$(EXEEXT)
 @SIM_ENABLE_ARCH_cr16_TRUE@    $(AM_V_GEN)$< >$@
+@SIM_ENABLE_ARCH_cris_TRUE@cris/modules.c: | $(cris_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_cris_TRUE@cris/mloopv10f.c cris/engv10.h: cris/stamp-mloop-v10f ; @true
 @SIM_ENABLE_ARCH_cris_TRUE@cris/stamp-mloop-v10f: $(srccom)/genmloop.sh cris/mloop.in
@@ -3601,6 +3616,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_cris_TRUE@    $(AM_V_GEN)cpu=crisv32f mach=crisv32 SUFFIX=v32 FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEMSW)"; $(CGEN_GEN_CPU_DECODE)
 @SIM_ENABLE_ARCH_cris_TRUE@    $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $(srcdir)/cris/semv32-switch.c $(srcdir)/cris/semcrisv32f-switch.c
 @SIM_ENABLE_ARCH_cris_TRUE@cris/cpuv32.h cris/cpuv32.c cris/semcrisv32f-switch.c cris/modelv32.c cris/decodev32.c cris/decodev32.h: @CGEN_MAINT@ cris/cgen-cpu-decode-v32f
+@SIM_ENABLE_ARCH_d10v_TRUE@d10v/modules.c: | $(d10v_BUILD_OUTPUTS)
 
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_d10v_TRUE@d10v/gencode$(EXEEXT): $(d10v_gencode_OBJECTS) $(d10v_gencode_DEPENDENCIES) d10v/$(am__dirstamp)
@@ -3629,6 +3645,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_erc32_TRUE@   $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) erc32/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
 @SIM_ENABLE_ARCH_erc32_TRUE@sim-erc32-uninstall-local:
 @SIM_ENABLE_ARCH_erc32_TRUE@   rm -f $(DESTDIR)$(bindir)/sis
+@SIM_ENABLE_ARCH_frv_TRUE@frv/modules.c: | $(frv_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_frv_TRUE@frv/mloop.c frv/eng.h: frv/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_frv_TRUE@frv/stamp-mloop: $(srccom)/genmloop.sh frv/mloop.in
@@ -3649,6 +3666,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_frv_TRUE@frv/cgen-cpu-decode:
 @SIM_ENABLE_ARCH_frv_TRUE@     $(AM_V_GEN)cpu=frvbf mach=frv,fr550,fr500,fr450,fr400,tomcat,simple FLAGS="with-scache with-profile=fn with-generic-write with-parallel-only" EXTRAFILES="$(CGEN_CPU_SEM)"; $(CGEN_GEN_CPU_DECODE)
 @SIM_ENABLE_ARCH_frv_TRUE@frv/cpu.h frv/sem.c frv/model.c frv/decode.c frv/decode.h: @CGEN_MAINT@ frv/cgen-cpu-decode
+@SIM_ENABLE_ARCH_iq2000_TRUE@iq2000/modules.c: | $(iq2000_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_iq2000_TRUE@iq2000/mloop.c iq2000/eng.h: iq2000/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_iq2000_TRUE@iq2000/stamp-mloop: $(srccom)/genmloop.sh iq2000/mloop.in
@@ -3669,6 +3687,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_iq2000_TRUE@iq2000/cgen-cpu-decode:
 @SIM_ENABLE_ARCH_iq2000_TRUE@  $(AM_V_GEN)cpu=iq2000bf mach=iq2000 FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"; $(CGEN_GEN_CPU_DECODE)
 @SIM_ENABLE_ARCH_iq2000_TRUE@iq2000/cpu.h iq2000/sem.c iq2000/sem-switch.c iq2000/model.c iq2000/decode.c iq2000/decode.h: @CGEN_MAINT@ iq2000/cgen-cpu-decode
+@SIM_ENABLE_ARCH_lm32_TRUE@lm32/modules.c: | $(lm32_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_lm32_TRUE@lm32/mloop.c lm32/eng.h: lm32/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_lm32_TRUE@lm32/stamp-mloop: $(srccom)/genmloop.sh lm32/mloop.in
@@ -3692,6 +3711,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_m32c_TRUE@m32c/%.o: m32c/%.c | m32c/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
 @SIM_ENABLE_ARCH_m32c_TRUE@    $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+@SIM_ENABLE_ARCH_m32c_TRUE@m32c/modules.c: | $(m32c_BUILD_OUTPUTS)
 
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_m32c_TRUE@m32c/opc2c$(EXEEXT): $(m32c_opc2c_OBJECTS) $(m32c_opc2c_DEPENDENCIES) m32c/$(am__dirstamp)
@@ -3708,6 +3728,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_m32c_TRUE@m32c/r8c.c: m32c/r8c.opc m32c/opc2c$(EXEEXT)
 @SIM_ENABLE_ARCH_m32c_TRUE@    $(AM_V_GEN)$(m32c_OPC2C_RUN) -l $@.log $< > $@.tmp
 @SIM_ENABLE_ARCH_m32c_TRUE@    $(AM_V_at)mv $@.tmp $@
+@SIM_ENABLE_ARCH_m32r_TRUE@m32r/modules.c: | $(m32r_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_m32r_TRUE@m32r/mloop.c m32r/eng.h: m32r/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_m32r_TRUE@m32r/stamp-mloop: $(srccom)/genmloop.sh m32r/mloop.in
@@ -3756,6 +3777,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_m32r_TRUE@m32r/cgen-cpu-decode-2:
 @SIM_ENABLE_ARCH_m32r_TRUE@    $(AM_V_GEN)cpu=m32r2f mach=m32r2 SUFFIX=2 FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEMSW)"; $(CGEN_GEN_CPU_DECODE)
 @SIM_ENABLE_ARCH_m32r_TRUE@m32r/cpu2.h m32r/sem2-switch.c m32r/model2.c m32r/decode2.c m32r/decode2.h: @CGEN_MAINT@ m32r/cgen-cpu-decode-2
+@SIM_ENABLE_ARCH_m68hc11_TRUE@m68hc11/modules.c: | $(m68hc11_BUILD_OUTPUTS)
 
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_m68hc11_TRUE@m68hc11/gencode$(EXEEXT): $(m68hc11_gencode_OBJECTS) $(m68hc11_gencode_DEPENDENCIES) m68hc11/$(am__dirstamp)
@@ -3770,6 +3792,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_m68hc11_TRUE@m68hc11/m68hc12int.c: m68hc11/gencode$(EXEEXT)
 @SIM_ENABLE_ARCH_m68hc11_TRUE@ $(AM_V_GEN)$< -m6812 >$@
+@SIM_ENABLE_ARCH_mips_TRUE@mips/modules.c: | $(mips_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_mips_TRUE@$(mips_BUILT_SRC_FROM_IGEN_ITABLE): mips/stamp-igen-itable
 @SIM_ENABLE_ARCH_mips_TRUE@$(mips_BUILT_SRC_FROM_GEN_MODE_SINGLE): mips/stamp-gen-mode-single
@@ -3968,6 +3991,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_mips_TRUE@      esac \
 @SIM_ENABLE_ARCH_mips_TRUE@    done
 @SIM_ENABLE_ARCH_mips_TRUE@    $(AM_V_at)touch $@
+@SIM_ENABLE_ARCH_mn10300_TRUE@mn10300/modules.c: | $(mn10300_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_mn10300_TRUE@$(mn10300_BUILT_SRC_FROM_IGEN): mn10300/stamp-igen
 @SIM_ENABLE_ARCH_mn10300_TRUE@mn10300/stamp-igen: $(mn10300_IGEN_INSN) $(mn10300_IGEN_INSN_INC) $(mn10300_IGEN_DC) $(IGEN)
@@ -4008,6 +4032,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 @SIM_ENABLE_ARCH_moxie_TRUE@     echo "tree compiler tool (dtc) is missing.  Install the tool to "; \
 @SIM_ENABLE_ARCH_moxie_TRUE@     echo "update the device tree blob."; \
 @SIM_ENABLE_ARCH_moxie_TRUE@   fi
+@SIM_ENABLE_ARCH_or1k_TRUE@or1k/modules.c: | $(or1k_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_or1k_TRUE@or1k/mloop.c or1k/eng.h: or1k/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_or1k_TRUE@or1k/stamp-mloop: $(srccom)/genmloop.sh or1k/mloop.in
@@ -4050,6 +4075,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_rx_TRUE@rx/%.o: rx/%.c | rx/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
 @SIM_ENABLE_ARCH_rx_TRUE@      $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+@SIM_ENABLE_ARCH_sh_TRUE@sh/modules.c: | $(sh_BUILD_OUTPUTS)
 
 # These rules are copied from automake, but tweaked to use FOR_BUILD variables.
 @SIM_ENABLE_ARCH_sh_TRUE@sh/gencode$(EXEEXT): $(sh_gencode_OBJECTS) $(sh_gencode_DEPENDENCIES) sh/$(am__dirstamp)
@@ -4067,6 +4093,7 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_sh_TRUE@sh/table.c: sh/gencode$(EXEEXT)
 @SIM_ENABLE_ARCH_sh_TRUE@      $(AM_V_GEN)$< -s >$@
+@SIM_ENABLE_ARCH_v850_TRUE@v850/modules.c: | $(v850_BUILD_OUTPUTS)
 
 @SIM_ENABLE_ARCH_v850_TRUE@$(v850_BUILT_SRC_FROM_IGEN): v850/stamp-igen
 @SIM_ENABLE_ARCH_v850_TRUE@v850/stamp-igen: $(v850_IGEN_INSN) $(v850_IGEN_DC) $(IGEN)
index 4ba1f461303c1e0c84b8d7ec444b08eb79787f4f..f86f3306a8a9e97dacdff3f969fc5732e491fa0d 100644 (file)
@@ -35,6 +35,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %D%/mloop-le.c %D%/eng-le.h: %D%/stamp-mloop-le ; @true
 %D%/stamp-mloop-le: $(srccom)/genmloop.sh %D%/mloop.in
index 35477d94bb8e282cfc0a3913ef900cd6e1d88d39..b56a49a0051f6f2829f6a0787afd25af2ee18757 100644 (file)
@@ -186,8 +186,7 @@ endif
 
 all_object_files = $(LIB_OBJS) $(SIM_RUN_OBJS)
 generated_files = \
-       $(SIM_EXTRA_DEPS) \
-       modules.c
+       $(SIM_EXTRA_DEPS)
 
 # Ensure that generated files are created early.  Use order-only
 # dependencies if available.  They require GNU make 3.80 or newer,
@@ -212,7 +211,7 @@ stamp-modules: Makefile $(SIM_OBJS:.o=.c)
        $(ECHO_STAMP) modules.c
        $(SILENCE) LANG=C ; export LANG ; \
        LC_ALL=C ; export LC_ALL ; \
-       sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $^ | sort >$@.l-tmp
+       sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $^ $(GEN_MODULES_C_SRCS) | sort >$@.l-tmp
        @set -e; (\
        echo '/* Do not modify this file.  */'; \
        echo '/* It is created automatically by the Makefile.  */'; \
index dd6ed5fec83ca574f67cf7632febb084af7c9651..128b770dbe1050518703ef569d9b9d9d5677830e 100644 (file)
@@ -130,6 +130,22 @@ endif
 MOSTLYCLEANFILES += $(%C%_HW_CONFIG_H_TARGETS) $(patsubst %,%/stamp-hw,$(SIM_ENABLED_ARCHES))
 SIM_ALL_RECURSIVE_DEPS += $(%C%_HW_CONFIG_H_TARGETS)
 
+## See sim_pre_argv_init and sim_module_install in sim-module.c for more details.
+## TODO: Switch this to xxx_SOURCES once projects build objects in local.mk.
+am_arch_d = $(subst -,_,$(@D))
+GEN_MODULES_C_SRCS = \
+       $(wildcard \
+               $(patsubst %.o,$(abs_srcdir)/%.c,$($(am_arch_d)_libsim_a_OBJECTS) $($(am_arch_d)_libsim_a_LIBADD)) \
+               $(filter-out %.o,$(patsubst $(@D)/%.o,$(abs_srcdir)/common/%.c,$($(am_arch_d)_libsim_a_LIBADD))))
+%/modules.c:
+       $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) GEN_MODULES_C_SRCS="$(GEN_MODULES_C_SRCS)" -C $(@D) $(@F)
+
+## NB: The ppc port doesn't currently utilize the modules API, so skip it.
+%C%_GEN_MODULES_C_TARGETS = $(patsubst %,%/modules.c,$(filter-out ppc,$(SIM_ENABLED_ARCHES)))
+MOSTLYCLEANFILES += $(%C%_GEN_MODULES_C_TARGETS) $(patsubst %,%/stamp-modules,$(SIM_ENABLED_ARCHES))
+## TODO: Drop this once each port's local.mk:libsim.a depends on it themself.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_GEN_MODULES_C_TARGETS)
+
 LIBIBERTY_LIB = ../libiberty/libiberty.a
 BFD_LIB = ../bfd/libbfd.la
 OPCODES_LIB = ../opcodes/libopcodes.la
index f5401f6d5f93f4907d100e02d2cd4cab4f6f16c5..8e28cc356f58af36700af45996abb7155aff4f3d 100644 (file)
@@ -32,6 +32,7 @@ BUILT_SOURCES += %D%/simops.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %C%_gencode_SOURCES = %D%/gencode.c
 %C%_gencode_LDADD = %D%/cr16-opc.o
index 0e56fefa960ca88943496e8cfda65eb2e2093984..d55e7b84e25bb0e36c21869e32fd2c31c36733d8 100644 (file)
@@ -46,6 +46,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: What is mono and what does "Use of `mono' is wip" mean (other
 ## than the apparent; some "mono" feature is work in progress)?
index 38a3c9263d6299b54c458b6ac9ee500dfef7e79c..2556845ed1d1a8e996ea5084f39d2f14fd24747e 100644 (file)
@@ -32,6 +32,7 @@ BUILT_SOURCES += %D%/simops.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %C%_gencode_SOURCES = %D%/gencode.c
 %C%_gencode_LDADD = %D%/d10v-opc.o
index 11db636a71593fc8a009a3c506cd3b7620fe7f05..471b0adc653363704b1dcf9cabbfb9cee7737846 100644 (file)
@@ -35,6 +35,7 @@ BUILT_SOURCES += %D%/eng.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: Use of `mono' is wip.
 %D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
index 881cf2c55dcd9178860fc25b07f45a13665be51f..4113b4bc2f39563032b9ef37c38f705b14f8d79b 100644 (file)
@@ -32,6 +32,7 @@ BUILT_SOURCES += %D%/eng.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: Use of `mono' is wip.
 %D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
index 3f9606410d62b7c59915ed8136fd9cd3449b6281..311de7df47e8cf04aa6108ba9eac615f06846053 100644 (file)
@@ -35,6 +35,7 @@ BUILT_SOURCES += %D%/eng.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: Use of `mono' is wip.
 %D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
index 1a542f1865539f5cfe67bb6f3fbdbc042d3bd555..75909075a1e3cd8e8539fc03c3c1fc635fca443f 100644 (file)
@@ -35,6 +35,7 @@ noinst_PROGRAMS += %D%/run
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %C%_opc2c_SOURCES = %D%/opc2c.c
 
index 4f9f2bc257dcf390738b575b37d699429602aba0..9814ae5c6c16323b689d107c9fcd8c994e936b0f 100644 (file)
@@ -42,6 +42,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: Use of `mono' is wip.
 %D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
index 187bd389cefe526401191d9de075be59a638fe10..d2e04576a7714fe012bbe6c779136bce74769007 100644 (file)
@@ -34,6 +34,7 @@ AM_MAKEFLAGS += %C%_SIM_EXTRA_HW_DEVICES="$(%C%_SIM_EXTRA_HW_DEVICES)"
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %C%_gencode_SOURCES = %D%/gencode.c
 
index 9db960ca4beb5f41d1669d7a3195d5fe73e60449..5a7b12c29a1ecc4134ce4b9711200f92a982ebcc 100644 (file)
@@ -96,6 +96,7 @@ endif
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 $(%C%_BUILT_SRC_FROM_IGEN_ITABLE): %D%/stamp-igen-itable
 $(%C%_BUILT_SRC_FROM_GEN_MODE_SINGLE): %D%/stamp-gen-mode-single
index afb1df75f2ef0dd98320f784a1dd66c0e85215ac..d24e6b8d04055cc6f7430698869ba06ede11bf3b 100644 (file)
@@ -58,6 +58,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 $(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
 
index ef8ae2a6abcb4882ab77022dc112e8bc10cf88e0..7d999f6f3aa425781666ad5714b904601f732367 100644 (file)
@@ -34,6 +34,7 @@ BUILT_SOURCES += %D%/eng.h
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 ## FIXME: Use of `mono' is wip.
 %D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
index 8c2ce0da1499a1765af2ed4027b2a033a39fbff2..c25ab536c681ae2abbf864df6daa9542d27080f8 100644 (file)
@@ -36,6 +36,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 %C%_gencode_SOURCES = %D%/gencode.c
 
index 4741e070a30047f8e9c6c78cae0d77c46763a34d..2c27d0c6d7eae5f04848a89fe0cb138ee877bb9f 100644 (file)
@@ -55,6 +55,7 @@ BUILT_SOURCES += \
 
 ## This makes sure build tools are available before building the arch-subdirs.
 SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
 
 $(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen