kbuild: save $(strip ...) for calling any-prepreq

The string returned by $(filter-out ...) does not contain any leading
or trailing spaces.

So, only the space that matters is the one between

  $(filter-out $(PHONY),$?)

and

  $(filter-out $(PHONY) $(wildcard $^),$^)

By removing it from the code, we can save $(strip ...) evaluation.
This refactoring is possible because $(any-prereq) is only passed to
the first argument of $(if ...), so we are only interested in whether
or not it is empty.

This is also the prerequisite for the next commit.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2019-06-23 01:07:04 +09:00
parent 50bcca6ac4
commit 93f31bbda4
1 changed files with 2 additions and 2 deletions

View File

@ -225,7 +225,7 @@ 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 is newer than target or that does not exist.
# PHONY targets skipped in both cases. # PHONY targets skipped in both cases.
any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^)
# Execute command if command has changed or prerequisite(s) are updated. # Execute command if command has changed or prerequisite(s) are updated.
if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \ if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \
@ -268,7 +268,7 @@ ifeq ($(KBUILD_VERBOSE),2)
why = \ why = \
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
$(if $(wildcard $@), \ $(if $(wildcard $@), \
$(if $(strip $(any-prereq)),- due to: $(any-prereq), \ $(if $(any-prereq),- due to: $(any-prereq), \
$(if $(cmd-check), \ $(if $(cmd-check), \
$(if $(cmd_$@),- due to command line change, \ $(if $(cmd_$@),- due to command line change, \
$(if $(filter $@, $(targets)), \ $(if $(filter $@, $(targets)), \