History

[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.

Oleg Verych committed 19 years ago

Commit bff288c1 parent 5331be01 file · +20 −20Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/Kbuild.include+20−20
@@ -57,7 +57,7 @@ endef · 56 unmodified lines
57# See documentation in Documentation/kbuild/makefiles.txt57# See documentation in Documentation/kbuild/makefiles.txt
58 58
59# checker-shell59# 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)
61# Exit code chooses option. $$OUT is safe location for needless output.61# Exit code chooses option. $$OUT is safe location for needless output.
62define checker-shell62define checker-shell
63 $(shell set -e; \63 $(shell set -e; \
@@ -74,23 +74,23 @@ define checker-shell · 10 unmodified lines
74endef74endef
75 75
76# as-option76# as-option
77# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)77# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
78as-option = $(call checker-shell, \78as-option = $(call checker-shell,\
79 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT, $(1), $(2))79 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o $$OUT,$(1),$(2))
80 80
81# as-instr81# as-instr
82# Usage: cflags-y += $(call as-instr, instr, option1, option2)82# Usage: cflags-y += $(call as-instr,instr,option1,option2)
83as-instr = $(call checker-shell, \83as-instr = $(call checker-shell,\
84 printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -, $(2), $(3))84 printf "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o $$OUT -,$(2),$(3))
85 85
86# cc-option86# cc-option
87# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
88cc-option = $(call checker-shell, \88cc-option = $(call checker-shell,\
89 $(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT, $(1), $(2))89 $(CC) $(CFLAGS) $(if $(3),$(3),$(1)) -S -xc /dev/null -o $$OUT,$(1),$(2))
90 90
91# cc-option-yn91# cc-option-yn
92# Usage: flag := $(call cc-option-yn, -march=winchip-c6)92# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
93cc-option-yn = $(call cc-option, "y", "n", $(1))93cc-option-yn = $(call cc-option,"y","n",$(1))
94 94
95# cc-option-align95# cc-option-align
96# Prefix align with either -falign or -malign96# Prefix align with either -falign or -malign
@@ -98,7 +98,7 @@ cc-option-align = $(subst -functions=0,,\ · 1 unmodified line
98 $(call cc-option,-falign-functions=0,-malign-functions=0))98 $(call cc-option,-falign-functions=0,-malign-functions=0))
99 99
100# cc-version100# cc-version
101# Usage gcc-ver := $(call cc-version, $(CC))101# Usage gcc-ver := $(call cc-version,$(CC))
102cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))102cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
103 103
104# cc-ifversion104# cc-ifversion
@@ -107,8 +107,8 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) · 2 unmodified lines
107 107
108# ld-option108# ld-option
109# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)109# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
110ld-option = $(call checker-shell, \110ld-option = $(call checker-shell,\
111 $(CC) $(1) -nostdlib -xc /dev/null -o $$OUT, $(1), $(2))111 $(CC) $(1) -nostdlib -xc /dev/null -o $$OUT,$(1),$(2))
112 112
113######113######
114 114
@@ -120,22 +120,22 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj · 5 unmodified lines
120# Prefix -I with $(srctree) if it is not an absolute path,120# Prefix -I with $(srctree) if it is not an absolute path,
121# add original to the end121# add original to the end
122addtree = $(if \122addtree = $(if \
123 $(filter-out -I/%, $(1)), $(patsubst -I%,-I$(srctree)/%,$(1))) $(1)123 $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
124 124
125# Find all -I options and call addtree125# Find all -I options and call addtree
126flags = $(foreach o,$($(1)), \126flags = $(foreach o,$($(1)),\
127 $(if $(filter -I%,$(o)), $(call addtree, $(o)), $(o)))127 $(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
128 128
129# echo command.129# echo command.
130# Short version is used, if $(quiet) equals `quiet_', otherwise full one.130# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
131echo-cmd = $(if $($(quiet)cmd_$(1)), \131echo-cmd = $(if $($(quiet)cmd_$(1)),\
132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)132 echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
133 133
134# printing commands134# printing commands
135cmd = @$(echo-cmd) $(cmd_$(1))135cmd = @$(echo-cmd) $(cmd_$(1))
136 136
137# Add $(obj)/ for paths that are not absolute137# Add $(obj)/ for paths that are not absolute
138objectify = $(foreach o,$(1), $(if $(filter /%,$(o)), $(o), $(obj)/$(o)))138objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
139 139
140###140###
141# if_changed - execute command if any prerequisite is newer than141# if_changed - execute command if any prerequisite is newer than