public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] sim: hoist cgen mloop rules up to common builds
Date: Tue,  2 Nov 2021 23:37:40 -0400	[thread overview]
Message-ID: <20211103033740.6025-3-vapier@gentoo.org> (raw)
In-Reply-To: <20211103033740.6025-1-vapier@gentoo.org>

These rules don't depend on the target compiler settings, so hoist
the build logic up to the common builds for better parallelization.

We have to extend the genmloop.sh logic a bit to allow outputting
to a subdir since it always assumed cwd was the right place.

We leave the cgen maintainer rules in the subdirs for now as they
aren't normally run, and they rely on cgen logic that has not yet
been generalized.
---
 sim/Makefile.am        |  24 ++-
 sim/Makefile.in        | 379 ++++++++++++++++++++++++++++++++++++++---
 sim/bpf/Makefile.in    |  28 +--
 sim/bpf/local.mk       |  49 ++++++
 sim/common/genmloop.sh |  15 +-
 sim/cris/Makefile.in   |  32 +---
 sim/cris/local.mk      |  54 ++++++
 sim/frv/Makefile.in    |  12 --
 sim/frv/local.mk       |  38 +++++
 sim/iq2000/Makefile.in |  12 --
 sim/iq2000/local.mk    |  38 +++++
 sim/lm32/Makefile.in   |  12 --
 sim/lm32/local.mk      |  38 +++++
 sim/m32r/Makefile.in   |  56 ------
 sim/m32r/local.mk      |  66 +++++++
 sim/or1k/Makefile.in   |  16 +-
 sim/or1k/local.mk      |  37 ++++
 17 files changed, 707 insertions(+), 199 deletions(-)
 create mode 100644 sim/bpf/local.mk
 create mode 100644 sim/cris/local.mk
 create mode 100644 sim/frv/local.mk
 create mode 100644 sim/iq2000/local.mk
 create mode 100644 sim/lm32/local.mk
 create mode 100644 sim/m32r/local.mk
 create mode 100644 sim/or1k/local.mk

diff --git a/sim/Makefile.am b/sim/Makefile.am
index c04f94817e4f..fd4b76877434 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -18,6 +18,7 @@
 AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
 ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
 
+srccom = $(srcdir)/common
 srcroot = $(srcdir)/..
 
 SUBDIRS = @subdirs@ $(SIM_SUBDIRS)
@@ -55,7 +56,7 @@ SIM_ALL_RECURSIVE_DEPS =
 # An alternative is to slurp in the tables at runtime.
 .PHONY: nltvals
 nltvals:
-	$(srcdir)/common/gennltvals.py --cpp "$(CPP)"
+	$(srccom)/gennltvals.py --cpp "$(CPP)"
 
 pkginclude_HEADERS = \
 	$(srcroot)/include/sim/callback.h \
@@ -67,21 +68,42 @@ include igen/local.mk
 endif
 include testsuite/local.mk
 
+if SIM_ENABLE_ARCH_bpf
+include bpf/local.mk
+endif
 if SIM_ENABLE_ARCH_cr16
 include cr16/local.mk
 endif
+if SIM_ENABLE_ARCH_cris
+include cris/local.mk
+endif
 if SIM_ENABLE_ARCH_d10v
 include d10v/local.mk
 endif
+if SIM_ENABLE_ARCH_frv
+include frv/local.mk
+endif
+if SIM_ENABLE_ARCH_iq2000
+include iq2000/local.mk
+endif
+if SIM_ENABLE_ARCH_lm32
+include lm32/local.mk
+endif
 if SIM_ENABLE_ARCH_m32c
 include m32c/local.mk
 endif
+if SIM_ENABLE_ARCH_m32r
+include m32r/local.mk
+endif
 if SIM_ENABLE_ARCH_m68hc11
 include m68hc11/local.mk
 endif
 if SIM_ENABLE_ARCH_mn10300
 include mn10300/local.mk
 endif
+if SIM_ENABLE_ARCH_or1k
+include or1k/local.mk
+endif
 if SIM_ENABLE_ARCH_sh
 include sh/local.mk
 endif
