diff mbox series

[v2,10/14] selftests/nolibc: allow customize CROSS_COMPILE by architecture

Message ID 39df39b4023831b796a1b21c7e31f4be0b432416.1689759351.git.falcon@tinylab.org (mailing list archive)
State New
Headers show
Series selftests/nolibc: add minimal kernel config support - part1 | expand

Commit Message

Zhangjin Wu July 19, 2023, 1:28 p.m. UTC
Some cross compilers may not just be prefixed with ARCH or XARCH,
customize them by architecture may easier the test a lot, especially,
when iterate with XARCH or ARCH.

After customizing this for every architecture, the minimal test argument
will be architecture itself, no CROSS_COMPILE will be passed.

If the installed cross compiler is not the same as the one customized,
we can also pass CROSS_COMPILE from command line as before, no
regression.

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

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index a03fab020ebe..3c2be27747ea 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -42,6 +42,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 sure CC is prefixed with CROSS_COMPILE
+$(call allow-override,CC,$(CROSS_COMPILE)gcc)
+
 # default kernel configurations that appear to be usable
 DEFCONFIG_i386       = defconfig
 DEFCONFIG_x86_64     = defconfig