kbuild: allow to combine multiple V= levels

Commit a6de553da0 ("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>
Tested-by: Nicolas Schier <nicolas@fjasle.eu>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
This commit is contained in:
Masahiro Yamada 2022-12-23 01:25:34 +09:00
parent c0d3b83100
commit 6ae4b9868a
4 changed files with 13 additions and 13 deletions

View File

@ -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
@ -1775,8 +1774,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)'

View File

@ -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 =

View File

@ -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 $@), \

View File

@ -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