Skip to content

Commit bff288c

Browse files
Oleg VerychLinus Torvalds
authored andcommitted
[PATCH] kbuild, Kbuild.include: avoid using spaces in call arguments
Do not use whitespace in arguments of functions in makefiles, as they propagate further without notice. Thus we get + echo ' y' instead of + echo y Fix misleading comments. Signed-off-by: Oleg Verych <olecom@flower.upol.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5331be0 commit bff288c

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

‎scripts/Kbuild.include‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endef
5757
# See documentation in Documentation/kbuild/makefiles.txt
5858

5959
# checker-shell
60-
# Usage: option = $(call checker-shell, $(CC)...-o $$OUT, option-ok, otherwise)
60+
# Usage: option = $(call checker-shell,$(CC)...-o $$OUT,option-ok,otherwise)
6161
# Exit code chooses option. $$OUT is safe location for needless output.
6262
define checker-shell
6363
$(shell set -e; \
@@ -74,31 +74,31 @@ define checker-shell
7474
endef
7575

7676
# as-option
77-
# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)
78-
as-option = $(call checker-shell, \
79-
$(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT, $(1), $(2))
77+
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
78+
as-option = $(call checker-shell,\
79+
$(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT,$(1),$(2))
8080

8181
# as-instr
82-
# Usage: cflags-y += $(call as-instr, instr, option1, option2)
83-
as-instr = $(call checker-shell, \
84-
printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -, $(2), $(3))
82+
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
83+
as-instr = $(call checker-shell,\
84+
printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -,$(2),$(3))
8585

8686
# cc-option
87-
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
88-
cc-option = $(call checker-shell, \
89-
$(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT, $(1), $(2))
87+
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
88+
cc-option = $(call checker-shell,\
89+
$(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT,$(1),$(2))
9090

9191
# cc-option-yn
92-
# Usage: flag := $(call cc-option-yn, -march=winchip-c6)
93-
cc-option-yn = $(call cc-option, "y", "n", $(1))
92+
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
93+
cc-option-yn = $(call cc-option,"y","n",$(1))
9494

9595
# cc-option-align
9696
# Prefix align with either -falign or -malign
9797
cc-option-align = $(subst -functions=0,,\
9898
$(call cc-option,-falign-functions=0,-malign-functions=0))
9999

100100
# cc-version
101-
# Usage gcc-ver := $(call cc-version, $(CC))
101+
# Usage gcc-ver := $(call cc-version,$(CC))
102102
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
103103

104104
# cc-ifversion
@@ -107,8 +107,8 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
107107

108108
# ld-option
109109
# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
110-
ld-option = $(call checker-shell, \
111-
$(CC) $(1) -nostdlib -xc /dev/null -o $$OUT, $(1), $(2))
110+
ld-option = $(call checker-shell,\
111+
$(CC) $(1) -nostdlib -xc /dev/null -o $$OUT,$(1),$(2))
112112

113113
######
114114

@@ -120,22 +120,22 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
120120
# Prefix -I with $(srctree) if it is not an absolute path,
121121
# add original to the end
122122
addtree = $(if \
123-
$(filter-out -I/%, $(1)), $(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
123+
$(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
124124

125125
# Find all -I options and call addtree
126-
flags = $(foreach o,$($(1)), \
127-
$(if $(filter -I%,$(o)), $(call addtree, $(o)), $(o)))
126+
flags = $(foreach o,$($(1)),\
127+
$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
128128

129129
# echo command.
130130
# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
131-
echo-cmd = $(if $($(quiet)cmd_$(1)), \
131+
echo-cmd = $(if $($(quiet)cmd_$(1)),\
132132
echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
133133

134134
# printing commands
135135
cmd = @$(echo-cmd) $(cmd_$(1))
136136

137137
# Add $(obj)/ for paths that are not absolute
138-
objectify = $(foreach o,$(1), $(if $(filter /%,$(o)), $(o), $(obj)/$(o)))
138+
objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
139139

140140
###
141141
# if_changed - execute command if any prerequisite is newer than

0 commit comments

Comments
 (0)