Subject: bug#20077: Allow more V= values for verbose output

From: Bogdan <[email-masked]>
Date: Sat, 31 Dec 2022 20:21:00 +0100

Hello, Automakers!

My last patch for now, this time for 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20077:

- if $(V) is empty, use default verbosity,
- if $(V) = 0, be silent,
- if $(V) is neither empty nor 0, be verbose (not only with V=1, but 
e.g. V=99).

Yes, requires some shell, but just like other stuff.

Note that this just switches verbosity off and on, doesn't pay any 
attention if the user would want e.g. more verbosity with V=99 than 
with V=1.

Regards,
Bogdan Drozdowski

-- 
Regards - Bogdan ('bogdro') D.                 (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux):    http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft  http://bogdro.evai.pl/soft4asm
www.Xiph.org  www.TorProject.org  www.LibreOffice.org  www.GnuPG.org

From 6dd37c02408364350c4bb4b63705e1975d035eef Mon Sep 17 00:00:00 2001
From: Bogdan Drozdowski <>
Date: Sat, 31 Dec 2022 20:17:35 +0100
Subject: [PATCH] Allow other V values for verbosity

---
 m4/silent.m4    |  2 +-
 t/silent-gen.sh | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/m4/silent.m4 b/m4/silent.m4
index d19c56e8a..a27ccc44b 100644
--- a/m4/silent.m4
+++ b/m4/silent.m4
@@ -53,7 +53,7 @@ case $enable_silent_rules in @%:@ (((
 esac
 if test $am_cv_make_support_nested_variables = yes; then
   dnl Using '$V' instead of '$(V)' breaks IRIX make.
-  AM_V='$(V)'
+  AM_V='$(shell if ( test "x$(V)" = "x0" ); then echo 0; elif ( test "x$(V)" = "x" ); then echo $(AM_DEFAULT_VERBOSITY); else echo 1; fi)'
   AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
 else
   AM_V=$AM_DEFAULT_VERBOSITY
diff --git a/t/silent-gen.sh b/t/silent-gen.sh
index 1e2c588c7..e14d4b138 100644
--- a/t/silent-gen.sh
+++ b/t/silent-gen.sh
@@ -53,6 +53,18 @@ grep 'GEN ' stdout && exit 1
 grep 'cp ' stdout
 grep 'echo ' stdout
 
+$MAKE clean
+run_make -O V=99
+grep 'GEN ' stdout && exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
+$MAKE clean
+run_make -O V=vvv
+grep 'GEN ' stdout && exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
 $MAKE clean
 run_make -O V=0
 grep 'GEN .*foo' stdout
@@ -79,4 +91,16 @@ grep 'GEN ' stdout && exit 1
 grep 'cp ' stdout
 grep 'echo ' stdout
 
+$MAKE clean
+run_make -O V=99
+grep 'GEN ' stdout && exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
+$MAKE clean
+run_make -O V=v
+grep 'GEN ' stdout && exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
+
 :
-- 
2.35.1