From 7c56dc0f02ed84c36b1316a6e9d32f6d8d7508bf Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 26 Feb 2023 23:42:26 +0000 Subject: [PATCH 1/3] Strip whitespace from CONVERT_TO variables --- builddefs/converters.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builddefs/converters.mk b/builddefs/converters.mk index 17b1c3b6ee95..9dc35f425d29 100644 --- a/builddefs/converters.mk +++ b/builddefs/converters.mk @@ -8,6 +8,9 @@ endif # TODO: opt in rather than assume everything uses a pro micro PIN_COMPATIBLE ?= promicro ifneq ($(CONVERT_TO),) + # Remove whitespace from any rule.mk provided vars - env cannot have whitespace anyway + CONVERT_TO:=$(strip $(CONVERT_TO)) + # stash so we can overwrite env provided vars if needed ACTIVE_CONVERTER=$(CONVERT_TO) @@ -23,13 +26,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 From 8319b07bbfcfa7d76808974afe4ea6892f5d7282 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 26 Feb 2023 23:53:35 +0000 Subject: [PATCH 2/3] update comment --- builddefs/converters.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builddefs/converters.mk b/builddefs/converters.mk index 9dc35f425d29..37baa2e7c76d 100644 --- a/builddefs/converters.mk +++ b/builddefs/converters.mk @@ -8,7 +8,8 @@ endif # TODO: opt in rather than assume everything uses a pro micro PIN_COMPATIBLE ?= promicro ifneq ($(CONVERT_TO),) - # Remove whitespace from any rule.mk provided vars - env cannot have whitespace anyway + # Remove whitespace from any rule.mk provided vars + # - env cannot be overwritten but cannot have whitespace anyway CONVERT_TO:=$(strip $(CONVERT_TO)) # stash so we can overwrite env provided vars if needed From 6577f66a283dd2792d51e84282212f00f14494ac Mon Sep 17 00:00:00 2001 From: zvecr Date: Mon, 27 Feb 2023 00:16:40 +0000 Subject: [PATCH 3/3] Move strip to handle 'CONVERT_TO= ' --- builddefs/converters.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/builddefs/converters.mk b/builddefs/converters.mk index 37baa2e7c76d..a3548afd609f 100644 --- a/builddefs/converters.mk +++ b/builddefs/converters.mk @@ -7,10 +7,11 @@ 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),) - # Remove whitespace from any rule.mk provided vars - # - env cannot be overwritten but cannot have whitespace anyway - CONVERT_TO:=$(strip $(CONVERT_TO)) # stash so we can overwrite env provided vars if needed ACTIVE_CONVERTER=$(CONVERT_TO)