+2021-04-03 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.am (SIM_PRIMARY_TARGET, AM_MAKEFLAGS): Define.
+ * configure.ac: Add --enable-targets option. Define SIM_PRIMARY_TARGET
+ and SIM_TARGET. Rewrite case statement with SIM_TARGET calls.
+ * Makefile.in, configure: Regenerate.
+
2021-04-02 Mike Frysinger <vapier@gentoo.org>
* Makefile.am [SIM_ENABLE_IGEN]: Include igen/local.mk.
SUBDIRS = @subdirs@
+SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
+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.
noinst_LIBRARIES =
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
srcroot = $(srcdir)/..
SUBDIRS = @subdirs@
+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.
+2021-04-03 Mike Frysinger <vapier@gentoo.org>
+
+ * Make-common.in (install-common): Install as run-$arch and
+ libsim-$arch.a when not the primary arch.
+
2021-04-02 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (CFLAGS_FOR_BUILD): Define.
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 )
SIM_ENABLE_IGEN_FALSE
SIM_ENABLE_IGEN_TRUE
subdirs
+SIM_PRIMARY_TARGET
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
enable_dependency_tracking
enable_silent_rules
enable_sim
+enable_targets
'
ac_precious_vars='build_alias
host_alias
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-sim Enable the GNU simulator
+ --enable-targets alternative target configurations
Some influential environment variables:
CC C compiler command
fi
+# Check whether --enable-targets was given.
+if test "${enable_targets+set}" = set; then :
+ enableval=$enable_targets; case "${enableval}" in
+ yes | "") as_fn_error $? "enable-targets option must specify target names or 'all'" "$LINENO" 5
+ ;;
+ no) enable_targets= ;;
+ *) enable_targets=$enableval ;;
+esac
+fi
+
+
+SIM_PRIMARY_TARGET=
+
+
+
+
if test "${enable_sim}" != no; then
sim_igen=no
- case "${target}" in
- aarch64*-*-*)
+ for targ in `echo $target $enable_targets | sed 's/,/ /g'`
+ do
+
+ case "${targ}" in
+ all|aarch64*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=aarch64
+ fi
subdirs="$subdirs aarch64"
+
;;
- arm*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|arm*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=arm
+ fi
subdirs="$subdirs arm"
+
;;
- avr*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|avr*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=avr
+ fi
subdirs="$subdirs avr"
+
;;
- bfin-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|bfin-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=bfin
+ fi
subdirs="$subdirs bfin"
+
;;
- bpf-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|bpf-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=bpf
+ fi
subdirs="$subdirs bpf"
+
;;
- cr16*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|cr16*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=cr16
+ fi
subdirs="$subdirs cr16"
+
;;
- cris-*-* | crisv32-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|cris-*-* | crisv32-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=cris
+ fi
subdirs="$subdirs cris"
+
;;
- d10v-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|d10v-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=d10v
+ fi
subdirs="$subdirs d10v"
+
;;
- frv-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|frv-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=frv
+ fi
subdirs="$subdirs frv"
+
;;
- h8300*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|h8300*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=h8300
+ fi
subdirs="$subdirs h8300"
+
;;
- iq2000-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|iq2000-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=iq2000
+ fi
subdirs="$subdirs iq2000"
+
;;
- lm32-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|lm32-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=lm32
+ fi
subdirs="$subdirs lm32"
+
;;
- m32c-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|m32c-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=m32c
+ fi
subdirs="$subdirs m32c"
+
;;
- m32r-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|m32r-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=m32r
+ fi
subdirs="$subdirs m32r"
+
;;
- m68hc11-*-*|m6811-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|m68hc11-*-*|m6811-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=m68hc11
+ fi
subdirs="$subdirs m68hc11"
+
;;
- mcore-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|mcore-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=mcore
+ fi
subdirs="$subdirs mcore"
+
;;
- microblaze-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|microblaze-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=microblaze
+ fi
subdirs="$subdirs microblaze"
+
;;
- mips*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|mips*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=mips
+ fi
subdirs="$subdirs mips"
sim_igen=yes
;;
- mn10300*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|mn10300*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=mn10300
+ fi
subdirs="$subdirs mn10300"
sim_igen=yes
;;
- moxie-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|moxie-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=moxie
+ fi
subdirs="$subdirs moxie"
+
;;
- msp430*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|msp430*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=msp430
+ fi
subdirs="$subdirs msp430"
+
;;
- or1k-*-* | or1knd-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|or1k-*-* | or1knd-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=or1k
+ fi
subdirs="$subdirs or1k"
+
;;
- pru*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|pru*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=pru
+ fi
subdirs="$subdirs pru"
+
;;
- riscv*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|riscv*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=riscv
+ fi
subdirs="$subdirs riscv"
+
;;
- rl78-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|rl78-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=rl78
+ fi
subdirs="$subdirs rl78"
+
;;
- rx-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|rx-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=rx
+ fi
subdirs="$subdirs rx"
+
;;
- sh*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|sh*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=sh
+ fi
subdirs="$subdirs sh"
+
;;
- sparc-*-rtems*|sparc-*-elf*)
+ esac
+
+
+ case "${targ}" in
+ all|sparc-*-rtems*|sparc-*-elf*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=erc32
+ fi
subdirs="$subdirs erc32"
+
;;
- powerpc*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|powerpc*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=ppc
+ fi
subdirs="$subdirs ppc"
+
;;
- ft32-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|ft32-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=ft32
+ fi
subdirs="$subdirs ft32"
+
;;
- v850*-*-*)
+ esac
+
+
+ case "${targ}" in
+ all|v850*-*-*)
+ if test "${targ}" = "${target}"; then
+ SIM_PRIMARY_TARGET=v850
+ fi
subdirs="$subdirs v850"
sim_igen=yes
;;
esac
+
+ done
fi
if test "$sim_igen" = "yes"; then
SIM_ENABLE_IGEN_TRUE=
*) 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"])
+2021-04-03 Mike Frysinger <vapier@gentoo.org>
+
+ * Makefile.in (install): Install as run-ppc when not the primary arch.
+ (install-strip): Likewise.
+
2021-03-13 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (BUILD_LDFLAGS): Rename to ...
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)