diff --git a/sim/aarch64/local.mk b/sim/aarch64/local.mk
index ff7c51e43157..113055b126dd 100644
--- a/sim/aarch64/local.mk
+++ b/sim/aarch64/local.mk
@@ -16,6 +16,8 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -24,7 +26,6 @@
 	%D%/cpustate.o \
 	%D%/interp.o \
 	%D%/memory.o \
-	%D%/modules.o \
 	%D%/sim-resume.o \
 	%D%/simulator.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
diff --git a/sim/arm/local.mk b/sim/arm/local.mk
index 2e20f8533897..0c2b1a386dc9 100644
--- a/sim/arm/local.mk
+++ b/sim/arm/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = -DMODET
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -27,8 +29,7 @@ AM_CPPFLAGS_%C% = -DMODET
 	%D%/armemu.o \
 	%D%/armemu32.o %D%/arminit.o %D%/armos.o %D%/armsupp.o \
 	%D%/armvirt.o %D%/thumbemu.o \
-	%D%/armcopro.o %D%/maverick.o %D%/iwmmxt.o \
-	%D%/modules.o
+	%D%/armcopro.o %D%/maverick.o %D%/iwmmxt.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
 noinst_LIBRARIES += %D%/libsim.a
diff --git a/sim/avr/local.mk b/sim/avr/local.mk
index 0647dedd1bd5..07752e546a12 100644
--- a/sim/avr/local.mk
+++ b/sim/avr/local.mk
@@ -15,13 +15,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	%D%/interp.o \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/bfin/local.mk b/sim/bfin/local.mk
index 9291e0641a38..e6f6662020af 100644
--- a/sim/bfin/local.mk
+++ b/sim/bfin/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = $(SDL_CFLAGS)
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -29,7 +31,6 @@ AM_CPPFLAGS_%C% = $(SDL_CFLAGS)
 	%D%/gui.o \
 	%D%/interp.o \
 	%D%/machs.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/bpf/local.mk b/sim/bpf/local.mk
index 80bf775104ff..04f06e3aed37 100644
--- a/sim/bpf/local.mk
+++ b/sim/bpf/local.mk
@@ -23,12 +23,13 @@ AM_CPPFLAGS_%C%_decode_be.o = -DWANT_ISA_EBPFBE
 AM_CPPFLAGS_%C%_sem_le.o = -DWANT_ISA_EBPFLE
 AM_CPPFLAGS_%C%_sem_be.o = -DWANT_ISA_EBPFBE
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-run.o \
 	%D%/cgen-scache.o \
diff --git a/sim/cr16/local.mk b/sim/cr16/local.mk
index cb5ae553594b..6d1dd02b68c5 100644
--- a/sim/cr16/local.mk
+++ b/sim/cr16/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/sim-resume.o \
 	%D%/simops.o \
 	%D%/table.o
diff --git a/sim/cris/local.mk b/sim/cris/local.mk
index 3976f6836ef3..884024a8e5fc 100644
--- a/sim/cris/local.mk
+++ b/sim/cris/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-run.o \
 	%D%/cgen-scache.o \
diff --git a/sim/d10v/local.mk b/sim/d10v/local.mk
index 63ddb6ea0c58..25578dd537fb 100644
--- a/sim/d10v/local.mk
+++ b/sim/d10v/local.mk
@@ -16,6 +16,8 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -23,7 +25,6 @@
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/endian.o \
-	%D%/modules.o \
 	%D%/sim-resume.o \
 	%D%/simops.o \
 	%D%/table.o
diff --git a/sim/erc32/local.mk b/sim/erc32/local.mk
index a371fbc542b1..2a3f541b145c 100644
--- a/sim/erc32/local.mk
+++ b/sim/erc32/local.mk
@@ -25,6 +25,8 @@ AM_CPPFLAGS_%C% = $(READLINE_CFLAGS)
 ## behaviour of UART interrupt routines ...
 AM_CPPFLAGS_%C% += -DFAST_UART
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -33,8 +35,7 @@ AM_CPPFLAGS_%C% += -DFAST_UART
 	%D%/float.o \
 	%D%/func.o \
 	%D%/help.o \
-	%D%/interf.o \
-	%D%/modules.o
+	%D%/interf.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
 noinst_LIBRARIES += %D%/libsim.a
