Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit d97adb1

Browse files
committed
build: properly unquote CONFIG_CFLAGS and CONFIG_LDFLAGS
When using CONFIG_CFLAGS containing spaces, it would be appended to the command line keeping the quotes. The issue is that `patsusbt` operates on words, but not assuming quotes mean anything. $(patsubst "%",%,$(CONFIG_CFLAGS)) was evaluating "-Wno-undef -Wno-missing-include-dirs" and neither matched. Using two patsubst, one for "% and another for %" works in some cases but would break in the case we had quotes inside one of the flags. This patch uses `echo`, and ensures that it is called only once for each flag by creating the UNQUOTED_ variables using `:=` (single assignment). Signed-off-by: Caio Marcelo de Oliveira Filho <[email protected]>
1 parent 69f00c9 commit d97adb1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/build/Makefile.vars

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ COMMON_LDFLAGS += $(SANITIZE_ADDRESS_LDFLAGS)
161161
endif
162162
endif
163163

164-
COMMON_CFLAGS += $(patsubst "%",%,$(CONFIG_CFLAGS))
165-
COMMON_LDFLAGS += $(patsubst "%",%,$(CONFIG_LDFLAGS))
164+
UNQUOTED_CONFIG_CFLAGS := $(shell echo $(CONFIG_CFLAGS))
165+
UNQUOTED_CONFIG_LDFLAGS := $(shell echo $(CONFIG_LDFLAGS))
166+
167+
COMMON_CFLAGS += $(UNQUOTED_CONFIG_CFLAGS)
168+
COMMON_LDFLAGS += $(UNQUOTED_CONFIG_LDFLAGS)
166169

167170
ifneq (,$(shell echo $(COMMON_CFLAGS) | grep -e "-O[s12345\ ]"))
168171
COMMON_CFLAGS += $(FLTO_CFLAGS)

0 commit comments

Comments
 (0)