aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2006-03-05 17:14:10 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2006-03-05 18:09:51 -0500
commit4f1933620f57145212cdbb1ac6ce099eeeb21c5a (patch)
treec083cce1f0acedd92be2ac6eb5e6c49ebd84ac46 /scripts/Kbuild.include
parent7b75b13cda8bd21e8636ea985f76e1ce5bd1a470 (diff)
kbuild: change kbuild to not rely on incorrect GNU make behavior
The kbuild system takes advantage of an incorrect behavior in GNU make. Once this behavior is fixed, all files in the kernel rebuild every time, even if nothing has changed. This patch ensures kbuild works with both the incorrect and correct behaviors of GNU make. For more details on the incorrect behavior, see: http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html Changes in this patch: - Keep all targets that are to be marked .PHONY in a variable, PHONY. - Add .PHONY: $(PHONY) to mark them properly. - Remove any $(PHONY) files from the $? list when determining whether targets are up-to-date or not. Signed-off-by: Paul Smith <psmith@gnu.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index c3d2e4e068c4..59620b1554e0 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -116,16 +116,18 @@ make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))
116# function to only execute the passed command if necessary 116# function to only execute the passed command if necessary
117# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file 117# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
118# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars 118# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
119# 119#
120if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ 120if_changed = $(if $(strip $(filter-out $(PHONY),$?) \
121 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
121 @set -e; \ 122 @set -e; \
122 $(echo-cmd) $(cmd_$(1)); \ 123 $(echo-cmd) $(cmd_$(1)); \
123 echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd) 124 echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd)
124 125
125# execute the command and also postprocess generated .d dependencies 126# execute the command and also postprocess generated .d dependencies
126# file 127# file
127if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ 128if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \
128 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ 129 $(filter-out FORCE $(wildcard $^),$^) \
130 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
129 @set -e; \ 131 @set -e; \
130 $(echo-cmd) $(cmd_$(1)); \ 132 $(echo-cmd) $(cmd_$(1)); \
131 scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \ 133 scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \
@@ -135,6 +137,7 @@ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
135# Usage: $(call if_changed_rule,foo) 137# Usage: $(call if_changed_rule,foo)
136# will check if $(cmd_foo) changed, or any of the prequisites changed, 138# will check if $(cmd_foo) changed, or any of the prequisites changed,
137# and if so will execute $(rule_foo) 139# and if so will execute $(rule_foo)
138if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ 140if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \
141 $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
139 @set -e; \ 142 @set -e; \
140 $(rule_$(1))) 143 $(rule_$(1)))