X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=scripts%2FKbuild.include;h=bc5f25763c1b9c8ee0b880ff02f753794040510a;hb=76bb8b05960c3d1668e6bee7624ed886cbd135ba;hp=10ba926ae29245976c7f716e3b17f6c5e56e989b;hpb=9ff7759731db1df8dfe036046d05c3f7ed1e37b0;p=linux.git diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 10ba926ae292..bc5f25763c1b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -210,17 +210,20 @@ endif # (needed for the shell) make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) -# Find any prerequisites that is newer than target or that does not exist. +# Find any prerequisites that are newer than target or that do not exist. +# (This is not true for now; $? should contain any non-existent prerequisites, +# but it does not work as expected when .SECONDARY is present. This seems a bug +# of GNU Make.) # PHONY targets skipped in both cases. -any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^) +newer-prereqs = $(filter-out $(PHONY),$?) # Execute command if command has changed or prerequisite(s) are updated. -if_changed = $(if $(any-prereq)$(cmd-check), \ +if_changed = $(if $(newer-prereqs)$(cmd-check), \ $(cmd); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. -if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:) +if_changed_dep = $(if $(newer-prereqs)$(cmd-check),$(cmd_and_fixdep),@:) cmd_and_fixdep = \ $(cmd); \ @@ -230,7 +233,7 @@ cmd_and_fixdep = \ # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, # and if so will execute $(rule_foo). -if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:) +if_changed_rule = $(if $(newer-prereqs)$(cmd-check),$(rule_$(1)),@:) ### # why - tell why a target got built @@ -255,7 +258,7 @@ ifeq ($(KBUILD_VERBOSE),2) why = \ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ $(if $(wildcard $@), \ - $(if $(any-prereq),- due to: $(any-prereq), \ + $(if $(newer-prereqs),- due to: $(newer-prereqs), \ $(if $(cmd-check), \ $(if $(cmd_$@),- due to command line change, \ $(if $(filter $@, $(targets)), \