diff mbox series

[RFC,11/11] kbuild: suppress echoing of commands in --dry-run mode

Message ID 20240819160309.2218114-12-vegard.nossum@oracle.com (mailing list archive)
State Handled Elsewhere
Headers show
Series output a valid shell script when running 'make -n' | expand

Commit Message

Vegard Nossum Aug. 19, 2024, 4:03 p.m. UTC
If the user ran 'make -n' then we will already print all commands.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Nicolas Schier Nov. 14, 2024, 10:49 a.m. UTC | #1
On Mon, Aug 19, 2024 at 06:03:08PM +0200, Vegard Nossum wrote:
> If the user ran 'make -n' then we will already print all commands.
> 
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  Makefile | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d08ade5791c2e..a1a3e96a10ea2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -96,9 +96,10 @@ ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
>    Q =
>  endif
>  
> -# If the user is running make -s (silent mode), suppress echoing of
> -# commands
> -ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),)
> +# If the user is running make -s (silent mode) or -n (dry run mode),
> +# suppress echoing of commands
> +ifneq (,$(or $(findstring s,$(firstword -$(MAKEFLAGS))), \
> +	$(findstring n,$(firstword -$(MAKEFLAGS)))))
>  quiet=silent_
>  override KBUILD_VERBOSE :=
>  endif
> -- 
> 2.34.1
> 

I think it makes sense to apply this patch earlier.

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index d08ade5791c2e..a1a3e96a10ea2 100644
--- a/Makefile
+++ b/Makefile
@@ -96,9 +96,10 @@  ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
   Q =
 endif
 
-# If the user is running make -s (silent mode), suppress echoing of
-# commands
-ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),)
+# If the user is running make -s (silent mode) or -n (dry run mode),
+# suppress echoing of commands
+ifneq (,$(or $(findstring s,$(firstword -$(MAKEFLAGS))), \
+	$(findstring n,$(firstword -$(MAKEFLAGS)))))
 quiet=silent_
 override KBUILD_VERBOSE :=
 endif