summaryrefslogtreecommitdiff
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-08-08 23:35:14 +0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-25 11:01:49 +0400
commit45d506bd65e2e35881d8276c111b647807823d19 (patch)
tree8f53e4e58165fc2c7f62e17b31dfb77ef43d7dfc /scripts/Kbuild.include
parent12715d20af9fd9179daca7a1cd2cf3db3c2c494f (diff)
downloadlinux-45d506bd65e2e35881d8276c111b647807823d19.tar.xz
kbuild: make V=2 tell why a target is rebuild
tell why a a target got build enabled by make V=2 Output (listed in the order they are checked): (1) - due to target is PHONY (2) - due to target missing (3) - due to: file1.h file2.h (4) - due to command line change (5) - due to missing .cmd file (6) - due to target not in $(targets) (1) We always build PHONY targets (2) No target, so we better build it (3) Prerequisite is newer than target (4) The command line stored in the file named dir/.target.cmd differed from actual command line. This happens when compiler options changes (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 This patch is inspired by a patch from: Milton Miller <miltonm@bga.com> Cc: Milton Miller <miltonm@bga.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include41
1 files changed, 40 insertions, 1 deletions
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
# echo command. Short version is $(quiet) equals quiet, otherwise full command
echo-cmd = $(if $($(quiet)cmd_$(1)), \
- echo ' $(call escsq,$($(quiet)cmd_$(1)))';)
+ echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
# >'< substitution is for echo to work,
# >$< substitution to preserve $ when reloading .cmd file
@@ -164,3 +164,42 @@ if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
@set -e; \
$(rule_$(1)))
+###
+# why - tell why a a target got build
+# enabled by make V=2
+# Output (listed in the order they are checked):
+# (1) - due to target is PHONY
+# (2) - due to target missing
+# (3) - due to: file1.h file2.h
+# (4) - due to command line change
+# (5) - due to missing .cmd file
+# (6) - due to target not in $(targets)
+# (1) PHONY targets are always build
+# (2) No target, so we better build it
+# (3) Prerequisite is newer than target
+# (4) The command line stored in the file named dir/.target.cmd
+# differed from actual command line. This happens when compiler
+# options changes
+# (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)
+why = \
+ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
+ $(if $(wildcard $@), \
+ $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
+ $(if $(arg-check), \
+ $(if $(cmd_$@),- due to command line change, \
+ $(if $(filter $@, $(targets)), \
+ - due to missing .cmd file, \
+ - due to $(notdir $@) not in $$(targets) \
+ ) \
+ ) \
+ ) \
+ ), \
+ - due to target missing \
+ ) \
+ )
+
+echo-why = $(call escsq, $(strip $(why)))
+endif