public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vipin Sharma <vipinsh@google.com>,
	x86@kernel.org
Subject: [PATCH 4/5] kbuild: allow to combine multiple V= levels
Date: Fri, 23 Dec 2022 01:25:34 +0900	[thread overview]
Message-ID: <20221222162535.1578462-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20221222162535.1578462-1-masahiroy@kernel.org>

Commit a6de553da01c ("kbuild: Allow to combine multiple W= levels")
supported W=123 to enable all the extra warning groups.

I think a similar idea is applicable to the V= option.

  V=1 echos the whole command
  V=2 prints the reason for rebuilding

These are orthogonal, and can be enabled at the same time.

This commit supports V=12 to enable both of them.

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

 Makefile                | 18 +++++++++---------
 arch/x86/tools/Makefile |  2 +-
 scripts/Kbuild.include  |  4 ++--
 scripts/tags.sh         |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index ce98dfd8359a..bd69bf73a256 100644
--- a/Makefile
+++ b/Makefile
@@ -69,9 +69,8 @@ unexport GREP_OPTIONS
 #
 #    $(Q)$(MAKE) $(build)=scripts/basic
 #
-# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
-# If KBUILD_VERBOSE equals 1 then the above command is displayed.
-# If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt.
+# If KBUILD_VERBOSE contains 1, the whole command is echoed.
+# If KBUILD_VERBOSE contains 2, the reason for rebuilding is printed.
 #
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
@@ -83,12 +82,12 @@ ifndef KBUILD_VERBOSE
   KBUILD_VERBOSE = 0
 endif
 
-ifeq ($(KBUILD_VERBOSE),1)
+quiet = quiet_
+Q = @
+
+ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
   quiet =
   Q =
-else
-  quiet=quiet_
-  Q = @
 endif
 
 # If the user is running make -s (silent mode), suppress echoing of
@@ -1762,8 +1761,9 @@ help:
 		printf "  %-16s - Show all of the above\\n" help-boards; \
 		echo '')
 
-	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
-	@echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
+	@echo  '  make V=n   [targets] 0: quiet build (default), 1: verbose build'
+	@echo  '                       2: give reason for rebuild of target'
+	@echo  '                       V=1 and V=2 can be combined with V=12'
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check re-compiled c source with $$CHECK'
 	@echo  '                       (sparse by default)'
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index bddfc9a46645..90e820ac9771 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 PHONY += posttest
 
-ifeq ($(KBUILD_VERBOSE),1)
+ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
   posttest_verbose = -v
 else
   posttest_verbose =
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index faae3c7986b0..10cf8d2d82ef 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -132,7 +132,7 @@ clean := -f $(srctree)/scripts/Makefile.clean obj
 # If quiet is empty, print short log and whole command
 silent_log_print = exec >/dev/null;
  quiet_log_print = $(if $(quiet_cmd_$1), echo '  $(call escsq,$(quiet_cmd_$1)$(why))';)
-       log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@))'; \
+       log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@)$(why))'; \
                    echo '  $(call escsq,$(cmd_$1))';
 
 # Delete the target on interruption
@@ -233,7 +233,7 @@ if_changed_rule = $(if $(if-changed-cond),$(rule_$(1)),@:)
 # (5) No dir/.target.cmd file (used to store command line)
 # (6) No dir/.target.cmd file and target not listed in $(targets)
 #     This is a good hint that there is a bug in the kbuild file
-ifeq ($(KBUILD_VERBOSE),2)
+ifneq ($(findstring 2, $(KBUILD_VERBOSE)),)
 _why =                                                                        \
     $(if $(filter $@, $(PHONY)),- due to target is PHONY,                    \
         $(if $(wildcard $@),                                                 \
diff --git a/scripts/tags.sh b/scripts/tags.sh
index e137cf15aae9..2e756bee1fa9 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -8,7 +8,7 @@
 # Uses the following environment variables:
 # SUBARCH, SRCARCH, srctree
 
-if [ "$KBUILD_VERBOSE" = "1" ]; then
+if [[ "$KBUILD_VERBOSE" =~ 1 ]]; then
 	set -x
 fi
 
-- 
2.34.1


  parent reply	other threads:[~2022-12-22 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 16:25 [PATCH 1/5] kbuild: refactor silent mode detection Masahiro Yamada
2022-12-22 16:25 ` [PATCH 2/5] kbuild: print short log in addition to the whole command with V=1 Masahiro Yamada
2022-12-23 11:23   ` Nicolas Schier
2022-12-22 16:25 ` [PATCH 3/5] kbuild: do not print extra logs for V=2 Masahiro Yamada
2022-12-23 11:23   ` Nicolas Schier
2022-12-22 16:25 ` Masahiro Yamada [this message]
2022-12-23 11:23   ` [PATCH 4/5] kbuild: allow to combine multiple V= levels Nicolas Schier
2022-12-22 16:25 ` [PATCH 5/5] kbuild: drop V=0 support Masahiro Yamada
2022-12-23 11:24   ` Nicolas Schier
2022-12-22 17:51 ` [PATCH 1/5] kbuild: refactor silent mode detection Nick Desaulniers
2022-12-23 11:23 ` Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221222162535.1578462-4-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=bp@alien8.de \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=tglx@linutronix.de \
    --cc=vipinsh@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox