From: "Björn Töpel" <bjorn@kernel.org>
To: bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
Alexandre Ghiti <alexghiti@rivosinc.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jean-Philippe Brucker <jean-philippe@linaro.org>,
Quentin Monnet <qmo@kernel.org>
Cc: "Björn Töpel" <bjorn@rivosinc.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
"David Abdurachmanov" <davidlt@rivosinc.com>
Subject: [PATCH] tools: Override makefile ARCH variable if defined, but empty
Date: Wed, 6 Nov 2024 20:32:06 +0100 [thread overview]
Message-ID: <20241106193208.290067-1-bjorn@kernel.org> (raw)
From: Björn Töpel <bjorn@rivosinc.com>
There are a number of tools (bpftool, selftests), that require a
"bootstrap" build. Here, a bootstrap build is a build host variant of
a target. E.g., assume that you're performing a bpftool cross-build on
x86 to riscv, a bootstrap build would then be an x86 variant of
bpftool. The typical way to perform the host build variant, is to pass
"ARCH=" in a sub-make. However, if a variable has been set with a
command argument, then ordinary assignments in the makefile are
ignored.
This side-effect results in that ARCH, and variables depending on ARCH
are not set.
Workaround by overriding ARCH to the host arch, if ARCH is empty.
Fixes: 8859b0da5aac ("tools/bpftool: Fix cross-build")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
tools/scripts/Makefile.arch | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
index f6a50f06dfc4..eabfe9f411d9 100644
--- a/tools/scripts/Makefile.arch
+++ b/tools/scripts/Makefile.arch
@@ -7,8 +7,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
-e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
-ifndef ARCH
-ARCH := $(HOSTARCH)
+ifeq ($(strip $(ARCH)),)
+override ARCH := $(HOSTARCH)
endif
SRCARCH := $(ARCH)
base-commit: 7758b206117dab9894f0bcb8333f8e4731c5065a
--
2.45.2
next reply other threads:[~2024-11-06 19:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 19:32 Björn Töpel [this message]
2024-11-07 9:13 ` [PATCH] tools: Override makefile ARCH variable if defined, but empty Jean-Philippe Brucker
2024-11-07 10:09 ` Alexandre Ghiti
2024-11-20 13:25 ` Björn Töpel
2024-11-21 6:04 ` Namhyung Kim
2024-11-21 11:29 ` Quentin Monnet
2024-11-26 19:08 ` Andrii Nakryiko
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=20241106193208.290067-1-bjorn@kernel.org \
--to=bjorn@kernel.org \
--cc=acme@redhat.com \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@rivosinc.com \
--cc=bpf@vger.kernel.org \
--cc=davidlt@rivosinc.com \
--cc=jean-philippe@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=qmo@kernel.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 NNTP newsgroup(s).