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] sim: add support for build-time ar & ranlib
Date: Sat,  1 May 2021 17:53:50 -0400	[thread overview]
Message-ID: <20210501215350.27401-1-vapier@gentoo.org> (raw)

This is needed when building for a target whose ar & ranlib are
incompatible with the current build system.  For example, building
for Windows on a Linux system.

Then manually import the automake rule for libigen.a, but tweak the
tool variables to use the FOR_BUILD variants.
---
 sim/Makefile.in               | 16 ++++++++++++----
 sim/aarch64/configure         | 12 ++++++++++--
 sim/arm/configure             | 12 ++++++++++--
 sim/avr/configure             | 12 ++++++++++--
 sim/bfin/configure            | 12 ++++++++++--
 sim/bpf/configure             | 12 ++++++++++--
 sim/configure                 |  8 ++++++++
 sim/cr16/configure            | 12 ++++++++++--
 sim/cris/configure            | 12 ++++++++++--
 sim/d10v/configure            | 12 ++++++++++--
 sim/erc32/configure           | 12 ++++++++++--
 sim/example-synacor/configure | 12 ++++++++++--
 sim/frv/configure             | 12 ++++++++++--
 sim/ft32/configure            | 12 ++++++++++--
 sim/h8300/configure           | 12 ++++++++++--
 sim/igen/local.mk             |  6 ++++++
 sim/iq2000/configure          | 12 ++++++++++--
 sim/lm32/configure            | 12 ++++++++++--
 sim/m32c/configure            | 12 ++++++++++--
 sim/m32r/configure            | 12 ++++++++++--
 sim/m4/sim_ac_toolchain.m4    |  6 ++++++
 sim/m68hc11/configure         | 12 ++++++++++--
 sim/mcore/configure           | 12 ++++++++++--
 sim/microblaze/configure      | 12 ++++++++++--
 sim/mips/configure            | 12 ++++++++++--
 sim/mn10300/configure         | 12 ++++++++++--
 sim/moxie/configure           | 12 ++++++++++--
 sim/msp430/configure          | 12 ++++++++++--
 sim/or1k/configure            | 12 ++++++++++--
 sim/pru/configure             | 12 ++++++++++--
 sim/riscv/configure           | 12 ++++++++++--
 sim/rl78/configure            | 12 ++++++++++--
 sim/rx/configure              | 12 ++++++++++--
 sim/sh/configure              | 12 ++++++++++--
 sim/v850/configure            | 12 ++++++++++--
 35 files changed, 342 insertions(+), 66 deletions(-)

diff --git a/sim/igen/local.mk b/sim/igen/local.mk
index 10f0f6d227da..f2245727a270 100644
--- a/sim/igen/local.mk
+++ b/sim/igen/local.mk
@@ -48,6 +48,12 @@ noinst_LIBRARIES += %D%/libigen.a
 %C%_igen_SOURCES = %D%/igen.c
 %C%_igen_LDADD = %D%/libigen.a
 
+# These rules are copied from automake, but tweaked to use FOR_BUILD variables.
+igen/libigen.a: $(igen_libigen_a_OBJECTS) $(igen_libigen_a_DEPENDENCIES) $(EXTRA_igen_libigen_a_DEPENDENCIES) igen/$(am__dirstamp)
+	$(AM_V_at)-rm -f $@
+	$(AM_V_AR)$(AR_FOR_BUILD) $(ARFLAGS) $@ $(igen_libigen_a_OBJECTS) $(igen_libigen_a_LIBADD)
+	$(AM_V_at)$(RANLIB_FOR_BUILD) $@
+
 %D%/igen$(EXEEXT): $(%C%_igen_OBJECTS) $(%C%_igen_DEPENDENCIES) %D%/$(am__dirstamp)
 	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_igen_OBJECTS) $(%C%_igen_LDADD)
 
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
index 9cf702715ef0..2f1a42868ca9 100644
--- a/sim/m4/sim_ac_toolchain.m4
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -26,15 +26,21 @@ AC_PROG_INSTALL
 
 dnl Setup toolchain settings for build-time tools..
 if test "x$cross_compiling" = "xno"; then
+  : "${AR_FOR_BUILD:=\$(AR)}"
   : "${CC_FOR_BUILD:=\$(CC)}"
+  : "${RANLIB_FOR_BUILD:=\$(RANLIB)}"
   : "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
   : "${LDFLAGS_FOR_BUILD:=\$(LDFLAGS)}"
 else
+  : "${AR_FOR_BUILD:=ar}"
   : "${CC_FOR_BUILD:=gcc}"
+  : "${RANLIB_FOR_BUILD:=ranlib}"
   : "${CFLAGS_FOR_BUILD:=-g -O}"
   : "${LDLFAGS_FOR_BUILD:=}"
 fi
+AC_SUBST(AR_FOR_BUILD)
 AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(RANLIB_FOR_BUILD)
 AC_SUBST(CFLAGS_FOR_BUILD)
 AC_SUBST(LDFLAGS_FOR_BUILD)
 
-- 
2.31.1


                 reply	other threads:[~2021-05-01 21:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210501215350.27401-1-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).