[v1,19/22] selftests/nolibc: config default CROSS_COMPILE
Commit Message
This further simplify the 'make' commands, only require an ARCH now.
Almost all distributions provide toolchains for i386, x86_64, arm64,
arm, mips, riscv32, riscv64 and s390x.
If can not find toolchains from the distribution repositories, we can
download them from https://mirrors.edge.kernel.org/pub/tools/crosstool/
and then customize CROSS_COMPILE_<ARCH> for the testing.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/Makefile | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
@@ -74,6 +74,25 @@ EXTCONFIG_ARCH = $(EXTCONFIG_$(ARCH))
# extra kernel configs, include common + architecture specific
EXTCONFIG = $(EXTCONFIG_ARCH) $(EXTCONFIG_COMMON)
+# CROSS_COMPILE by architecture
+CROSS_COMPILE_i386 ?= x86_64-linux-gnu-
+CROSS_COMPILE_x86_64 ?= x86_64-linux-gnu-
+CROSS_COMPILE_x86 ?= x86_64-linux-gnu-
+CROSS_COMPILE_arm64 ?= aarch64-linux-gnu-
+CROSS_COMPILE_arm ?= arm-linux-gnueabi-
+CROSS_COMPILE_mips ?= mipsel-linux-gnu-
+CROSS_COMPILE_riscv32 ?= riscv64-linux-gnu-
+CROSS_COMPILE_riscv64 ?= riscv64-linux-gnu-
+CROSS_COMPILE_riscv ?= riscv64-linux-gnu-
+CROSS_COMPILE_s390 ?= s390x-linux-gnu-
+CROSS_COMPILE_loongarch ?= loongarch64-linux-
+CROSS_COMPILE ?= $(CROSS_COMPILE_$(ARCH))
+
+# Make sure CC has $(CROSS_COMPILE) prefix
+ifneq ($(CC),$(CROSS_COMPILE)$(CC))
+CC := $(CROSS_COMPILE)$(CC)
+endif
+
# optional tests to run (default = all)
TEST =