Skip to contentSkip to conversation

tools: Override makefile ARCH variable if defined, but empty

PATCH Applied Björn Töpel 5 participants 5 messages Nov 27, 2024 – Dec 11, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools: Override makefile ARCH variable if defined, but empty

From: Björn Töpel <[email protected]>

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.

---
v2: Proper tree tag "bpf".
Collected *-by tags.

Andrii,

Apologies for missing out the tree tag in the patch. Here's a respin, and thanks for routing it via the BPF tree.

Björn

---
 tools/scripts/Makefile.arch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/scripts/Makefile.arch +2 -2
index f6a50f06dfc4..eabfe9f411d9 100644
@@ -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: 3448ad23b34e43a2526bd0f9e1221e8de876adec

Signature · 1 line
2.45.2
Acked-by on v2 1/1
#1 lore raw
Quoted 14 lines · Björn Töpel

From: Björn Töpel <[email protected]>

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.

Quoted 8 lines

Workaround by overriding ARCH to the host arch, if ARCH is empty.

jirka

Quoted 37 lines

---
v2: Proper tree tag "bpf".
Collected *-by tags.

Andrii,

Apologies for missing out the tree tag in the patch. Here's a respin, and thanks for routing it via the BPF tree.

Björn

---
 tools/scripts/Makefile.arch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/scripts/Makefile.arch +2 -2
index f6a50f06dfc4..eabfe9f411d9 100644
@@ -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: 3448ad23b34e43a2526bd0f9e1221e8de876adec

Signature · 1 line
2.45.2
Reviewed-by on v2 1/1
#2 lore raw
In reply to Björn Töpel
Quoted 14 lines · Björn Töpel

From: Björn Töpel <[email protected]>

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.

Quoted 8 lines

Workaround by overriding ARCH to the host arch, if ARCH is empty.

#3 lore raw
In reply to Björn Töpel
This patch was applied to bpf/bpf.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:

Quoted 11 lines · On Wed, 27 Nov 2024 11:17:46 +0100 you wrote:

From: Björn Töpel <[email protected]>

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.

Quoted 1 line

[...]

Here is the summary with links:
- [bpf,v2] tools: Override makefile ARCH variable if defined, but empty

    https://git.kernel.org/bpf/bpf/c/537a2525eaf7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw
In reply to Björn Töpel
This patch was applied to riscv/linux.git (fixes) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Daniel Borkmann <[email protected]>:

Quoted 11 lines · On Wed, 27 Nov 2024 11:17:46 +0100 you wrote:

From: Björn Töpel <[email protected]>

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.

Quoted 1 line

[...]

Here is the summary with links:
- [bpf,v2] tools: Override makefile ARCH variable if defined, but empty

    https://git.kernel.org/riscv/c/537a2525eaf7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html