diff mbox series

[v5,4/5] tools/nolibc: add kernel and nolibc specific ARCH variables

Message ID be68f6023139b94152ae13f101caef8b4d671a3a.1687176996.git.falcon@tinylab.org
State New
Headers show
Series [v5,1/5] tools/nolibc: fix up #error compile failures with -ENOSYS | expand

Commit Message

Zhangjin Wu June 19, 2023, 12:28 p.m. UTC
Like the KARCH added for tools/testing/selftests/nolibc/Makefile, adds
KARCH for tools/include/nolibc/Makefile too, at the same time, adds
NARCH for the ARCH supported by nolibc (arch-<NARCH>.h).

It allows users to customize both kernel and nolibc specific ARCH
variables for different architectures and their variants easily.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/include/nolibc/Makefile | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 64d67b080744..14a6416fa57f 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -23,8 +23,14 @@  else
 Q=@
 endif
 
-nolibc_arch := $(patsubst arm64,aarch64,$(ARCH))
-arch_file := arch-$(nolibc_arch).h
+# kernel supported ARCH names by architecture
+KARCH            = $(or $(KARCH_$(ARCH)),$(ARCH))
+
+# nolibc supported ARCH names by architecture
+NARCH_arm64      = aarch64
+NARCH            = $(or $(NARCH_$(ARCH)),$(ARCH))
+
+arch_file := arch-$(NARCH).h
 all_files := \
 		compiler.h \
 		ctype.h \
@@ -83,8 +89,8 @@  headers:
 	fi > $(OUTPUT)sysroot/include/arch.h
 
 headers_standalone: headers
-	$(Q)$(MAKE) -C $(srctree) headers
-	$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
+	$(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) headers
+	$(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
 
 clean:
 	$(call QUIET_CLEAN, nolibc) rm -rf "$(OUTPUT)sysroot"