summaryrefslogtreecommitdiff
path: root/builddefs
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-02-28 19:15:54 +0000
committerGitHub <noreply@github.com>2023-02-28 11:15:54 -0800
commitfc059291246609e0cbcfb8c06dc9e15f964353ec (patch)
tree72fb22aeae9a85d28702917831770e2cc0cb33e2 /builddefs
parent184c1e5187ddacccae4bcea428603923e1cbe385 (diff)
Strip whitespace from CONVERT_TO variables (#19948)
Diffstat (limited to 'builddefs')
-rw-r--r--builddefs/converters.mk11
1 files changed, 8 insertions, 3 deletions
diff --git a/builddefs/converters.mk b/builddefs/converters.mk
index 17b1c3b6ee..a3548afd60 100644
--- a/builddefs/converters.mk
+++ b/builddefs/converters.mk
@@ -7,7 +7,12 @@ endif
# TODO: opt in rather than assume everything uses a pro micro
PIN_COMPATIBLE ?= promicro
+
+# Remove whitespace from any rule.mk provided vars
+# - env cannot be overwritten but cannot have whitespace anyway
+CONVERT_TO:=$(strip $(CONVERT_TO))
ifneq ($(CONVERT_TO),)
+
# stash so we can overwrite env provided vars if needed
ACTIVE_CONVERTER=$(CONVERT_TO)
@@ -23,13 +28,13 @@ ifneq ($(CONVERT_TO),)
TARGET := $(TARGET)_$(CONVERT_TO)
# Configure any defaults
- OPT_DEFS += -DCONVERT_TO_$(strip $(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]'))
- OPT_DEFS += -DCONVERTER_TARGET=\"$(strip $(CONVERT_TO))\"
+ OPT_DEFS += -DCONVERT_TO_$(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')
+ OPT_DEFS += -DCONVERTER_TARGET=\"$(CONVERT_TO)\"
OPT_DEFS += -DCONVERTER_ENABLED
VPATH += $(CONVERTER)
# Configure for "alias" - worst case it produces an idential define
- OPT_DEFS += -DCONVERT_TO_$(strip $(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]'))
+ OPT_DEFS += -DCONVERT_TO_$(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]')
# Finally run any converter specific logic
include $(CONVERTER)/converter.mk