diff --git a/sim/bpf/Makefile.in b/sim/bpf/Makefile.in
index 05a246e670ac..b12c18d6520b 100644
--- a/sim/bpf/Makefile.in
+++ b/sim/bpf/Makefile.in
@@ -161,33 +161,7 @@ $(srcdir)/sem-be.c $(srcdir)/decode-be.c $(srcdir)/decode-be.h: \
               $(CGEN_MAINT) stamp-decode-be
 	@true
 
-# Note the following files are generated in objdir, not srcdir.
-
-stamp-mloop: stamp-mloop-le stamp-mloop-be
-
-stamp-mloop-le: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop-le.c eng-le.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -scache -prefix bpfbf_ebpfle -cpu bpfbf \
-                -infile $(srcdir)/mloop.in -outfile-suffix -le
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng-le.hin eng-le.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop-le.cin mloop-le.c
-	$(SILENCE) touch $@
-mloop-le.c eng-le.h: stamp-mloop-le
-	@true
-
-stamp-mloop-be: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop-be.c eng-be.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -scache -prefix bpfbf_ebpfbe -cpu bpfbf \
-                -infile $(srcdir)/mloop.in -outfile-suffix -be
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng-be.hin eng-be.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop-be.cin mloop-be.c
-	$(SILENCE) touch $@
-mloop-be.c eng-be.h: stamp-mloop-be
-	@true
-
 .PHONY = bpf-clean
 
 bpf-clean:
-	rm -f stamp-arch stamp-cpu stamp-decode stamp-defs stamp-mloop
+	rm -f stamp-arch stamp-cpu stamp-decode stamp-defs
diff --git a/sim/bpf/local.mk b/sim/bpf/local.mk
new file mode 100644
index 000000000000..ebca133d392a
--- /dev/null
+++ b/sim/bpf/local.mk
@@ -0,0 +1,49 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 2020-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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng-le.h \
+	%D%/mloop-le.c \
+	%D%/stamp-mloop-le \
+	%D%/eng-be.h \
+	%D%/mloop-be.c \
+	%D%/stamp-mloop-be
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%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
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -scache -prefix bpfbf_ebpfle -cpu bpfbf \
+		-infile $(srcdir)/%D%/mloop.in \
+		-outfile-prefix %D%/ -outfile-suffix -le
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng-le.hin %D%/eng-le.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop-le.cin %D%/mloop-le.c
+	$(AM_V_at)touch $@
+
+%D%/mloop-be.c %D%/eng-be.h: %D%/stamp-mloop-be ; @true
+%D%/stamp-mloop-be: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -scache -prefix bpfbf_ebpfbe -cpu bpfbf \
+		-infile $(srcdir)/%D%/mloop.in \
+		-outfile-prefix %D%/ -outfile-suffix -be
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng-be.hin %D%/eng-be.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop-be.cin %D%/mloop-be.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index fa4e7b90a516..572dc8a9ed4b 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -140,6 +140,7 @@ switch=
 cpu="unknown"
 infile=""
 prefix="unknown"
+outprefix=""
 outsuffix=""
 
 while test $# -gt 0
@@ -154,6 +155,7 @@ do
 	-scache) scache=yes ;;
 	-pbb) pbb=yes ;;
 	-no-parallel) ;;
+	-outfile-prefix) shift ; outprefix=$1 ;;
 	-outfile-suffix) shift ; outsuffix=$1 ;;
 	-parallel-read) parallel=read ;;
 	-parallel-write) parallel=write ;;
