aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-01-06 16:35:59 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2006-01-06 16:35:59 -0500
commitd51bfb7852d0e524074ad1cf04e4c3026d75d652 (patch)
treeaf3947d9504938d0a8c657ba58732c8b54df6772 /scripts/Kbuild.include
parent37193147991a53b2e9f573d0ec47f63a2d4de8dc (diff)
kbuild: introduce escsq to escapre single quotes
This makes things a little bit more reader friendly and gvim is less confused. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index db3c708e546b..0168d6c37075 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -3,6 +3,7 @@
3 3
4# Convinient variables 4# Convinient variables
5comma := , 5comma := ,
6squote := '
6empty := 7empty :=
7space := $(empty) $(empty) 8space := $(empty) $(empty)
8 9
@@ -12,6 +13,10 @@ space := $(empty) $(empty)
12depfile = $(subst $(comma),_,$(@D)/.$(@F).d) 13depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
13 14
14### 15###
16# Escape single quote for use in echo statements
17escsq = $(subst $(squote),'\$(squote)',$1)
18
19###
15# filechk is used to check if the content of a generated file is updated. 20# filechk is used to check if the content of a generated file is updated.
16# Sample usage: 21# Sample usage:
17# define filechk_sample 22# define filechk_sample
@@ -47,7 +52,7 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
47 52
48# If quiet is set, only print short version of command 53# If quiet is set, only print short version of command
49cmd = @$(if $($(quiet)cmd_$(1)),\ 54cmd = @$(if $($(quiet)cmd_$(1)),\
50 echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) 55 echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
51 56
52# Add $(obj)/ for paths that is not absolute 57# Add $(obj)/ for paths that is not absolute
53objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) 58objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
@@ -68,7 +73,7 @@ endif
68 73
69# echo command. Short version is $(quiet) equals quiet, otherwise full command 74# echo command. Short version is $(quiet) equals quiet, otherwise full command
70echo-cmd = $(if $($(quiet)cmd_$(1)), \ 75echo-cmd = $(if $($(quiet)cmd_$(1)), \
71 echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) 76 echo ' $(call escsq,$($(quiet)cmd_$(1)))';)
72 77
73# function to only execute the passed command if necessary 78# function to only execute the passed command if necessary
74# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file 79# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
@@ -78,7 +83,7 @@ if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
78 @set -e; \ 83 @set -e; \
79 $(echo-cmd) \ 84 $(echo-cmd) \
80 $(cmd_$(1)); \ 85 $(cmd_$(1)); \
81 echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) 86 echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
82 87
83# execute the command and also postprocess generated .d dependencies 88# execute the command and also postprocess generated .d dependencies
84# file 89# file
@@ -87,7 +92,7 @@ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
87 @set -e; \ 92 @set -e; \
88 $(echo-cmd) \ 93 $(echo-cmd) \
89 $(cmd_$(1)); \ 94 $(cmd_$(1)); \
90 scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ 95 scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
91 rm -f $(depfile); \ 96 rm -f $(depfile); \
92 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) 97 mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
93 98