The string returned by $(filter-out ...) does not contain any leading or trailing spaces. With the previous commit, 'any-prereq' no longer contains any excessive spaces. Nor does 'cmd-check' since it expands to a $(filter-out ...) call. So, only the space that matters is the one between 'any-prereq' and 'cmd-check'. By removing it from the code, we can save $(strip ...) evaluation. This refactoring is possible because $(any-prereq)$(cmd-check) is only passed to the first argument of $(if ...), so we are only interested in whether or not it is empty.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -228,12 +228,12 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))) · 227 unmodified lines | ||
| 228 | 228 | any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^) |
| 229 | 229 | |
| 230 | 230 | # Execute command if command has changed or prerequisite(s) are updated. |
| 231 | −if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \ | |
| 231 | +if_changed = $(if $(any-prereq)$(cmd-check), \ | |
| 232 | 232 | $(cmd); \ |
| 233 | 233 | printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) |
| 234 | 234 | |
| 235 | 235 | # Execute the command and also postprocess generated .d dependencies file. |
| 236 | −if_changed_dep = $(if $(strip $(any-prereq) $(cmd-check)),$(cmd_and_fixdep),@:) | |
| 236 | +if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:) | |
| 237 | 237 | |
| 238 | 238 | cmd_and_fixdep = \ |
| 239 | 239 | $(cmd); \ |
| @@ -243,7 +243,7 @@ cmd_and_fixdep = \ · 3 unmodified lines | ||
| 243 | 243 | # Usage: $(call if_changed_rule,foo) |
| 244 | 244 | # Will check if $(cmd_foo) or any of the prerequisites changed, |
| 245 | 245 | # and if so will execute $(rule_foo). |
| 246 | −if_changed_rule = $(if $(strip $(any-prereq) $(cmd-check)),$(rule_$(1)),@:) | |
| 246 | +if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:) | |
| 247 | 247 | |
| 248 | 248 | ### |
| 249 | 249 | # why - tell why a target got built |