diff mbox series

[v3,1/5] tools: arm64: Add a Makefile for generating sysreg-defs.h

Message ID 20231011195740.3349631-2-oliver.upton@linux.dev (mailing list archive)
State New, archived
Headers show
Series KVM: selftests: Add ID reg test, update headers | expand

Commit Message

Oliver Upton Oct. 11, 2023, 7:57 p.m. UTC
Use a common Makefile for generating sysreg-defs.h, which will soon be
needed by perf and KVM selftests. The naming scheme of the generated
macros is not expected to change, so just refer to the canonical
script/data in the kernel source rather than copying to tools.

Co-developed-by: Jing Zhang <jingzhangos@google.com>
Signed-off-by: Jing Zhang <jingzhangos@google.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 tools/arch/arm64/include/.gitignore |  1 +
 tools/arch/arm64/tools/Makefile     | 38 +++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 tools/arch/arm64/include/.gitignore
 create mode 100644 tools/arch/arm64/tools/Makefile

Comments

Eric Auger Oct. 18, 2023, 9:50 a.m. UTC | #1
Hi Oliver,

On 10/11/23 21:57, Oliver Upton wrote:
> Use a common Makefile for generating sysreg-defs.h, which will soon be
> needed by perf and KVM selftests. The naming scheme of the generated
> macros is not expected to change, so just refer to the canonical
> script/data in the kernel source rather than copying to tools.
> 
> Co-developed-by: Jing Zhang <jingzhangos@google.com>
> Signed-off-by: Jing Zhang <jingzhangos@google.com>
> Reviewed-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Eric
> ---
>  tools/arch/arm64/include/.gitignore |  1 +
>  tools/arch/arm64/tools/Makefile     | 38 +++++++++++++++++++++++++++++
>  2 files changed, 39 insertions(+)
>  create mode 100644 tools/arch/arm64/include/.gitignore
>  create mode 100644 tools/arch/arm64/tools/Makefile
> 
> diff --git a/tools/arch/arm64/include/.gitignore b/tools/arch/arm64/include/.gitignore
> new file mode 100644
> index 000000000000..9ab870da897d
> --- /dev/null
> +++ b/tools/arch/arm64/include/.gitignore
> @@ -0,0 +1 @@
> +generated/
> diff --git a/tools/arch/arm64/tools/Makefile b/tools/arch/arm64/tools/Makefile
> new file mode 100644
> index 000000000000..f867e6036c62
> --- /dev/null
> +++ b/tools/arch/arm64/tools/Makefile
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +ifeq ($(srctree),)
> +srctree := $(patsubst %/,%,$(dir $(CURDIR)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +srctree := $(patsubst %/,%,$(dir $(srctree)))
> +endif
> +
> +include $(srctree)/tools/scripts/Makefile.include
> +
> +AWK	?= awk
> +MKDIR	?= mkdir
> +RM	?= rm
> +
> +ifeq ($(V),1)
> +Q =
> +else
> +Q = @
> +endif
> +
> +arm64_tools_dir = $(srctree)/arch/arm64/tools
> +arm64_sysreg_tbl = $(arm64_tools_dir)/sysreg
> +arm64_gen_sysreg = $(arm64_tools_dir)/gen-sysreg.awk
> +arm64_generated_dir = $(srctree)/tools/arch/arm64/include/generated
> +arm64_sysreg_defs = $(arm64_generated_dir)/asm/sysreg-defs.h
> +
> +all: $(arm64_sysreg_defs)
> +	@:
> +
> +$(arm64_sysreg_defs): $(arm64_gen_sysreg) $(arm64_sysreg_tbl)
> +	$(Q)$(MKDIR) -p $(dir $@)
> +	$(QUIET_GEN)$(AWK) -f $^ > $@
> +
> +clean:
> +	$(Q)$(RM) -rf $(arm64_generated_dir)
> +
> +.PHONY: all clean
diff mbox series

Patch

diff --git a/tools/arch/arm64/include/.gitignore b/tools/arch/arm64/include/.gitignore
new file mode 100644
index 000000000000..9ab870da897d
--- /dev/null
+++ b/tools/arch/arm64/include/.gitignore
@@ -0,0 +1 @@ 
+generated/
diff --git a/tools/arch/arm64/tools/Makefile b/tools/arch/arm64/tools/Makefile
new file mode 100644
index 000000000000..f867e6036c62
--- /dev/null
+++ b/tools/arch/arm64/tools/Makefile
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: GPL-2.0
+
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+endif
+
+include $(srctree)/tools/scripts/Makefile.include
+
+AWK	?= awk
+MKDIR	?= mkdir
+RM	?= rm
+
+ifeq ($(V),1)
+Q =
+else
+Q = @
+endif
+
+arm64_tools_dir = $(srctree)/arch/arm64/tools
+arm64_sysreg_tbl = $(arm64_tools_dir)/sysreg
+arm64_gen_sysreg = $(arm64_tools_dir)/gen-sysreg.awk
+arm64_generated_dir = $(srctree)/tools/arch/arm64/include/generated
+arm64_sysreg_defs = $(arm64_generated_dir)/asm/sysreg-defs.h
+
+all: $(arm64_sysreg_defs)
+	@:
+
+$(arm64_sysreg_defs): $(arm64_gen_sysreg) $(arm64_sysreg_tbl)
+	$(Q)$(MKDIR) -p $(dir $@)
+	$(QUIET_GEN)$(AWK) -f $^ > $@
+
+clean:
+	$(Q)$(RM) -rf $(arm64_generated_dir)
+
+.PHONY: all clean