--- zzzz-none-000/linux-4.9.276/scripts/Kbuild.include 2021-07-20 14:21:16.000000000 +0000 +++ falcon-5530-750/linux-4.9.276/scripts/Kbuild.include 2023-04-05 08:19:02.000000000 +0000 @@ -54,6 +54,7 @@ # - stdin is piped in from the first prerequisite ($<) so one has # to specify a valid file as first prerequisite (often the kbuild file) define filechk + $(check-FORCE) $(Q)set -e; \ $(kecho) ' CHK $@'; \ mkdir -p $(dir $@); \ @@ -258,19 +259,28 @@ # (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),$?) + +# It is a typical mistake to forget the FORCE prerequisite. Check it here so +# no more breakage will slip in. +check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)) + +if-changed-cond = $(newer-prereqs)$(arg-check)$(check-FORCE) # Execute command if command has changed or prerequisite(s) are updated. # -if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ +if_changed = $(if $(if-changed-cond), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. -if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ +if_changed_dep = $(if $(if-changed-cond), \ @set -e; \ $(cmd_and_fixdep), @:) @@ -312,7 +322,7 @@ # 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 $(strip $(any-prereq) $(arg-check) ), \ +if_changed_rule = $(if $(if-changed-cond), \ @set -e; \ $(rule_$(1)), @:) @@ -339,7 +349,7 @@ why = \ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ $(if $(wildcard $@), \ - $(if $(strip $(any-prereq)),- due to: $(any-prereq), \ + $(if $(newer-prereqs),- due to: $(newer-prereqs), \ $(if $(arg-check), \ $(if $(cmd_$@),- due to command line change, \ $(if $(filter $@, $(targets)), \