@@ -197,8 +199,8 @@ PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`
 
 ##########################################################################
 
-rm -f eng${outsuffix}.hin
-exec 1>eng${outsuffix}.hin
+rm -f ${outprefix}eng${outsuffix}.hin
+exec 1>${outprefix}eng${outsuffix}.hin
 
 echo "/* engine configuration for ${cpu} */"
 echo ""
@@ -291,8 +293,8 @@ fi
 
 ##########################################################################
 
-rm -f tmp-mloop-$$.cin mloop${outsuffix}.cin
-exec 1>tmp-mloop-$$.cin
+rm -f ${outprefix}tmp-mloop-$$.cin ${outprefix}mloop${outsuffix}.cin
+exec 1>${outprefix}tmp-mloop-$$.cin
 
 # We use @cpu@ instead of ${cpu} because we still need to run sed to handle
 # transformation of @cpu@ for mainloop.in, so there's no need to use ${cpu}
@@ -1334,8 +1336,9 @@ fi # -pbb
 # Expand @..@ macros appearing in tmp-mloop-{pid}.cin.
 sed \
   -e "s/@cpu@/$cpu/g" -e "s/@CPU@/$CPU/g" \
-  -e "s/@prefix@/$prefix/g" -e "s/@PREFIX@/$PREFIX/g" < tmp-mloop-$$.cin > mloop${outsuffix}.cin
+  -e "s/@prefix@/$prefix/g" -e "s/@PREFIX@/$PREFIX/g" \
+  < ${outprefix}tmp-mloop-$$.cin > ${outprefix}mloop${outsuffix}.cin
 rc=$?
-rm -f tmp-mloop-$$.cin
+rm -f ${outprefix}tmp-mloop-$$.cin
 
 exit $rc
diff --git a/sim/cris/Makefile.in b/sim/cris/Makefile.in
index 18dd2f451b55..8e6bb2ec79bd 100644
--- a/sim/cris/Makefile.in
+++ b/sim/cris/Makefile.in
@@ -66,48 +66,18 @@ CRISV10F_INCLUDE_DEPS = \
 	$(CGEN_MAIN_CPU_DEPS) \
 	cpuv10.h decodev10.h engv10.h
 
-# FIXME: What is mono and what does "Use of `mono' is wip" mean (other
-# than the apparent; some "mono" feature is work in progress)?
-mloopv10f.c engv10.h: stamp-v10fmloop
-stamp-v10fmloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloopv10f.c engv10.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -no-fast -pbb -switch semcrisv10f-switch.c \
-		-cpu crisv10f -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin engv10.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloopv10f.c
-	$(SILENCE) touch $@
-
 # CRISV32 objs
 
 CRISV32F_INCLUDE_DEPS = \
 	$(CGEN_MAIN_CPU_DEPS) \
 	cpuv32.h decodev32.h engv32.h
 
-# FIXME: What is mono and what does "Use of `mono' is wip" mean (other
-# than the apparent; some "mono" feature is work in progress)?
-mloopv32f.c engv32.h: stamp-v32fmloop
-# We depend on stamp-v10fmloop to get serialization to avoid
-# racing with it for the same temporary file-names when "make -j".
-stamp-v32fmloop: stamp-v10fmloop $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloopv32f.c engv32.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -no-fast -pbb -switch semcrisv32f-switch.c \
-		-cpu crisv32f -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin engv32.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloopv32f.c
-	$(SILENCE) touch $@
-
 cris-clean:
-	for v in 10 32; do \
-	  rm -f mloopv$${v}f.c engv$${v}.h stamp-v$${v}fmloop; \
-	  rm -f stamp-v$${v}fcpu; \
-	done
 	-rm -f stamp-arch
 	-rm -f tmp-*
 
 # Useful when making CGEN-generated files manually, without --enable-cgen-maint.
-stamps: stamp-v10fmloop stamp-v32fmloop stamp-arch stamp-v10fcpu stamp-v32fcpu
+stamps: stamp-arch stamp-v10fcpu stamp-v32fcpu
 
 stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(CPU_DIR)/cris.cpu Makefile
 	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=crisv10,crisv32 \
