* [PATCH 2/3] sim: igen: merge build into top level
2021-03-08 3:33 [PATCH 1/3] sim: unify toolchain settings Mike Frysinger
@ 2021-03-08 3:33 ` Mike Frysinger
2021-03-08 3:33 ` [PATCH 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-08 3:33 UTC (permalink / raw)
To: gdb-patches
This simplifies the build a bit (especially for deps in port subdirs),
and avoids recursive make.
---
sim/ChangeLog | 7 +
sim/Makefile.am | 3 +
sim/Makefile.in | 307 ++-
sim/configure | 21 +-
sim/configure.ac | 4 +-
sim/igen/ChangeLog | 5 +
sim/igen/Makefile.in | 173 --
sim/igen/configure | 5241 ---------------------------------------
sim/igen/configure.ac | 9 -
sim/igen/local.mk | 82 +
sim/mips/ChangeLog | 5 +
sim/mips/Makefile.in | 7 -
sim/mn10300/ChangeLog | 5 +
sim/mn10300/Makefile.in | 4 -
sim/v850/ChangeLog | 5 +
sim/v850/Makefile.in | 4 -
16 files changed, 417 insertions(+), 5465 deletions(-)
delete mode 100644 sim/igen/Makefile.in
delete mode 100755 sim/igen/configure
delete mode 100644 sim/igen/configure.ac
create mode 100644 sim/igen/local.mk
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 0b164f33183c..6d75ef776e62 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.am [SIM_ENABLE_IGEN]: Include igen/local.mk.
+ * configure.ac: Delete AC_CONFIG_SUBDIRS(igen) call.
+ (SIM_ENABLE_IGEN): Define.
+ * configure, Makefile.in: Regenerate.
+
2021-03-07 Mike Frysinger <vapier@gentoo.org>
* Makefile.am (ACLOCAL_AMFLAGS): Add -Im4.
diff --git a/sim/Makefile.am b/sim/Makefile.am
index 7efa5220ad46..0c76681c5e6a 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -35,4 +35,7 @@ nltvals:
$(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot)
$(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def
+if SIM_ENABLE_IGEN
+include igen/local.mk
+endif
include testsuite/local.mk
diff --git a/sim/configure.ac b/sim/configure.ac
index bbb5c32722dc..0a7b6884fabf 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -122,10 +122,8 @@ if test "${enable_sim}" != no; then
sim_igen=yes
;;
esac
- if test "$sim_igen" = yes; then
- AC_CONFIG_SUBDIRS(igen)
- fi
fi
+AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index 308076194ec7..e75b4db1e007 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * local.mk: New file.
+ * Makefile.in, configure.ac, configure: Removed.
+
2021-03-07 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Call SIM_AC_TOOLCHAIN and AC_CONFIG_FILES.
diff --git a/sim/igen/configure.ac b/sim/igen/configure.ac
deleted file mode 100644
index ff11814072ed..000000000000
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(table.h)
-AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-
-SIM_AC_TOOLCHAIN
-SIM_AC_OPTION_WARNINGS
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/sim/igen/local.mk b/sim/igen/local.mk
new file mode 100644
index 000000000000..44f4f58285da
--- /dev/null
+++ b/sim/igen/local.mk
@@ -0,0 +1,82 @@
+# The IGEN simulator generator for GDB, the GNU Debugger.
+#
+# Copyright 2002-2021 Free Software Foundation, Inc.
+#
+# Contributed by Andrew Cagney.
+#
+# This file is part of GDB.
+#
+# 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/>.
+
+# This makes sure igen is available before building the arch-subdirs which
+# need to run the igen tool.
+all-recursive: igen/igen$(EXEEXT)
+
+# Alias for developers.
+igen: %D%/igen$(EXEEXT)
+
+noinst_LIBRARIES = %D%/libigen.a
+%C%_libigen_a_SOURCES = \
+ %D%/table.c \
+ %D%/lf.c \
+ %D%/misc.c \
+ %D%/filter_host.c \
+ %D%/ld-decode.c \
+ %D%/ld-cache.c \
+ %D%/filter.c \
+ %D%/ld-insn.c \
+ %D%/gen-model.c \
+ %D%/gen-itable.c \
+ %D%/gen-icache.c \
+ %D%/gen-semantics.c \
+ %D%/gen-idecode.c \
+ %D%/gen-support.c \
+ %D%/gen-engine.c \
+ %D%/gen.c
+
+EXTRA_PROGRAMS = %D%/igen
+%C%_igen_SOURCES = %D%/igen.c
+%C%_igen_LDADD = %D%/libigen.a
+
+# igen is a build-time only tool. Override the default rules for it.
+%D%/%.o: %D%/%.c
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@
+
+# Build some of the files in standalone mode for developers of igen itself.
+%D%/%-main.o: %D%/%.c
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DMAIN -c $< -o $@
+
+EXTRA_PROGRAMS += %D%/filter
+%C%_filter_SOURCES =
+%C%_filter_LDADD = %D%/filter-main.o %D%/libigen.a
+
+EXTRA_PROGRAMS += %D%/gen
+%C%_gen_SOURCES =
+%C%_gen_LDADD = %D%/gen-main.o %D%/libigen.a
+
+EXTRA_PROGRAMS += %D%/ld-cache
+%C%_ld_cache_SOURCES =
+%C%_ld_cache_LDADD = %D%/ld-cache-main.o %D%/libigen.a
+
+EXTRA_PROGRAMS += %D%/ld-decode
+%C%_ld_decode_SOURCES =
+%C%_ld_decode_LDADD = %D%/ld-decode-main.o %D%/libigen.a
+
+EXTRA_PROGRAMS += %D%/ld-insn
+%C%_ld_insn_SOURCES =
+%C%_ld_insn_LDADD = %D%/ld-insn-main.o %D%/libigen.a
+
+EXTRA_PROGRAMS += %D%/table
+%C%_table_SOURCES =
+%C%_table_LDADD = %D%/table-main.o %D%/libigen.a
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 12347a7e3e23..ba73810dc433 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen, tmp-m16, tmp-micromips): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index c9de7a4b1c21..cca76a7f87e2 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 495a7e28975c..f1eb8d62c9e3 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] sim: add preliminary support for --enable-targets
2021-03-08 3:33 [PATCH 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-08 3:33 ` [PATCH 2/3] sim: igen: merge build into top level Mike Frysinger
@ 2021-03-08 3:33 ` Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-08 3:33 UTC (permalink / raw)
To: gdb-patches
This doesn't actually create one `run` program like other projects,
but creates multiple `run-$arch` targets. While it might not seem
that useful initially, this has some nice properties:
- Allows us to quickly build all sim targets in a single tree.
- Positions us better for converting targets over to a proper
multitarget build+install.
We don't have the ability to actually run tests against them, but
that's due to a limitation in gas: it doesn't support multitarget.
If that ever changes, we should be able to turn on our tests too.
---
sim/configure | 232 ++++++++++++++++++++++++++++++++++++++++-------
sim/configure.ac | 150 +++++++++++-------------------
2 files changed, 252 insertions(+), 130 deletions(-)
diff --git a/sim/configure.ac b/sim/configure.ac
index 0a7b6884fabf..7727eb61988a 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -18,110 +18,64 @@ yes | no) ;;
*) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
esac])
+AC_ARG_ENABLE(targets,
+[ --enable-targets alternative target configurations],
+[case "${enableval}" in
+ yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac])
+
+m4_define([SIM_TARGET], [
+ case "${targ}" in
+ all|$1)
+ AC_CONFIG_SUBDIRS($2)
+ $3
+ ;;
+ esac
+])
+
dnl WHEN ADDING ENTRIES TO THIS MATRIX:
dnl Make sure that the left side always has two dashes. Otherwise you can get
dnl spurious matches. Even for unambiguous cases, do this as a convention, else
dnl the table becomes a real mess to understand and maintain.
if test "${enable_sim}" != no; then
sim_igen=no
- case "${target}" in
- aarch64*-*-*)
- AC_CONFIG_SUBDIRS(aarch64)
- ;;
- arm*-*-*)
- AC_CONFIG_SUBDIRS(arm)
- ;;
- avr*-*-*)
- AC_CONFIG_SUBDIRS(avr)
- ;;
- bfin-*-*)
- AC_CONFIG_SUBDIRS(bfin)
- ;;
- bpf-*-*)
- AC_CONFIG_SUBDIRS(bpf)
- ;;
- cr16*-*-*)
- AC_CONFIG_SUBDIRS(cr16)
- ;;
- cris-*-* | crisv32-*-*)
- AC_CONFIG_SUBDIRS(cris)
- ;;
- d10v-*-*)
- AC_CONFIG_SUBDIRS(d10v)
- ;;
- frv-*-*)
- AC_CONFIG_SUBDIRS(frv)
- ;;
- h8300*-*-*)
- AC_CONFIG_SUBDIRS(h8300)
- ;;
- iq2000-*-*)
- AC_CONFIG_SUBDIRS(iq2000)
- ;;
- lm32-*-*)
- AC_CONFIG_SUBDIRS(lm32)
- ;;
- m32c-*-*)
- AC_CONFIG_SUBDIRS(m32c)
- ;;
- m32r-*-*)
- AC_CONFIG_SUBDIRS(m32r)
- ;;
- m68hc11-*-*|m6811-*-*)
- AC_CONFIG_SUBDIRS(m68hc11)
- ;;
- mcore-*-*)
- AC_CONFIG_SUBDIRS(mcore)
- ;;
- microblaze-*-*)
- AC_CONFIG_SUBDIRS(microblaze)
- ;;
- mips*-*-*)
- AC_CONFIG_SUBDIRS(mips)
- sim_igen=yes
- ;;
- mn10300*-*-*)
- AC_CONFIG_SUBDIRS(mn10300)
- sim_igen=yes
- ;;
- moxie-*-*)
- AC_CONFIG_SUBDIRS(moxie)
- ;;
- msp430*-*-*)
- AC_CONFIG_SUBDIRS(msp430)
- ;;
- or1k-*-* | or1knd-*-*)
- AC_CONFIG_SUBDIRS(or1k)
- ;;
- pru*-*-*)
- AC_CONFIG_SUBDIRS(pru)
- ;;
- riscv*-*-*)
- AC_CONFIG_SUBDIRS(riscv)
- ;;
- rl78-*-*)
- AC_CONFIG_SUBDIRS(rl78)
- ;;
- rx-*-*)
- AC_CONFIG_SUBDIRS(rx)
- ;;
- sh*-*-*)
- AC_CONFIG_SUBDIRS(sh)
- ;;
- sparc-*-rtems*|sparc-*-elf*)
- AC_CONFIG_SUBDIRS(erc32)
- ;;
- powerpc*-*-*)
- AC_CONFIG_SUBDIRS(ppc)
- ;;
- ft32-*-*)
- AC_CONFIG_SUBDIRS(ft32)
- ;;
- v850*-*-*)
- AC_CONFIG_SUBDIRS(v850)
- sim_igen=yes
- ;;
- esac
+ for targ in `echo $target $enable_targets | sed 's/,/ /g'`
+ do
+ SIM_TARGET([aarch64*-*-*], [aarch64])
+ SIM_TARGET([arm*-*-*], [arm])
+ SIM_TARGET([avr*-*-*], [avr])
+ SIM_TARGET([bfin-*-*], [bfin])
+ SIM_TARGET([bpf-*-*], [bpf])
+ SIM_TARGET([cr16*-*-*], [cr16])
+ SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
+ SIM_TARGET([d10v-*-*], [d10v])
+ SIM_TARGET([frv-*-*], [frv])
+ SIM_TARGET([h8300*-*-*], [h8300])
+ SIM_TARGET([iq2000-*-*], [iq2000])
+ SIM_TARGET([lm32-*-*], [lm32])
+ SIM_TARGET([m32c-*-*], [m32c])
+ SIM_TARGET([m32r-*-*], [m32r])
+ SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
+ SIM_TARGET([mcore-*-*], [mcore])
+ SIM_TARGET([microblaze-*-*], [microblaze])
+ SIM_TARGET([mips*-*-*], [mips], [sim_igen=yes])
+ SIM_TARGET([mn10300*-*-*], [mn10300], [sim_igen=yes])
+ SIM_TARGET([moxie-*-*], [moxie])
+ SIM_TARGET([msp430*-*-*], [msp430])
+ SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k])
+ SIM_TARGET([pru*-*-*], [pru])
+ SIM_TARGET([riscv*-*-*], [riscv])
+ SIM_TARGET([rl78-*-*], [rl78])
+ SIM_TARGET([rx-*-*], [rx])
+ SIM_TARGET([sh*-*-*], [sh])
+ SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32])
+ SIM_TARGET([powerpc*-*-*], [ppc])
+ SIM_TARGET([ft32-*-*], [ft32])
+ SIM_TARGET([v850*-*-*], [v850], [sim_igen=yes])
+ done
fi
AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] sim: unify toolchain settings
2021-03-08 3:33 [PATCH 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-08 3:33 ` [PATCH 2/3] sim: igen: merge build into top level Mike Frysinger
2021-03-08 3:33 ` [PATCH 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
@ 2021-03-13 17:24 ` Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 2/3] sim: igen: merge build into top level Mike Frysinger
` (2 more replies)
2 siblings, 3 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-13 17:24 UTC (permalink / raw)
To: gdb-patches
The toplevel, common, and igen dirs all have their own code for
setting up toolchain settings. Unify all of that in a new macro.
*/
* aclocal.m4, configure: Regenerate.
---
sim/ChangeLog | 10 +
sim/Makefile.am | 5 +-
sim/Makefile.in | 12 +-
sim/aarch64/aclocal.m4 | 1 +
sim/aarch64/configure | 310 +--
sim/aclocal.m4 | 1 +
sim/arm/aclocal.m4 | 1 +
sim/arm/configure | 310 +--
sim/avr/aclocal.m4 | 1 +
sim/avr/configure | 310 +--
sim/bfin/aclocal.m4 | 1 +
sim/bfin/configure | 310 +--
sim/bpf/aclocal.m4 | 1 +
sim/bpf/configure | 310 +--
sim/common/ChangeLog | 5 +
sim/common/Make-common.in | 3 +-
sim/configure | 3911 ++++++++++++++++++------------------
sim/configure.ac | 27 +-
sim/cr16/aclocal.m4 | 1 +
sim/cr16/configure | 310 +--
sim/cris/aclocal.m4 | 1 +
sim/cris/configure | 310 +--
sim/d10v/aclocal.m4 | 1 +
sim/d10v/configure | 310 +--
sim/erc32/aclocal.m4 | 1 +
sim/erc32/configure | 310 +--
sim/frv/aclocal.m4 | 1 +
sim/frv/configure | 310 +--
sim/ft32/aclocal.m4 | 1 +
sim/ft32/configure | 310 +--
sim/h8300/aclocal.m4 | 1 +
sim/h8300/configure | 310 +--
sim/igen/ChangeLog | 8 +
sim/igen/aclocal.m4 | 16 +
sim/igen/configure | 1701 +++++++++++++---
sim/igen/configure.ac | 24 +-
sim/iq2000/aclocal.m4 | 1 +
sim/iq2000/configure | 310 +--
sim/lm32/aclocal.m4 | 1 +
sim/lm32/configure | 310 +--
sim/m32c/aclocal.m4 | 1 +
sim/m32c/configure | 310 +--
sim/m32r/aclocal.m4 | 1 +
sim/m32r/configure | 310 +--
sim/m4/sim_ac_common.m4 | 51 +-
sim/m4/sim_ac_toolchain.m4 | 70 +
sim/m68hc11/aclocal.m4 | 1 +
sim/m68hc11/configure | 310 +--
sim/mcore/aclocal.m4 | 1 +
sim/mcore/configure | 310 +--
sim/microblaze/aclocal.m4 | 1 +
sim/microblaze/configure | 310 +--
sim/mips/aclocal.m4 | 1 +
sim/mips/configure | 310 +--
sim/mn10300/aclocal.m4 | 1 +
sim/mn10300/configure | 310 +--
sim/moxie/aclocal.m4 | 1 +
sim/moxie/configure | 310 +--
sim/msp430/aclocal.m4 | 1 +
sim/msp430/configure | 310 +--
sim/or1k/aclocal.m4 | 1 +
sim/or1k/configure | 310 +--
sim/pru/aclocal.m4 | 1 +
sim/pru/configure | 310 +--
sim/riscv/aclocal.m4 | 1 +
sim/riscv/configure | 310 +--
sim/rl78/aclocal.m4 | 1 +
sim/rl78/configure | 310 +--
sim/rx/aclocal.m4 | 1 +
sim/rx/configure | 310 +--
sim/sh/aclocal.m4 | 1 +
sim/sh/configure | 310 +--
sim/v850/aclocal.m4 | 1 +
sim/v850/configure | 310 +--
74 files changed, 8257 insertions(+), 6917 deletions(-)
create mode 100644 sim/igen/aclocal.m4
create mode 100644 sim/m4/sim_ac_toolchain.m4
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 7e99a06f51cc..eb3bce7a292e 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,13 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.am (ACLOCAL_AMFLAGS): Add -Im4.
+ (COMPILE_FOR_BUILD, LINK_FOR_BUILD): Define.
+ * configure.ac: Replace toolchain calls with SIM_AC_TOOLCHAIN.
+ * m4/sim_ac_common.m4 (SIM_AC_COMMON): Replace toolchain calls
+ with SIM_AC_TOOLCHAIN.
+ * m4/sim_ac_toolchain.m4: New file.
+ * aclocal.m4, configure, Makefile.in: Regenerate.
+
2021-03-08 Tom Tromey <tromey@adacore.com>
* aclocal.m4, configure, Makefile.in: Rebuild.
diff --git a/sim/Makefile.am b/sim/Makefile.am
index c6e2d04f33ae..f9084d360ed3 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
-ACLOCAL_AMFLAGS = -I.. -I../config
+ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
srcroot = $(srcdir)/..
@@ -24,6 +24,9 @@ SUBDIRS = @subdirs@
MOSTLYCLEANFILES = core
+COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
+LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
+
# Generate nltvals.def for newlib/libgloss using devo and build tree.
# This file is shipped with distributions so we build in the source dir.
# Use `make nltvals' to rebuild.
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 1676df734566..3baa3709186c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Make-common.in (CFLAGS_FOR_BUILD): Define.
+ (BUILD_CFLAGS): Replace -g -O with $(CFLAGS_FOR_BUILD).
+
2021-03-13 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (LINK_FOR_BUILD): Change BUILD_LDFLAGS to
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index f4a7e8da11de..a6875fe8f964 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -72,6 +72,7 @@ INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
C_DIALECT = @C_DIALECT@
CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@
@@ -230,7 +231,7 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \
-I../../opcodes -I$(srcroot)/opcodes \
@INCINTL@
ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS)
-BUILD_CFLAGS = -g -O $(CSEARCH)
+BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(CSEARCH)
COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH)
diff --git a/sim/configure.ac b/sim/configure.ac
index 709bd3ea9dc2..e233f9c4750c 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -5,36 +5,11 @@ AC_INIT([sim], [0],
[https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
[], [https://sourceware.org/gdb/wiki/Sim/])
-AC_CANONICAL_SYSTEM
+SIM_AC_TOOLCHAIN
AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-AC_ARG_PROGRAM
-AC_PROG_CC
-AC_PROG_CPP
-AC_SUBST(CFLAGS)
-AR=${AR-ar}
-AC_SUBST(AR)
-AC_PROG_RANLIB
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test -z "$CC_FOR_BUILD"; then
- if test "x$cross_compiling" = "xno"; then
- CC_FOR_BUILD='$(CC)'
- else
- CC_FOR_BUILD=gcc
- fi
-fi
-AC_SUBST(CC_FOR_BUILD)
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
-AC_SUBST(CFLAGS_FOR_BUILD)
-
# If a cpu ever has more than one simulator to choose from, use
# --enable-sim=... to choose.
AC_ARG_ENABLE(sim,
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index a374d5e9916c..89e11892452f 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,11 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * configure.ac: Call SIM_AC_TOOLCHAIN and AC_CONFIG_FILES.
+ (AC_PROG_INSTALL, AC_PROG_CC, AC_CANONICAL_SYSTEM, CC_FOR_BUILD,
+ CFLAGS_FOR_BUILD): Delete.
+ * aclocal.m4: New file.
+ * configure: Regenerate.
+
2021-03-13 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (LDFLAGS_FOR_BUILD): Define.
diff --git a/sim/igen/aclocal.m4 b/sim/igen/aclocal.m4
new file mode 100644
index 000000000000..d8638e1703e9
diff --git a/sim/igen/configure.ac b/sim/igen/configure.ac
index d87673e90563..ff11814072ed 100644
--- a/sim/igen/configure.ac
+++ b/sim/igen/configure.ac
@@ -2,26 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(table.h)
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
-AC_PROG_INSTALL
-AC_PROG_CC
-
+SIM_AC_TOOLCHAIN
SIM_AC_OPTION_WARNINGS
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno" -a "x$host" != "xi386-windows"; then
- CC_FOR_BUILD='$(CC)'
- CFLAGS_FOR_BUILD='$(CFLAGS)'
- LDFLAGS_FOR_BUILD='$(LDFLAGS)'
-else
- CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
- CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-"-g"}
- LDFLAGS_FOR_BUILD=
-fi
-
-AC_CANONICAL_SYSTEM
-
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-AC_SUBST(LDFLAGS_FOR_BUILD)
-
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index f67c7f8be937..8cb45a8b72a6 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -20,56 +20,9 @@ dnl It is intended to be invoked last.
dnl
dnl See README-HACKING for more details.
AC_DEFUN([SIM_AC_COMMON],
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_CPP])
+[dnl
+SIM_AC_TOOLCHAIN
AC_CONFIG_HEADERS([config.h:config.in])
-AC_CANONICAL_SYSTEM
-AC_USE_SYSTEM_EXTENSIONS
-AC_C_BIGENDIAN
-AC_ARG_PROGRAM
-AC_PROG_INSTALL
-
-dnl Setup toolchain settings for build-time tools..
-if test "x$cross_compiling" = "xno"; then
- : "${CC_FOR_BUILD:=\$(CC)}"
- : "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
-else
- : "${CC_FOR_BUILD:=gcc}"
- : "${CFLAGS_FOR_BUILD:=-g -O}"
-fi
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-
-AC_SUBST(CFLAGS)
-AC_CHECK_TOOL(AR, ar)
-AC_PROG_RANLIB
-
-# Require C11 or newer. Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
-# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
-# is C99. So handle it ourselves.
-m4_version_prereq([2.70], [AC_MSG_ERROR([clean this up!])], [:])
-C_DIALECT=
-AC_MSG_CHECKING([whether C11 is supported by default])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
-# error "C11 support not found"
-#endif
-])], [AC_MSG_RESULT([yes])], [
- AC_MSG_RESULT([no])
- AC_MSG_CHECKING([for -std=c11 support])
- ac_save_CC="$CC"
- CC="$CC -std=c11"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
-# error "C11 support not found"
-#endif
-])], [
- AC_MSG_RESULT([yes])
- CC="$ac_save_CC"
- C_DIALECT="-std=c11"
-], [AC_MSG_ERROR([C11 is required])])])
-AC_SUBST(C_DIALECT)
# Some of the common include files depend on bfd.h, and bfd.h checks
# that config.h is included first by testing that the PACKAGE macro
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
new file mode 100644
index 000000000000..9cf702715ef0
--- /dev/null
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -0,0 +1,70 @@
+dnl Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl Setup the toolchain variables.
+AC_DEFUN([SIM_AC_TOOLCHAIN],
+[dnl
+AC_CANONICAL_SYSTEM
+AC_USE_SYSTEM_EXTENSIONS
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_CPP])
+AC_C_BIGENDIAN
+AC_ARG_PROGRAM
+AC_PROG_INSTALL
+
+dnl Setup toolchain settings for build-time tools..
+if test "x$cross_compiling" = "xno"; then
+ : "${CC_FOR_BUILD:=\$(CC)}"
+ : "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
+ : "${LDFLAGS_FOR_BUILD:=\$(LDFLAGS)}"
+else
+ : "${CC_FOR_BUILD:=gcc}"
+ : "${CFLAGS_FOR_BUILD:=-g -O}"
+ : "${LDLFAGS_FOR_BUILD:=}"
+fi
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CFLAGS_FOR_BUILD)
+AC_SUBST(LDFLAGS_FOR_BUILD)
+
+AC_SUBST(CFLAGS)
+AC_CHECK_TOOL(AR, ar)
+AC_PROG_RANLIB
+
+# Require C11 or newer. Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
+# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
+# is C99. So handle it ourselves.
+m4_version_prereq([2.70], [AC_MSG_ERROR([clean this up!])], [:])
+C_DIALECT=
+AC_MSG_CHECKING([whether C11 is supported by default])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "C11 support not found"
+#endif
+])], [AC_MSG_RESULT([yes])], [
+ AC_MSG_RESULT([no])
+ AC_MSG_CHECKING([for -std=c11 support])
+ ac_save_CC="$CC"
+ CC="$CC -std=c11"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "C11 support not found"
+#endif
+])], [
+ AC_MSG_RESULT([yes])
+ CC="$ac_save_CC"
+ C_DIALECT="-std=c11"
+], [AC_MSG_ERROR([C11 is required])])])
+AC_SUBST(C_DIALECT)
+])
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] sim: igen: merge build into top level
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
@ 2021-03-13 17:24 ` Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
2021-03-14 2:09 ` [PATCH] sim: testsuite: integrate common tests into build Mike Frysinger
2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-13 17:24 UTC (permalink / raw)
To: gdb-patches
This simplifies the build a bit (especially for deps in port subdirs),
and avoids recursive make. This in turn speeds up the build, and sets
us up for multi-target.
---
sim/ChangeLog | 7 +
sim/Makefile.am | 8 +
sim/Makefile.in | 330 ++-
sim/configure | 21 +-
sim/configure.ac | 4 +-
sim/igen/ChangeLog | 5 +
sim/igen/Makefile.in | 176 --
sim/igen/configure | 5245 ---------------------------------------
sim/igen/configure.ac | 9 -
sim/igen/local.mk | 89 +
sim/mips/ChangeLog | 5 +
sim/mips/Makefile.in | 7 -
sim/mn10300/ChangeLog | 5 +
sim/mn10300/Makefile.in | 4 -
sim/v850/ChangeLog | 5 +
sim/v850/Makefile.in | 4 -
16 files changed, 451 insertions(+), 5473 deletions(-)
delete mode 100644 sim/igen/Makefile.in
delete mode 100755 sim/igen/configure
delete mode 100644 sim/igen/configure.ac
create mode 100644 sim/igen/local.mk
diff --git a/sim/ChangeLog b/sim/ChangeLog
index eb3bce7a292e..e0d1045eb966 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.am [SIM_ENABLE_IGEN]: Include igen/local.mk.
+ * configure.ac: Delete AC_CONFIG_SUBDIRS(igen) call.
+ (SIM_ENABLE_IGEN): Define.
+ * configure, Makefile.in: Regenerate.
+
2021-03-07 Mike Frysinger <vapier@gentoo.org>
* Makefile.am (ACLOCAL_AMFLAGS): Add -Im4.
diff --git a/sim/Makefile.am b/sim/Makefile.am
index f9084d360ed3..af79bb5d5c7b 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -22,6 +22,11 @@ srcroot = $(srcdir)/..
SUBDIRS = @subdirs@
+# We don't set some of these files here, but we need to define them so they may
+# be used consistently in local.mk files we include below.
+noinst_LIBRARIES =
+EXTRA_PROGRAMS =
+
MOSTLYCLEANFILES = core
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
@@ -38,4 +43,7 @@ nltvals:
$(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot)
$(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def
+if SIM_ENABLE_IGEN
+include igen/local.mk
+endif
include testsuite/local.mk
diff --git a/sim/configure.ac b/sim/configure.ac
index e233f9c4750c..48d812b98855 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -123,10 +123,8 @@ if test "${enable_sim}" != no; then
sim_igen=yes
;;
esac
- if test "$sim_igen" = yes; then
- AC_CONFIG_SUBDIRS(igen)
- fi
fi
+AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index 89e11892452f..c862e98f4650 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * local.mk: New file.
+ * Makefile.in, configure.ac, configure: Removed.
+
2021-03-07 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Call SIM_AC_TOOLCHAIN and AC_CONFIG_FILES.
diff --git a/sim/igen/local.mk b/sim/igen/local.mk
new file mode 100644
index 000000000000..10f0f6d227da
--- /dev/null
+++ b/sim/igen/local.mk
@@ -0,0 +1,89 @@
+# The IGEN simulator generator for GDB, the GNU Debugger.
+#
+# Copyright 2002-2021 Free Software Foundation, Inc.
+#
+# Contributed by Andrew Cagney.
+#
+# This file is part of GDB.
+#
+# 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/>.
+
+# This makes sure igen is available before building the arch-subdirs which
+# need to run the igen tool.
+all-recursive: igen/igen$(EXEEXT)
+
+# Alias for developers.
+igen: %D%/igen$(EXEEXT)
+
+noinst_LIBRARIES += %D%/libigen.a
+%C%_libigen_a_SOURCES = \
+ %D%/table.c \
+ %D%/lf.c \
+ %D%/misc.c \
+ %D%/filter_host.c \
+ %D%/ld-decode.c \
+ %D%/ld-cache.c \
+ %D%/filter.c \
+ %D%/ld-insn.c \
+ %D%/gen-model.c \
+ %D%/gen-itable.c \
+ %D%/gen-icache.c \
+ %D%/gen-semantics.c \
+ %D%/gen-idecode.c \
+ %D%/gen-support.c \
+ %D%/gen-engine.c \
+ %D%/gen.c
+
+%C%_igen_SOURCES = %D%/igen.c
+%C%_igen_LDADD = %D%/libigen.a
+
+%D%/igen$(EXEEXT): $(%C%_igen_OBJECTS) $(%C%_igen_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_igen_OBJECTS) $(%C%_igen_LDADD)
+
+# igen is a build-time only tool. Override the default rules for it.
+%D%/%.o: %D%/%.c
+ $(AM_V_CC)$(COMPILE_FOR_BUILD) -c $< -o $@
+
+# Build some of the files in standalone mode for developers of igen itself.
+%D%/%-main.o: %D%/%.c
+ $(AM_V_CC)$(COMPILE_FOR_BUILD) -DMAIN -c $< -o $@
+
+%C%_filter_SOURCES =
+%C%_filter_LDADD = %D%/filter-main.o %D%/libigen.a
+
+%C%_gen_SOURCES =
+%C%_gen_LDADD = %D%/gen-main.o %D%/libigen.a
+
+%C%_ld_cache_SOURCES =
+%C%_ld_cache_LDADD = %D%/ld-cache-main.o %D%/libigen.a
+
+%C%_ld_decode_SOURCES =
+%C%_ld_decode_LDADD = %D%/ld-decode-main.o %D%/libigen.a
+
+%C%_ld_insn_SOURCES =
+%C%_ld_insn_LDADD = %D%/ld-insn-main.o %D%/libigen.a
+
+%C%_table_SOURCES =
+%C%_table_LDADD = %D%/table-main.o %D%/libigen.a
+
+%C%_IGEN_TOOLS = \
+ %D%/igen \
+ %D%/filter \
+ %D%/gen \
+ %D%/ld-cache \
+ %D%/ld-decode \
+ %D%/ld-insn \
+ %D%/table
+EXTRA_PROGRAMS += $(%C%_IGEN_TOOLS)
+MOSTLYCLEANFILES += $(%C%_IGEN_TOOLS)
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 12347a7e3e23..ba73810dc433 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen, tmp-m16, tmp-micromips): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index c94bd11282b8..c66c6e839782 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -95,9 +95,6 @@ micromipsrun.o: sim-main.h micromips16_idecode.h micromips32_idecode.h \
multi-run.o: multi-include.h tmp-mach-multi
-../igen/igen:
- cd ../igen && $(MAKE)
-
IGEN_TRACE= # -G omit-line-numbers # -G trace-rule-selection -G trace-rule-rejection -G trace-entries # -G trace-all
IGEN_INSN=$(srcdir)/mips.igen
IGEN_DC=$(srcdir)/mips.dc
@@ -152,7 +149,6 @@ BUILT_SRC_FROM_IGEN = \
$(BUILT_SRC_FROM_IGEN): tmp-igen
tmp-igen: $(IGEN_INSN) $(IGEN_DC) ../igen/igen $(IGEN_INCLUDE)
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-I $(srcdir) \
@@ -224,7 +220,6 @@ BUILT_SRC_FROM_M16 = \
$(BUILT_SRC_FROM_M16): tmp-m16
tmp-m16: $(IGEN_INSN) $(IGEN_DC) ../igen/igen $(IGEN_INCLUDE)
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-I $(srcdir) \
@@ -351,7 +346,6 @@ BUILT_SRC_FROM_MICROMIPS = \
$(BUILT_SRC_FROM_MICROMIPS): tmp-micromips
tmp-micromips: $(IGEN_INSN) $(IGEN_DC) ../igen/igen $(IGEN_INCLUDE)
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-I $(srcdir) \
@@ -397,7 +391,6 @@ tmp-micromips: $(IGEN_INSN) $(IGEN_DC) ../igen/igen $(IGEN_INCLUDE)
micromips16_support.h
$(SHELL) $(srcdir)/../../move-if-change tmp-support.c \
micromips16_support.c
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-I $(srcdir) \
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index c9de7a4b1c21..cca76a7f87e2 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/mn10300/Makefile.in b/sim/mn10300/Makefile.in
index 916900095d8c..6cdf9712882b 100644
--- a/sim/mn10300/Makefile.in
+++ b/sim/mn10300/Makefile.in
@@ -65,14 +65,10 @@ clean-igen:
rm -f $(BUILT_SRC_FROM_IGEN)
rm -f tmp-igen tmp-insns
-../igen/igen:
- cd ../igen && $(MAKE)
-
IGEN_TRACE= # -G omit-line-numbers # -G trace-rule-selection -G trace-rule-rejection -G trace-entries
IGEN_INSN=$(srcdir)/mn10300.igen $(srcdir)/am33.igen $(srcdir)/am33-2.igen
IGEN_DC=$(srcdir)/mn10300.dc
tmp-igen: $(IGEN_INSN) $(IGEN_DC) ../igen/igen
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-G gen-direct-access \
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 495a7e28975c..f1eb8d62c9e3 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (../igen/igen): Delete rule.
+ (tmp-igen): Delete ../igen make.
+
2021-02-28 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
diff --git a/sim/v850/Makefile.in b/sim/v850/Makefile.in
index 29e75528a5b0..983fc79f93a7 100644
--- a/sim/v850/Makefile.in
+++ b/sim/v850/Makefile.in
@@ -65,14 +65,10 @@ clean-igen:
rm -f $(BUILT_SRC_FROM_IGEN)
rm -f tmp-igen tmp-insns
-../igen/igen:
- cd ../igen && $(MAKE)
-
IGEN_TRACE= # -G omit-line-numbers # -G trace-rule-selection -G trace-rule-rejection -G trace-entries
IGEN_INSN=$(srcdir)/v850.igen
IGEN_DC=$(srcdir)/v850-dc
tmp-igen: $(IGEN_INSN) $(IGEN_DC) ../igen/igen
- cd ../igen && $(MAKE)
../igen/igen \
$(IGEN_TRACE) \
-G gen-direct-access \
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] sim: add preliminary support for --enable-targets
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 2/3] sim: igen: merge build into top level Mike Frysinger
@ 2021-03-13 17:24 ` Mike Frysinger
2021-03-14 2:09 ` [PATCH] sim: testsuite: integrate common tests into build Mike Frysinger
2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-13 17:24 UTC (permalink / raw)
To: gdb-patches
This doesn't actually create one `run` program like other projects,
but creates multiple `run-$arch` targets. While it might not seem
that useful initially, this has some nice properties:
- Allows us to quickly build all sim targets in a single tree.
- Positions us better for converting targets over to a proper
multitarget build+install.
We don't have the ability to actually run tests against them, but
that's due to a limitation in gas: it doesn't support multitarget.
If that ever changes, we should be able to turn on our tests too.
We can improve the test framework to fallback to a system toolchain
if available to help mitigate that.
---
sim/Makefile.am | 3 +
sim/Makefile.in | 2 +
sim/common/Make-common.in | 7 +-
sim/configure | 329 ++++++++++++++++++++++++++++++++++----
sim/configure.ac | 158 +++++++-----------
sim/ppc/Makefile.in | 4 +
6 files changed, 372 insertions(+), 131 deletions(-)
diff --git a/sim/Makefile.am b/sim/Makefile.am
index af79bb5d5c7b..87673cd537e5 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -22,6 +22,9 @@ srcroot = $(srcdir)/..
SUBDIRS = @subdirs@
+SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
+AM_MAKEFLAGS = SIM_PRIMARY_TARGET=$(SIM_PRIMARY_TARGET)
+
# We don't set some of these files here, but we need to define them so they may
# be used consistently in local.mk files we include below.
noinst_LIBRARIES =
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index a6875fe8f964..c8445bce59ea 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -467,9 +467,14 @@ CGEN_MAIN_CPU_DEPS = \
install: install-common $(SIM_EXTRA_INSTALL)
install-common: installdirs
+ a=`basename "$$(pwd)"`; \
n=`echo run | sed '$(program_transform_name)'`; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
$(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
- n=`echo libsim.a | sed s/libsim.a/lib$(target_alias)-sim.a/`; \
+ n="$(target_alias)-sim"; \
+ a=`basename "$$(pwd)"`; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
+ n="lib$$n.a"; \
$(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \
( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n )
diff --git a/sim/configure.ac b/sim/configure.ac
index 48d812b98855..35101a0d6729 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -19,110 +19,72 @@ yes | no) ;;
*) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
esac])
+AC_ARG_ENABLE(targets,
+[ --enable-targets alternative target configurations],
+[case "${enableval}" in
+ yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac])
+
+dnl Used to keep track of which target (if any) is the default one. This is
+dnl used when installing files to see if they need to be suffixed.
+SIM_PRIMARY_TARGET=
+AC_SUBST(SIM_PRIMARY_TARGET)
+
+m4_define([SIM_TARGET], [
+ case "${targ}" in
+ all|$1)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=$2
+ fi
+ AC_CONFIG_SUBDIRS($2)
+ $3
+ ;;
+ esac
+])
+
dnl WHEN ADDING ENTRIES TO THIS MATRIX:
dnl Make sure that the left side always has two dashes. Otherwise you can get
dnl spurious matches. Even for unambiguous cases, do this as a convention, else
dnl the table becomes a real mess to understand and maintain.
if test "${enable_sim}" != no; then
sim_igen=no
- case "${target}" in
- aarch64*-*-*)
- AC_CONFIG_SUBDIRS(aarch64)
- ;;
- arm*-*-*)
- AC_CONFIG_SUBDIRS(arm)
- ;;
- avr*-*-*)
- AC_CONFIG_SUBDIRS(avr)
- ;;
- bfin-*-*)
- AC_CONFIG_SUBDIRS(bfin)
- ;;
- bpf-*-*)
- AC_CONFIG_SUBDIRS(bpf)
- ;;
- cr16*-*-*)
- AC_CONFIG_SUBDIRS(cr16)
- ;;
- cris-*-* | crisv32-*-*)
- AC_CONFIG_SUBDIRS(cris)
- ;;
- d10v-*-*)
- AC_CONFIG_SUBDIRS(d10v)
- ;;
- frv-*-*)
- AC_CONFIG_SUBDIRS(frv)
- ;;
- h8300*-*-*)
- AC_CONFIG_SUBDIRS(h8300)
- ;;
- iq2000-*-*)
- AC_CONFIG_SUBDIRS(iq2000)
- ;;
- lm32-*-*)
- AC_CONFIG_SUBDIRS(lm32)
- ;;
- m32c-*-*)
- AC_CONFIG_SUBDIRS(m32c)
- ;;
- m32r-*-*)
- AC_CONFIG_SUBDIRS(m32r)
- ;;
- m68hc11-*-*|m6811-*-*)
- AC_CONFIG_SUBDIRS(m68hc11)
- ;;
- mcore-*-*)
- AC_CONFIG_SUBDIRS(mcore)
- ;;
- microblaze-*-*)
- AC_CONFIG_SUBDIRS(microblaze)
- ;;
- mips*-*-*)
- AC_CONFIG_SUBDIRS(mips)
- sim_igen=yes
- ;;
- mn10300*-*-*)
- AC_CONFIG_SUBDIRS(mn10300)
- sim_igen=yes
- ;;
- moxie-*-*)
- AC_CONFIG_SUBDIRS(moxie)
- ;;
- msp430*-*-*)
- AC_CONFIG_SUBDIRS(msp430)
- ;;
- or1k-*-* | or1knd-*-*)
- AC_CONFIG_SUBDIRS(or1k)
- ;;
- pru*-*-*)
- AC_CONFIG_SUBDIRS(pru)
- ;;
- riscv*-*-*)
- AC_CONFIG_SUBDIRS(riscv)
- ;;
- rl78-*-*)
- AC_CONFIG_SUBDIRS(rl78)
- ;;
- rx-*-*)
- AC_CONFIG_SUBDIRS(rx)
- ;;
- sh*-*-*)
- AC_CONFIG_SUBDIRS(sh)
- ;;
- sparc-*-rtems*|sparc-*-elf*)
- AC_CONFIG_SUBDIRS(erc32)
- ;;
- powerpc*-*-*)
- AC_CONFIG_SUBDIRS(ppc)
- ;;
- ft32-*-*)
- AC_CONFIG_SUBDIRS(ft32)
- ;;
- v850*-*-*)
- AC_CONFIG_SUBDIRS(v850)
- sim_igen=yes
- ;;
- esac
+ for targ in `echo $target $enable_targets | sed 's/,/ /g'`
+ do
+ SIM_TARGET([aarch64*-*-*], [aarch64])
+ SIM_TARGET([arm*-*-*], [arm])
+ SIM_TARGET([avr*-*-*], [avr])
+ SIM_TARGET([bfin-*-*], [bfin])
+ SIM_TARGET([bpf-*-*], [bpf])
+ SIM_TARGET([cr16*-*-*], [cr16])
+ SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
+ SIM_TARGET([d10v-*-*], [d10v])
+ SIM_TARGET([frv-*-*], [frv])
+ SIM_TARGET([h8300*-*-*], [h8300])
+ SIM_TARGET([iq2000-*-*], [iq2000])
+ SIM_TARGET([lm32-*-*], [lm32])
+ SIM_TARGET([m32c-*-*], [m32c])
+ SIM_TARGET([m32r-*-*], [m32r])
+ SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
+ SIM_TARGET([mcore-*-*], [mcore])
+ SIM_TARGET([microblaze-*-*], [microblaze])
+ SIM_TARGET([mips*-*-*], [mips], [sim_igen=yes])
+ SIM_TARGET([mn10300*-*-*], [mn10300], [sim_igen=yes])
+ SIM_TARGET([moxie-*-*], [moxie])
+ SIM_TARGET([msp430*-*-*], [msp430])
+ SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k])
+ SIM_TARGET([pru*-*-*], [pru])
+ SIM_TARGET([riscv*-*-*], [riscv])
+ SIM_TARGET([rl78-*-*], [rl78])
+ SIM_TARGET([rx-*-*], [rx])
+ SIM_TARGET([sh*-*-*], [sh])
+ SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32])
+ SIM_TARGET([powerpc*-*-*], [ppc])
+ SIM_TARGET([ft32-*-*], [ft32])
+ SIM_TARGET([v850*-*-*], [v850], [sim_igen=yes])
+ done
fi
AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index ae99dc3a1038..d2bd1d317754 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -885,11 +885,15 @@ config.status: configure
check:
install: installdirs
+ a=`basename "$$(pwd)"`; \
n=`echo run | sed '$(program_transform_name)'`; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
$(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
install-strip: installdirs
+ a=`basename "$$(pwd)"`; \
n=`echo run | sed '$(program_transform_name)'`; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
$(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
$(STRIP) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] sim: testsuite: integrate common tests into build
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 2/3] sim: igen: merge build into top level Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
@ 2021-03-14 2:09 ` Mike Frysinger
2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-14 2:09 UTC (permalink / raw)
To: gdb-patches
Now that we have the common automake build with support for build-time
programs working, we can integrate the common tests into the default
`make check` flow.
---
sim/Makefile.am | 3 +
sim/Makefile.in | 580 ++++++++++++++++++++++++++++++-
sim/testsuite/common/Makefile.in | 53 ---
sim/testsuite/common/local.mk | 84 +++++
sim/testsuite/local.mk | 2 +
5 files changed, 651 insertions(+), 71 deletions(-)
delete mode 100644 sim/testsuite/common/Makefile.in
create mode 100644 sim/testsuite/common/local.mk
diff --git a/sim/Makefile.am b/sim/Makefile.am
index a121c1fed43d..a68a964d87a3 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -27,9 +27,12 @@ AM_MAKEFLAGS = SIM_PRIMARY_TARGET=$(SIM_PRIMARY_TARGET)
# We don't set some of these vars here, but we need to define them so they may
# be used consistently in local.mk files we include below.
+check_PROGRAMS =
noinst_LIBRARIES =
EXTRA_PROGRAMS =
+CLEANFILES =
+DISTCLEANFILES =
MOSTLYCLEANFILES = core
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
diff --git a/sim/testsuite/common/Makefile.in b/sim/testsuite/common/Makefile.in
deleted file mode 100644
index d088501676e7..000000000000
--- a/sim/testsuite/common/Makefile.in
+++ /dev/null
@@ -1,53 +0,0 @@
-CC=gcc
-CFLAGS = -Wall -Werror -I../../common -I../../../include -g
-default: check
-
-
-# Verify SIM-BITS
-
-check: bits32m0.ok bits32m31.ok bits64m0.ok bits64m63.ok
-all: bits32m0 bits32m31 bits64m0 bits64m63
-
-bits32m0.c: bits-gen bits-tst.c
- ./bits-gen 32 0 big > tmp-bits32m0.c
- cat bits-tst.c >> tmp-bits32m0.c
- mv tmp-bits32m0.c bits32m0.c
-bits32m31.c: bits-gen bits-tst.c
- ./bits-gen 32 31 little > tmp-bits32m31.c
- cat bits-tst.c >> tmp-bits32m31.c
- mv tmp-bits32m31.c bits32m31.c
-bits64m0.c: bits-gen bits-tst.c
- ./bits-gen 64 0 big > tmp-bits64m0.c
- cat bits-tst.c >> tmp-bits64m0.c
- mv tmp-bits64m0.c bits64m0.c
-bits64m63.c: bits-gen bits-tst.c
- ./bits-gen 64 63 little > tmp-bits64m63.c
- cat bits-tst.c >> tmp-bits64m63.c
- mv tmp-bits64m63.c bits64m63.c
-
-
-
-# Verify SIM-FPU
-#
-#check: fpu-tst.ok
-#all: fpu-tst
-
-
-
-# Verify SIM-ALU
-
-check: alu-tst.ok
-all: alu-tst
-alu-tst.o: alu-tst.c alu-n-tst.h
-
-clean:
- rm -f *.o
- rm -f *.ok
- rm -f bits32m0 bits32m31 bits64m0 bits64m63 bits-gen
- rm -f tmp-*
- rm -f alu-tst
-
-.SUFIXES: .ok
-%.ok: %
- ./$<
- touch $<.ok
diff --git a/sim/testsuite/common/local.mk b/sim/testsuite/common/local.mk
new file mode 100644
index 000000000000..38ffb0b0b7d2
--- /dev/null
+++ b/sim/testsuite/common/local.mk
@@ -0,0 +1,84 @@
+# Copyright (C) 1997-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/>.
+
+EXTRA_PROGRAMS += %D%/bits-gen
+
+# We don't build this normally as it relies on the Berkeley SoftFloat/TestFloat
+# projects being installed/available first.
+EXTRA_PROGRAMS += %D%/fpu-tst
+
+TESTS = \
+ %D%/bits32m0 \
+ %D%/bits32m31 \
+ %D%/bits64m0 \
+ %D%/bits64m63 \
+ %D%/alu-tst
+check_PROGRAMS += $(TESTS)
+
+%C%_CPPFLAGS = \
+ -I$(srcdir)/common \
+ -I$(srcroot)/include
+
+# These tests are build-time only tools. Override the default rules for them.
+%D%/%.o: %D%/%.c
+ $(AM_V_CC)$(COMPILE_FOR_BUILD) $(%C%_CPPFLAGS) -c $< -o $@
+
+%D%/alu-tst$(EXEEXT): $(%C%_alu_tst_OBJECTS) $(%C%_alu_tst_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_alu_tst_OBJECTS) $(%C%_alu_tst_LDADD)
+
+%D%/fpu-tst$(EXEEXT): $(%C%_fpu_tst_OBJECTS) $(%C%_fpu_tst_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_fpu_tst_OBJECTS) $(%C%_fpu_tst_LDADD)
+
+%D%/bits-gen$(EXEEXT): $(%C%_bits_gen_OBJECTS) $(%C%_bits_gen_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits_gen_OBJECTS) $(%C%_bits_gen_LDADD)
+
+%D%/bits32m0$(EXEEXT): $(%C%_bits32m0_OBJECTS) $(%C%_bits32m0_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits32m0_OBJECTS) $(%C%_bits32m0_LDADD)
+
+%D%/bits32m0.c: %D%/bits-gen %D%/bits-tst.c
+ $< 32 0 big > $@.tmp
+ cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+ mv $@.tmp $@
+
+%D%/bits32m31$(EXEEXT): $(%C%_bits32m31_OBJECTS) $(%C%_bits32m31_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits32m31_OBJECTS) $(%C%_bits32m31_LDADD)
+
+%D%/bits32m31.c: %D%/bits-gen %D%/bits-tst.c
+ $< 32 31 little > $@.tmp
+ cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+ mv $@.tmp $@
+
+%D%/bits64m0$(EXEEXT): $(%C%_bits64m0_OBJECTS) $(%C%_bits64m0_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits64m0_OBJECTS) $(%C%_bits64m0_LDADD)
+
+%D%/bits64m0.c: %D%/bits-gen %D%/bits-tst.c
+ $< 64 0 big > $@.tmp
+ cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+ mv $@.tmp $@
+
+%D%/bits64m63$(EXEEXT): $(%C%_bits64m63_OBJECTS) $(%C%_bits64m63_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits64m63_OBJECTS) $(%C%_bits64m63_LDADD)
+
+%D%/bits64m63.c: %D%/bits-gen %D%/bits-tst.c
+ $< 64 63 little > $@.tmp
+ cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+ mv $@.tmp $@
+
+CLEANFILES += \
+ %D%/bits-gen \
+ %D%/bits32m0.c \
+ %D%/bits32m31.c \
+ %D%/bits64m0.c \
+ %D%/bits64m63.c
diff --git a/sim/testsuite/local.mk b/sim/testsuite/local.mk
index bd8a20696434..82eb70de72aa 100644
--- a/sim/testsuite/local.mk
+++ b/sim/testsuite/local.mk
@@ -32,3 +32,5 @@ check-DEJAGNU: site.exp
MOSTLYCLEANFILES += \
site-srcdir.exp testrun.log testrun.sum
+
+include %D%/common/local.mk
--
2.30.0
^ permalink raw reply [flat|nested] 7+ messages in thread