diff --git a/sim/example-synacor/local.mk b/sim/example-synacor/local.mk
index f9d43a89feb6..a0de3372dac8 100644
--- a/sim/example-synacor/local.mk
+++ b/sim/example-synacor/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/sim-main.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
diff --git a/sim/frv/local.mk b/sim/frv/local.mk
index 7d572fccb6ab..14db9b64272d 100644
--- a/sim/frv/local.mk
+++ b/sim/frv/local.mk
@@ -22,12 +22,13 @@ AM_CPPFLAGS_%C% = $(SIM_FRV_TRAPDUMP_FLAGS)
 AM_CFLAGS_%C%_memory.o = -Wno-error
 AM_CFLAGS_%C%_sem.o = -Wno-error
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-accfp.o \
 	%D%/cgen-fpu.o \
diff --git a/sim/ft32/local.mk b/sim/ft32/local.mk
index c793f87f4aaf..c582cebeec6f 100644
--- a/sim/ft32/local.mk
+++ b/sim/ft32/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/h8300/local.mk b/sim/h8300/local.mk
index 04affc9051bb..f1a17efeda1b 100644
--- a/sim/h8300/local.mk
+++ b/sim/h8300/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	%D%/compile.o \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/iq2000/local.mk b/sim/iq2000/local.mk
index 77804fe69abe..0d00c672e67f 100644
--- a/sim/iq2000/local.mk
+++ b/sim/iq2000/local.mk
@@ -16,12 +16,13 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-run.o \
 	%D%/cgen-scache.o \
diff --git a/sim/lm32/local.mk b/sim/lm32/local.mk
index 40f8d524c952..f4a4233e7be4 100644
--- a/sim/lm32/local.mk
+++ b/sim/lm32/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-run.o \
 	%D%/cgen-scache.o \
diff --git a/sim/m32c/local.mk b/sim/m32c/local.mk
index a6d22424929c..dc145302eb4b 100644
--- a/sim/m32c/local.mk
+++ b/sim/m32c/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = -DTIMER_A
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -27,7 +29,6 @@ AM_CPPFLAGS_%C% = -DTIMER_A
 	%D%/m32c.o \
 	%D%/mem.o \
 	%D%/misc.o \
-	%D%/modules.o \
 	%D%/r8c.o \
 	%D%/reg.o \
 	%D%/srcdest.o \
diff --git a/sim/m32r/local.mk b/sim/m32r/local.mk
index 24ef10ef2bcc..85190650e8e4 100644
--- a/sim/m32r/local.mk
+++ b/sim/m32r/local.mk
@@ -30,13 +30,14 @@ AM_CFLAGS_%C%_sem.o = -Wno-error
 AM_CFLAGS_%C%_sim_if.o = -Wno-error
 AM_CFLAGS_%C%_traps.o = -Wno-error
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-run.o \
 	%D%/cgen-scache.o \
diff --git a/sim/m68hc11/local.mk b/sim/m68hc11/local.mk
index e094918a3210..5f585dfd05ff 100644
--- a/sim/m68hc11/local.mk
+++ b/sim/m68hc11/local.mk
@@ -27,6 +27,8 @@ AM_CPPFLAGS_%C% = \
 	-DWITH_TARGET_ADDRESS_BITSIZE=32 \
 	-DWITH_TARGET_WORD_MSB=31
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -39,7 +41,6 @@ AM_CPPFLAGS_%C% = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/mcore/local.mk b/sim/mcore/local.mk
index 4c9cb50af911..bde13dbb6a44 100644
--- a/sim/mcore/local.mk
+++ b/sim/mcore/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	%D%/interp.o \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/microblaze/local.mk b/sim/microblaze/local.mk
index 4c9cb50af911..bde13dbb6a44 100644
--- a/sim/microblaze/local.mk
+++ b/sim/microblaze/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	%D%/interp.o \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/mips/local.mk b/sim/mips/local.mk
index 5f32eee573f0..88d4c900d5ff 100644
--- a/sim/mips/local.mk
+++ b/sim/mips/local.mk
@@ -53,6 +53,8 @@ if SIM_MIPS_GEN_MODE_MULTI
 	%D%/itable.o \
 	%D%/multi-run.o
 endif
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -64,7 +66,6 @@ endif
 	%D%/cp1.o \
 	%D%/dsp.o \
 	%D%/mdmx.o \
-	%D%/modules.o \
 	%D%/sim-main.o \
 	%D%/sim-resume.o
 ## Workaround Automake bug where $(SIM_MIPS_MULTI_OBJ) isn't copied from LIBADD
