aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--scripts/Kbuild.include41
2 files changed, 41 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 22451c2ac1e0..440a1331d883 100644
--- a/Makefile
+++ b/Makefile
@@ -1101,6 +1101,7 @@ help:
1101 echo '') 1101 echo '')
1102 1102
1103 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' 1103 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
1104 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
1104 @echo ' make O=dir [targets] Locate all output files in "dir", including .config' 1105 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1105 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' 1106 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
1106 @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1107 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 1d6ffb26e20f..3d523899fdc0 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -129,7 +129,7 @@ endif
129 129
130# echo command. Short version is $(quiet) equals quiet, otherwise full command 130# echo command. Short version is $(quiet) equals quiet, otherwise full command
131echo-cmd = $(if $($(quiet)cmd_$(1)), \ 131echo-cmd = $(if $($(quiet)cmd_$(1)), \
132 echo ' $(call escsq,$($(quiet)cmd_$(1)))';) 132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
133 133
134# >'< substitution is for echo to work, 134# >'< substitution is for echo to work,
135# >$< substitution to preserve $ when reloading .cmd file 135# >$< substitution to preserve $ when reloading .cmd file
@@ -164,3 +164,42 @@ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
164 @set -e; \ 164 @set -e; \
165 $(rule_$(1))) 165 $(rule_$(1)))
166 166
167###
168# why - tell why a a target got build
169# enabled by make V=2
170# Output (listed in the order they are checked):
171# (1) - due to target is PHONY
172# (2) - due to target missing
173# (3) - due to: file1.h file2.h
174# (4) - due to command line change
175# (5) - due to missing .cmd file
176# (6) - due to target not in $(targets)
177# (1) PHONY targets are always build
178# (2) No target, so we better build it
179# (3) Prerequisite is newer than target
180# (4) The command line stored in the file named dir/.target.cmd
181# differed from actual command line. This happens when compiler
182# options changes
183# (5) No dir/.target.cmd file (used to store command line)
184# (6) No dir/.target.cmd file and target not listed in $(targets)
185# This is a good hint that there is a bug in the kbuild file
186ifeq ($(KBUILD_VERBOSE),2)
187why = \
188 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
189 $(if $(wildcard $@), \
190 $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
191 $(if $(arg-check), \
192 $(if $(cmd_$@),- due to command line change, \
193 $(if $(filter $@, $(targets)), \
194 - due to missing .cmd file, \
195 - due to $(notdir $@) not in $$(targets) \
196 ) \
197 ) \
198 ) \
199 ), \
200 - due to target missing \
201 ) \
202 )
203
204echo-why = $(call escsq, $(strip $(why)))
205endif