diff --git a/sim/cris/local.mk b/sim/cris/local.mk
new file mode 100644
index 000000000000..c810bcdc4446
--- /dev/null
+++ b/sim/cris/local.mk
@@ -0,0 +1,54 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 2004-2021 Free Software Foundation, Inc.
+# Contributed by Axis Communications.
+#
+# 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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/engv10.h \
+	%D%/mloopv10f.c \
+	%D%/stamp-mloop-v10f \
+	%D%/engv32.h \
+	%D%/mloopv32f.c \
+	%D%/stamp-mloop-v32f
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%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)?
+%D%/mloopv10f.c %D%/engv10.h: %D%/stamp-mloop-v10f ; @true
+%D%/stamp-mloop-v10f: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -no-fast -pbb -switch semcrisv10f-switch.c \
+		-cpu crisv10f \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/ -outfile-suffix -v10f
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng-v10f.hin %D%/engv10.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop-v10f.cin %D%/mloopv10f.c
+	$(AM_V_at)touch $@
+
+# FIXME: What is mono and what does "Use of `mono' is wip" mean (other
+# than the apparent; some "mono" feature is work in progress)?
+%D%/mloopv32f.c %D%/engv32.h: %D%/stamp-mloop-v32f ; @true
+%D%/stamp-mloop-v32f: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -no-fast -pbb -switch semcrisv32f-switch.c \
+		-cpu crisv32f \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/ -outfile-suffix -v32f
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng-v32f.hin %D%/engv32.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop-v32f.cin %D%/mloopv32f.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/frv/Makefile.in b/sim/frv/Makefile.in
index 2c17075432c6..1159f638c329 100644
--- a/sim/frv/Makefile.in
+++ b/sim/frv/Makefile.in
@@ -54,19 +54,7 @@ FRVBF_INCLUDE_DEPS = \
 	$(SIM_EXTRA_DEPS) \
 	cpu.h decode.h eng.h
 
-# FIXME: Use of `mono' is wip.
-mloop.c eng.h: stamp-mloop
-stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop.c eng.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -scache -parallel-generic-write -parallel-only \
-		-cpu frvbf -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin eng.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
-	$(SILENCE) touch $@
-
 frv-clean:
-	rm -f mloop.c eng.h stamp-mloop
 	rm -f tmp-*
 	rm -f stamp-arch stamp-cpu
 
diff --git a/sim/frv/local.mk b/sim/frv/local.mk
new file mode 100644
index 000000000000..378120c613c5
--- /dev/null
+++ b/sim/frv/local.mk
@@ -0,0 +1,38 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 1998-2021 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# 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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng.h \
+	%D%/mloop.c \
+	%D%/stamp-mloop
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -scache -parallel-generic-write -parallel-only \
+		-cpu frvbf \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng.hin %D%/eng.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop.cin %D%/mloop.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/iq2000/Makefile.in b/sim/iq2000/Makefile.in
index b47d15ac4772..c98fb78e7ff5 100644
--- a/sim/iq2000/Makefile.in
+++ b/sim/iq2000/Makefile.in
@@ -54,19 +54,7 @@ IQ2000BF_INCLUDE_DEPS = \
 	$(CGEN_MAIN_CPU_DEPS) \
 	cpu.h decode.h eng.h
 
-# FIXME: Use of `mono' is wip.
-mloop.c eng.h: stamp-mloop
-stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop.c eng.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -fast -pbb -switch sem-switch.c \
-		-cpu iq2000bf -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin eng.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
-	$(SILENCE) touch $@
-
 iq2000-clean:
-	rm -f mloop.c eng.h stamp-mloop
 	rm -f tmp-*
 	rm -f stamp-arch stamp-cpu
 
diff --git a/sim/iq2000/local.mk b/sim/iq2000/local.mk
new file mode 100644
index 000000000000..00b2af15c23e
--- /dev/null
+++ b/sim/iq2000/local.mk
@@ -0,0 +1,38 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 1998-2021 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# 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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng.h \
+	%D%/mloop.c \
+	%D%/stamp-mloop
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -fast -pbb -switch sem-switch.c \
+		-cpu iq2000bf \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng.hin %D%/eng.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop.cin %D%/mloop.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/lm32/Makefile.in b/sim/lm32/Makefile.in
index 642c483acd26..d827b711d45e 100644
--- a/sim/lm32/Makefile.in
+++ b/sim/lm32/Makefile.in
@@ -35,19 +35,7 @@ LM32BF_INCLUDE_DEPS = \
 	$(CGEN_MAIN_CPU_DEPS) \
 	cpu.h decode.h eng.h
 
-# FIXME: Use of `mono' is wip.
-mloop.c eng.h: stamp-mloop
-stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop.c eng.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -fast -pbb -switch sem-switch.c \
-		-cpu lm32bf -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin eng.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
-	$(SILENCE) touch $@
-
 lm32-clean:
-	rm -f mloop.c eng.h stamp-mloop
 	rm -f stamp-arch stamp-cpu 
 	rm -f tmp-*
 
