diff mbox series

[v2,4/7] selftests/nolibc: allow customize CROSS_COMPILE by architecture

Message ID 3526b34a6ba674c978015a0e3a106e47dd524930.1691783604.git.falcon@tinylab.org
State New
Headers show
Series selftests/nolibc: customize CROSS_COMPILE for all supported architectures | expand

Commit Message

Zhangjin Wu Aug. 11, 2023, 8:31 p.m. UTC
Some cross compilers are not just prefixed with XARCH, customize them by
architecture may simplify the test a lot, especially, when iterate with
XARCH.

After customizing this for every architecture or its variant, the
minimal test argument will be architecture or variant itself, no
CROSS_COMPILE required to be passed.

If the prefix of installed cross compiler is not the same as the one
customized, we can also pass CROSS_COMPILE as before or even pass
CROSS_COMPILE_$(XARCH) and CC from command line.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/testing/selftests/nolibc/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 91ccfc27780f..5aff60d31d72 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -1,6 +1,5 @@ 
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for nolibc tests
-include ../../../scripts/Makefile.include
 # We need this for the "cc-option" macro.
 include ../../../build/Build.include
 
@@ -55,6 +54,12 @@  IMAGE_loongarch  = arch/loongarch/boot/vmlinuz.efi
 IMAGE            = $(IMAGE_$(XARCH))
 IMAGE_NAME       = $(notdir $(IMAGE))
 
+# CROSS_COMPILE: cross toolchain prefix by architecture
+CROSS_COMPILE           ?= $(CROSS_COMPILE_$(XARCH))
+
+# Make CC is always prefixed with $(CROSS_COMPILE)
+include ../../../scripts/Makefile.include
+
 # default kernel configurations that appear to be usable
 DEFCONFIG_i386       = defconfig
 DEFCONFIG_x86_64     = defconfig