Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alias support for converters #19563

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions builddefs/converters.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONVERTER:=platforms/chibios/converters/promicro_to_proton_c
ACTIVE_CONVERTER:=proton_c