History

kbuild: print short log in addition to the whole command with V=1

"make V=1" prints the whole command instead of the short log, but I think it is nicer to print both so that you can easily spot the build rule of your interest. This commit changes V=1 to print the short log (the line starts with '#'), followed by the full log. In parallel builds, the short/full logs from the same build rule may be interspersed. If you want to avoid it, please add -Otarget option. Kbuild will never set it by default because Make would buffer the logs and lose the escape sequences. (Modern compilers print warnings and errors in color, but only when they write to a terminal.) This is also a preparation for supporting V=12 because V=2 appends the reason for rebuilding to the short log.

Masahiro Yamada committed 3 years ago

Commit 8962b6b1 parent fc5d57a2 files · +20 −24Browse files

Showing the changes to scripts (1 of 2 files). Show all

Unified · Split

scripts/Kbuild.include+13−13
@@ -125,15 +125,15 @@ dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj · 124 unmodified lines
125# $(Q)$(MAKE) $(clean)=dir125# $(Q)$(MAKE) $(clean)=dir
126clean := -f $(srctree)/scripts/Makefile.clean obj126clean := -f $(srctree)/scripts/Makefile.clean obj
127 127
128# echo command.128# pring log
129# Short version is used, if $(quiet) equals `quiet_', otherwise full one.129#
130echo-cmd = $(if $($(quiet)cmd_$(1)),\130# If quiet is "silent_", print nothing and sink stdout
131 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)131# If quiet is "quiet_", print short log
132 132# If quiet is empty, print short log and whole command
133# sink stdout for 'make -s'133silent_log_print = exec >/dev/null;
134 redirect :=134 quiet_log_print = $(if $(quiet_cmd_$1), echo ' $(call escsq,$(quiet_cmd_$1)$(why))';)
135 quiet_redirect :=135 log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@))'; \
136silent_redirect := exec >/dev/null;136 echo ' $(call escsq,$(cmd_$1))';
137 137
138# Delete the target on interruption138# Delete the target on interruption
139#139#
@@ -156,8 +156,8 @@ delete-on-interrupt = \ · 16 unmodified lines
156 $(foreach sig, HUP INT QUIT TERM PIPE, \156 $(foreach sig, HUP INT QUIT TERM PIPE, \
157 trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))157 trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
158 158
159# printing commands159# print and execute commands
160cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1))160cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:)
161 161
162###162###
163# if_changed - execute command if any prerequisite is newer than163# if_changed - execute command if any prerequisite is newer than
@@ -234,7 +234,7 @@ if_changed_rule = $(if $(if-changed-cond),$(rule_$(1)),@:) · 70 unmodified lines
234# (6) No dir/.target.cmd file and target not listed in $(targets)234# (6) No dir/.target.cmd file and target not listed in $(targets)
235# This is a good hint that there is a bug in the kbuild file235# This is a good hint that there is a bug in the kbuild file
236ifeq ($(KBUILD_VERBOSE),2)236ifeq ($(KBUILD_VERBOSE),2)
237why = \237_why = \
238 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \238 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
239 $(if $(wildcard $@), \239 $(if $(wildcard $@), \
240 $(if $(newer-prereqs),- due to: $(newer-prereqs), \240 $(if $(newer-prereqs),- due to: $(newer-prereqs), \
@@ -251,7 +251,7 @@ why = \ · 10 unmodified lines
251 ) \251 ) \
252 )252 )
253 253
254echo-why = $(call escsq, $(strip $(why)))254why = $(space)$(strip $(_why))
255endif255endif
256 256
257###############################################################################257###############################################################################

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t