diff --git a/sim/mn10300/local.mk b/sim/mn10300/local.mk
index 1eae112642d4..f7c2d5537351 100644
--- a/sim/mn10300/local.mk
+++ b/sim/mn10300/local.mk
@@ -20,6 +20,8 @@ AM_CPPFLAGS_%C% = \
 	-DPOLL_QUIT_INTERVAL=0x20 \
 	-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -34,7 +36,6 @@ AM_CPPFLAGS_%C% = \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/op_utils.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
diff --git a/sim/moxie/local.mk b/sim/moxie/local.mk
index 0e07c8607879..4a8b9f740c85 100644
--- a/sim/moxie/local.mk
+++ b/sim/moxie/local.mk
@@ -18,13 +18,14 @@
 
 AM_CPPFLAGS_%C% = -DDTB="\"$(dtbdir)/moxie-gdb.dtb\""
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/msp430/local.mk b/sim/msp430/local.mk
index 27169c504075..b6ae9c0848b5 100644
--- a/sim/msp430/local.mk
+++ b/sim/msp430/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/msp430-sim.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/or1k/local.mk b/sim/or1k/local.mk
index a5989d51ddaf..23625580dbb9 100644
--- a/sim/or1k/local.mk
+++ b/sim/or1k/local.mk
@@ -17,12 +17,13 @@
 
 AM_CPPFLAGS_%C% = -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	\
 	%D%/cgen-accfp.o \
 	%D%/cgen-fpu.o \
diff --git a/sim/pru/local.mk b/sim/pru/local.mk
index 8ffc509c0144..0aead8e0ce61 100644
--- a/sim/pru/local.mk
+++ b/sim/pru/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/riscv/local.mk b/sim/riscv/local.mk
index 150639315fae..d1e84123b9b0 100644
--- a/sim/riscv/local.mk
+++ b/sim/riscv/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = -DWITH_TARGET_WORD_BITSIZE=$(SIM_RISCV_BITSIZE)
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -25,7 +27,6 @@ AM_CPPFLAGS_%C% = -DWITH_TARGET_WORD_BITSIZE=$(SIM_RISCV_BITSIZE)
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
 	%D%/interp.o \
 	%D%/machs.o \
-	%D%/modules.o \
 	%D%/sim-main.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
diff --git a/sim/rl78/local.mk b/sim/rl78/local.mk
index 0d39140ac6b8..bab9e4561ca4 100644
--- a/sim/rl78/local.mk
+++ b/sim/rl78/local.mk
@@ -16,6 +16,8 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -24,7 +26,6 @@
 	%D%/cpu.o \
 	%D%/rl78.o \
 	%D%/gdb-if.o \
-	%D%/modules.o \
 	%D%/trace.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/rx/local.mk b/sim/rx/local.mk
index 2a9387d27b79..63993b9d278c 100644
--- a/sim/rx/local.mk
+++ b/sim/rx/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = $(SIM_RX_CYCLE_ACCURATE_FLAGS)
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -30,8 +32,7 @@ AM_CPPFLAGS_%C% = $(SIM_RX_CYCLE_ACCURATE_FLAGS)
 	%D%/syscalls.o \
 	%D%/trace.o \
 	%D%/gdb-if.o \
-	%D%/err.o \
-	%D%/modules.o
+	%D%/err.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
 noinst_LIBRARIES += %D%/libsim.a
diff --git a/sim/sh/local.mk b/sim/sh/local.mk
index 4f6a4c5e6617..71fa8f2245e1 100644
--- a/sim/sh/local.mk
+++ b/sim/sh/local.mk
@@ -16,13 +16,14 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
 	%D%/interp.o \
 	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
 	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-	%D%/modules.o \
 	%D%/table.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
diff --git a/sim/v850/local.mk b/sim/v850/local.mk
index 973e83c42789..df0045765c26 100644
--- a/sim/v850/local.mk
+++ b/sim/v850/local.mk
@@ -18,6 +18,8 @@
 
 AM_CPPFLAGS_%C% = -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
 
+nodist_%C%_libsim_a_SOURCES = \
+	%D%/modules.c
 %C%_libsim_a_SOURCES = \
 	$(common_libcommon_a_SOURCES)
 %C%_libsim_a_LIBADD = \
@@ -32,7 +34,6 @@ AM_CPPFLAGS_%C% = -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
 	%D%/engine.o \
 	%D%/irun.o \
 	%D%/support.o \
-	%D%/modules.o \
 	%D%/sim-resume.o
 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
 