diff --git a/sim/lm32/local.mk b/sim/lm32/local.mk
new file mode 100644
index 000000000000..2d7ebc208970
--- /dev/null
+++ b/sim/lm32/local.mk
@@ -0,0 +1,38 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 2009-2021 Free Software Foundation, Inc.
+# Contributed by Jon Beniston <jon@beniston.com>
+#
+# 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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng.h \
+	%D%/mloop.c \
+	%D%/stamp-mloop
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -fast -pbb -switch sem-switch.c \
+		-cpu lm32bf \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng.hin %D%/eng.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop.cin %D%/mloop.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in
index d9d8acfc30fd..df4f5bf0209f 100644
--- a/sim/m32r/Makefile.in
+++ b/sim/m32r/Makefile.in
@@ -50,63 +50,7 @@ cpu.o cpu2.o cpux.o m32r.o m32r2.o m32rx.o mloop.o mloop2.o mloopx.o sem.o sim-i
 
 arch = m32r
 
-# M32R objs
-
-M32RBF_INCLUDE_DEPS = \
-	$(CGEN_MAIN_CPU_DEPS) \
-	cpu.h decode.h eng.h
-
-# FIXME: Use of `mono' is wip.
-mloop.c eng.h: stamp-mloop ; @true
-stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop.c eng.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -fast -pbb -switch sem-switch.c \
-		-cpu m32rbf -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin eng.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
-	$(SILENCE) touch $@
-
-# M32RX objs
-
-M32RXF_INCLUDE_DEPS = \
-	$(CGEN_MAIN_CPU_DEPS) \
-	cpux.h decodex.h engx.h
-
-# FIXME: Use of `mono' is wip.
-mloopx.c engx.h: stamp-xmloop ; @true
-stamp-xmloop: $(srcdir)/../common/genmloop.sh mloopx.in Makefile
-	$(ECHO_STAMP) mloopx.c engx.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -no-fast -pbb -parallel-write -switch semx-switch.c \
-		-cpu m32rxf -infile $(srcdir)/mloopx.in \
-		-outfile-suffix x
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change engx.hin engx.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloopx.cin mloopx.c
-	$(SILENCE) touch $@
-
-# M32R2 objs
-
-M32R2F_INCLUDE_DEPS = \
-	$(CGEN_MAIN_CPU_DEPS) \
-	cpu2.h decode2.h eng2.h
-
-# FIXME: Use of `mono' is wip.
-mloop2.c eng2.h: stamp-2mloop ; @true
-stamp-2mloop: $(srcdir)/../common/genmloop.sh mloop2.in Makefile
-	$(ECHO_STAMP) mloop2.c eng2.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -no-fast -pbb -parallel-write -switch sem2-switch.c \
-		-cpu m32r2f -infile $(srcdir)/mloop2.in \
-		-outfile-suffix 2
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng2.hin eng2.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop2.cin mloop2.c
-	$(SILENCE) touch $@
-
 m32r-clean:
-	rm -f mloop.c eng.h stamp-mloop
-	rm -f mloopx.c engx.h stamp-xmloop
-	rm -f mloop2.c eng2.h stamp-2mloop
 	rm -f stamp-arch stamp-cpu stamp-xcpu stamp-2cpu
 	rm -f tmp-*
 
