Browse Source

Add alias support for converters (#19563)

pull/19603/head
Joel Challis 1 year ago
committed by GitHub
parent
commit
12f1a30d16
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions
  1. +8
    -0
      builddefs/converters.mk
  2. +2
    -0
      platforms/chibios/converters/promicro_to_bonsai_c3/pre_converter.mk

+ 8
- 0
builddefs/converters.mk View File

@ -8,12 +8,17 @@ endif
# TODO: opt in rather than assume everything uses a pro micro
PIN_COMPATIBLE ?= promicro
ifneq ($(CONVERT_TO),)
# stash so we can overwrite env provided vars if needed
ACTIVE_CONVERTER=$(CONVERT_TO)
# glob to search each platfrorm and/or check for valid converter
CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
ifeq ($(CONVERTER),)
$(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
endif
-include $(CONVERTER)/pre_converter.mk
TARGET := $(TARGET)_$(CONVERT_TO)
# Configure any defaults
@ -22,6 +27,9 @@ ifneq ($(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:]'))
# Finally run any converter specific logic
include $(CONVERTER)/converter.mk
endif

+ 2
- 0
platforms/chibios/converters/promicro_to_bonsai_c3/pre_converter.mk View File

@ -0,0 +1,2 @@
CONVERTER:=platforms/chibios/converters/promicro_to_proton_c
ACTIVE_CONVERTER:=proton_c

Loading…
Cancel
Save