diff mbox series

[10/10] microblaze: use built-in function to get CPU_{MAJOR,MINOR,REV}

Message ID 20211212192941.1149247-11-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series kbuild: do not quote string values in Makefile | expand

Commit Message

Masahiro Yamada Dec. 12, 2021, 7:29 p.m. UTC
Use built-in functions instead of shell commands to avoid forking
processes.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/microblaze/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Nicolas Schier Dec. 13, 2021, 1:18 p.m. UTC | #1
On Mon, Dec 13, 2021 at 04:29:41AM +0900, Masahiro Yamada wrote:
> Use built-in functions instead of shell commands to avoid forking
> processes.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Reviewed-by: Nicolas Schier <n.schier@avm.de>

> 
>  arch/microblaze/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
> index a25e76d89e86..1826d9ce4459 100644
> --- a/arch/microblaze/Makefile
> +++ b/arch/microblaze/Makefile
> @@ -6,9 +6,9 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
>  # What CPU version are we building for, and crack it open
>  # as major.minor.rev
>  CPU_VER   := $(CONFIG_XILINX_MICROBLAZE0_HW_VER)
> -CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
> -CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
> -CPU_REV   := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
> +CPU_MAJOR := $(word 1, $(subst ., , $(CPU_VER)))
> +CPU_MINOR := $(word 2, $(subst ., , $(CPU_VER)))
> +CPU_REV   := $(word 3, $(subst ., , $(CPU_VER)))
>  
>  export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
>  
> -- 
> 2.32.0
>
diff mbox series

Patch

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index a25e76d89e86..1826d9ce4459 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -6,9 +6,9 @@  UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
 # What CPU version are we building for, and crack it open
 # as major.minor.rev
 CPU_VER   := $(CONFIG_XILINX_MICROBLAZE0_HW_VER)
-CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
-CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
-CPU_REV   := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
+CPU_MAJOR := $(word 1, $(subst ., , $(CPU_VER)))
+CPU_MINOR := $(word 2, $(subst ., , $(CPU_VER)))
+CPU_REV   := $(word 3, $(subst ., , $(CPU_VER)))
 
 export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV