All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: w@1wt.eu
Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org,
	thomas@t-8ch.de
Subject: [PATCH v5 4/5] tools/nolibc: add kernel and nolibc specific ARCH variables
Date: Mon, 19 Jun 2023 20:28:23 +0800	[thread overview]
Message-ID: <be68f6023139b94152ae13f101caef8b4d671a3a.1687176996.git.falcon@tinylab.org> (raw)
In-Reply-To: <cover.1687176996.git.falcon@tinylab.org>

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 --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"
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Zhangjin Wu <falcon@tinylab.org>
To: w@1wt.eu
Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org,
	thomas@t-8ch.de
Subject: [PATCH v5 4/5] tools/nolibc: add kernel and nolibc specific ARCH variables
Date: Mon, 19 Jun 2023 20:28:23 +0800	[thread overview]
Message-ID: <be68f6023139b94152ae13f101caef8b4d671a3a.1687176996.git.falcon@tinylab.org> (raw)
In-Reply-To: <cover.1687176996.git.falcon@tinylab.org>

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 --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"
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2023-06-19 12:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 12:22 [PATCH v5 0/5] nolibc: add part2 of support for rv32 Zhangjin Wu
2023-06-19 12:22 ` Zhangjin Wu
2023-06-19 12:24 ` [PATCH v5 1/5] tools/nolibc: fix up #error compile failures with -ENOSYS Zhangjin Wu
2023-06-19 12:24   ` Zhangjin Wu
2023-07-02 16:51   ` Willy Tarreau
2023-07-02 16:51     ` Willy Tarreau
2023-06-19 12:25 ` [PATCH v5 2/5] tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS Zhangjin Wu
2023-06-19 12:25   ` Zhangjin Wu
2023-06-19 12:27 ` [PATCH v5 3/5] selftests/nolibc: allow customize kernel specific ARCH variable Zhangjin Wu
2023-06-19 12:27   ` Zhangjin Wu
2023-06-19 12:28 ` Zhangjin Wu [this message]
2023-06-19 12:28   ` [PATCH v5 4/5] tools/nolibc: add kernel and nolibc specific ARCH variables Zhangjin Wu
2023-06-19 12:29 ` [PATCH v5 5/5] selftests/nolibc: riscv: customize makefile for rv32 Zhangjin Wu
2023-06-19 12:29   ` Zhangjin Wu
2023-07-02 17:17   ` Willy Tarreau
2023-07-02 17:17     ` Willy Tarreau
2023-07-03 15:51     ` Zhangjin Wu
2023-07-03 15:51       ` Zhangjin Wu
2023-07-02 17:19 ` [PATCH v5 0/5] nolibc: add part2 of support " Willy Tarreau
2023-07-02 17:19   ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be68f6023139b94152ae13f101caef8b4d671a3a.1687176996.git.falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.