From 9e98e444a5794b75c636a3c4c323a565bd5a918e Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 8 Aug 2006 21:35:14 +0200 Subject: [PATCH] --- yaml --- r: 35442 b: refs/heads/master c: 45d506bd65e2e35881d8276c111b647807823d19 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Makefile | 1 + trunk/scripts/Kbuild.include | 41 +++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index f0b37bf7c457..e7e56bd61610 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 12715d20af9fd9179daca7a1cd2cf3db3c2c494f +refs/heads/master: 45d506bd65e2e35881d8276c111b647807823d19 diff --git a/trunk/Makefile b/trunk/Makefile index 22451c2ac1e0..440a1331d883 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1101,6 +1101,7 @@ help: 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 O=dir [targets] Locate all output files in "dir", including .config' @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' @echo ' make C=2 [targets] Force check of all c source with $$CHECK' diff --git a/trunk/scripts/Kbuild.include b/trunk/scripts/Kbuild.include index 1d6ffb26e20f..3d523899fdc0 100644 --- a/trunk/scripts/Kbuild.include +++ b/trunk/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