diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 122f95c95869..8a9a4e1c7eab 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -215,11 +215,13 @@ else | |||
215 | arg-check = $(if $(strip $(cmd_$@)),,1) | 215 | arg-check = $(if $(strip $(cmd_$@)),,1) |
216 | endif | 216 | endif |
217 | 217 | ||
218 | # >'< substitution is for echo to work, | 218 | # Replace >$< with >$$< to preserve $ when reloading the .cmd file |
219 | # >$< substitution to preserve $ when reloading .cmd file | 219 | # (needed for make) |
220 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] | 220 | # Replace >#< with >\#< to avoid starting a comment in the .cmd file |
221 | # in $(cmd_xxx) double $$ your perl vars | 221 | # (needed for make) |
222 | make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) | 222 | # Replace >'< with >'\''< to be able to enclose the whole string in '...' |
223 | # (needed for the shell) | ||
224 | make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) | ||
223 | 225 | ||
224 | # Find any prerequisites that is newer than target or that does not exist. | 226 | # Find any prerequisites that is newer than target or that does not exist. |
225 | # PHONY targets skipped in both cases. | 227 | # PHONY targets skipped in both cases. |
@@ -230,7 +232,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) | |||
230 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ | 232 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ |
231 | @set -e; \ | 233 | @set -e; \ |
232 | $(echo-cmd) $(cmd_$(1)); \ | 234 | $(echo-cmd) $(cmd_$(1)); \ |
233 | echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) | 235 | printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) |
234 | 236 | ||
235 | # Execute the command and also postprocess generated .d dependencies file. | 237 | # Execute the command and also postprocess generated .d dependencies file. |
236 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ | 238 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ |