Skip to content

Commit 12f1a30

Browse files
authored
Add alias support for converters (#19563)
1 parent 364a910 commit 12f1a30

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

builddefs/converters.mk

+8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ endif
88
# TODO: opt in rather than assume everything uses a pro micro
99
PIN_COMPATIBLE ?= promicro
1010
ifneq ($(CONVERT_TO),)
11+
# stash so we can overwrite env provided vars if needed
12+
ACTIVE_CONVERTER=$(CONVERT_TO)
13+
1114
# glob to search each platfrorm and/or check for valid converter
1215
CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
1316
ifeq ($(CONVERTER),)
1417
$(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
1518
endif
1619

20+
-include $(CONVERTER)/pre_converter.mk
21+
1722
TARGET := $(TARGET)_$(CONVERT_TO)
1823

1924
# Configure any defaults
@@ -22,6 +27,9 @@ ifneq ($(CONVERT_TO),)
2227
OPT_DEFS += -DCONVERTER_ENABLED
2328
VPATH += $(CONVERTER)
2429

30+
# Configure for "alias" - worst case it produces an idential define
31+
OPT_DEFS += -DCONVERT_TO_$(strip $(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]'))
32+
2533
# Finally run any converter specific logic
2634
include $(CONVERTER)/converter.mk
2735
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONVERTER:=platforms/chibios/converters/promicro_to_proton_c
2+
ACTIVE_CONVERTER:=proton_c

0 commit comments

Comments
 (0)