diff --git a/sim/m32r/local.mk b/sim/m32r/local.mk
new file mode 100644
index 000000000000..ab4abb79bb6d
--- /dev/null
+++ b/sim/m32r/local.mk
@@ -0,0 +1,66 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 1996-2021 Free Software Foundation, Inc.
+# Contributed by Cygnus Support.
+#
+# 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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng.h \
+	%D%/mloop.c \
+	%D%/stamp-mloop \
+	%D%/engx.h \
+	%D%/mloopx.c \
+	%D%/stamp-mloop-x \
+	%D%/eng2.h \
+	%D%/mloop2.c \
+	%D%/stamp-mloop-2
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -fast -pbb -switch sem-switch.c \
+		-cpu m32rbf \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng.hin %D%/eng.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop.cin %D%/mloop.c
+	$(AM_V_at)touch $@
+
+# FIXME: Use of `mono' is wip.
+%D%/mloopx.c %D%/engx.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop-x: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -no-fast -pbb -parallel-write -switch semx-switch.c \
+		-cpu m32rxf \
+		-infile $(srcdir)/%D%/mloopx.in -outfile-prefix %D%/ -outfile-suffix x
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/engx.hin %D%/engx.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloopx.cin %D%/mloopx.c
+	$(AM_V_at)touch $@
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop2.c %D%/eng2.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop-2: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -no-fast -pbb -parallel-write -switch sem2-switch.c \
+		-cpu m32r2f \
+		-infile $(srcdir)/%D%/mloop2.in -outfile-prefix %D%/ -outfile-suffix 2
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng2.hin %D%/eng2.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop2.cin %D%/mloop2.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
diff --git a/sim/or1k/Makefile.in b/sim/or1k/Makefile.in
index c6bd03b756cd..3f1c432c3720 100644
--- a/sim/or1k/Makefile.in
+++ b/sim/or1k/Makefile.in
@@ -53,8 +53,6 @@ SIM_EXTRA_CFLAGS =
 
 SIM_EXTRA_LIBS = -lm
 
-SIM_EXTRA_CLEAN = or1k-clean
-
 ## COMMON_POST_CONFIG_FRAG
 
 arch = or1k
@@ -67,15 +65,6 @@ OR1K32BF_INCLUDE_DEPS = \
 	decode.h \
 	eng.h
 
-mloop.c eng.h: stamp-mloop ; @true
-stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
-	$(ECHO_STAMP) mloop.c eng.h
-	$(SILENCE) $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
-		-mono -fast -pbb -switch sem-switch.c \
-		-cpu or1k32bf -infile $(srcdir)/mloop.in
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change eng.hin eng.h
-	$(SILENCE) $(SHELL) $(srcroot)/move-if-change mloop.cin mloop.c
-	$(SILENCE) touch $@
 or1k.o: or1k.c $(OR1K32BF_INCLUDE_DEPS)
 	$(COMPILE) $<
 	$(POSTCOMPILE)
@@ -88,10 +77,7 @@ traps.o: traps.c $(SIM_MAIN_DEPS) eng.h
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-or1k-clean:
-	rm -f mloop.c eng.h stamp-mloop
-
-stamps: stamp-arch stamp-cpu stamp-mloop
+stamps: stamp-arch stamp-cpu
 
 # NOTE: Generated source files are specified as full paths,
 # e.g. $(srcdir)/arch.c, because make may decide the files live
diff --git a/sim/or1k/local.mk b/sim/or1k/local.mk
new file mode 100644
index 000000000000..ab1f07df0ea1
--- /dev/null
+++ b/sim/or1k/local.mk
@@ -0,0 +1,37 @@
+# See sim/Makefile.am
+#
+# Copyright (C) 2017-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/>.
+
+%C%_BUILD_OUTPUTS = \
+	%D%/eng.h \
+	%D%/mloop.c \
+	%D%/stamp-mloop
+
+# This makes sure build tools are available before building the arch-subdirs.
+SIM_ALL_RECURSIVE_DEPS += $(%C%_BUILD_OUTPUTS)
+
+# FIXME: Use of `mono' is wip.
+%D%/mloop.c %D%/eng.h: %D%/stamp-mloop ; @true
+%D%/stamp-mloop: $(srccom)/genmloop.sh %D%/mloop.in
+	$(AM_V_GEN)$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
+		-mono -fast -pbb -switch sem-switch.c \
+		-cpu or1k32bf \
+		-infile $(srcdir)/%D%/mloop.in -outfile-prefix %D%/
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/eng.hin %D%/eng.h
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change %D%/mloop.cin %D%/mloop.c
+	$(AM_V_at)touch $@
+
+MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
-- 
2.33.0


      parent reply	other threads:[~2021-11-03  3:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  3:37 [PATCH 1/3] sim: hoist gencode & opc2c build " Mike Frysinger
2021-11-03  3:37 ` [PATCH 2/3] sim: hoist mn10300 & v850 igen " Mike Frysinger
2021-11-03  3:37 ` 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=20211103033740.6025-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).