diff mbox series

usr: shorten cmd_initfs in Makefile

Message ID 20240531122825.699771-1-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series usr: shorten cmd_initfs in Makefile | expand

Commit Message

Masahiro Yamada May 31, 2024, 12:28 p.m. UTC
Avoid repetition of long variables.

No functional change intended.

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

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

Comments

Nathan Chancellor June 3, 2024, 10:24 p.m. UTC | #1
On Fri, May 31, 2024 at 09:28:25PM +0900, Masahiro Yamada wrote:
> Avoid repetition of long variables.
> 
> No functional change intended.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  usr/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/usr/Makefile b/usr/Makefile
> index 132ef7e96e6d..75224d927025 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -62,9 +62,9 @@ $(deps_initramfs): ;
>  quiet_cmd_initfs = GEN     $@
>        cmd_initfs = \
>  	$(CONFIG_SHELL) $< -o $@ -l $(obj)/.initramfs_data.cpio.d \
> -	$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
> -	$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
> -	$(if $(KBUILD_BUILD_TIMESTAMP), -d "$(KBUILD_BUILD_TIMESTAMP)") \
> +	$(addprefix -u , $(CONFIG_INITRAMFS_ROOT_UID)) \
> +	$(addprefix -g , $(CONFIG_INITRAMFS_ROOT_GID)) \
> +	$(patsubst %,-d "%", $(KBUILD_BUILD_TIMESTAMP)) \
>  	$(ramfs-input)
>  
>  # We rebuild initramfs_data.cpio if:
> -- 
> 2.40.1
>
Masahiro Yamada July 16, 2024, 8:52 a.m. UTC | #2
On Fri, May 31, 2024 at 9:28 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Avoid repetition of long variables.
>
> No functional change intended.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  usr/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/usr/Makefile b/usr/Makefile
> index 132ef7e96e6d..75224d927025 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -62,9 +62,9 @@ $(deps_initramfs): ;
>  quiet_cmd_initfs = GEN     $@
>        cmd_initfs = \
>         $(CONFIG_SHELL) $< -o $@ -l $(obj)/.initramfs_data.cpio.d \
> -       $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
> -       $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
> -       $(if $(KBUILD_BUILD_TIMESTAMP), -d "$(KBUILD_BUILD_TIMESTAMP)") \
> +       $(addprefix -u , $(CONFIG_INITRAMFS_ROOT_UID)) \
> +       $(addprefix -g , $(CONFIG_INITRAMFS_ROOT_GID)) \
> +       $(patsubst %,-d "%", $(KBUILD_BUILD_TIMESTAMP)) \


I dropped the last line because it will not work
when $(KBUILD_BUILD_TIMESTAMP) contains a space.





>         $(ramfs-input)
>
>  # We rebuild initramfs_data.cpio if:
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/usr/Makefile b/usr/Makefile
index 132ef7e96e6d..75224d927025 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -62,9 +62,9 @@  $(deps_initramfs): ;
 quiet_cmd_initfs = GEN     $@
       cmd_initfs = \
 	$(CONFIG_SHELL) $< -o $@ -l $(obj)/.initramfs_data.cpio.d \
-	$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
-	$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
-	$(if $(KBUILD_BUILD_TIMESTAMP), -d "$(KBUILD_BUILD_TIMESTAMP)") \
+	$(addprefix -u , $(CONFIG_INITRAMFS_ROOT_UID)) \
+	$(addprefix -g , $(CONFIG_INITRAMFS_ROOT_GID)) \
+	$(patsubst %,-d "%", $(KBUILD_BUILD_TIMESTAMP)) \
 	$(ramfs-input)
 
 # We rebuild initramfs_data.cpio if: