2022-04-03 20:17:38 +02:00
|
|
|
# Note for new boards -- CTPC and CONVERT_TO_PROTON_C are deprecated terms
|
|
|
|
# and should not be replicated for new boards. These will be removed from
|
|
|
|
# documentation as well as existing keymaps in due course.
|
2023-01-11 23:44:55 +01:00
|
|
|
ifneq ($(findstring yes, $(CTPC)$(CONVERT_TO_PROTON_C)),)
|
|
|
|
$(call CATASTROPHIC_ERROR,The `CONVERT_TO_PROTON_C` and `CTPC` options are now deprecated. `CONVERT_TO=proton_c` should be used instead.)
|
2022-04-03 19:22:52 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# TODO: opt in rather than assume everything uses a pro micro
|
|
|
|
PIN_COMPATIBLE ?= promicro
|
2023-02-28 20:15:54 +01:00
|
|
|
|
|
|
|
# Remove whitespace from any rule.mk provided vars
|
|
|
|
# - env cannot be overwritten but cannot have whitespace anyway
|
|
|
|
CONVERT_TO:=$(strip $(CONVERT_TO))
|
2022-04-03 19:22:52 +02:00
|
|
|
ifneq ($(CONVERT_TO),)
|
2023-02-28 20:15:54 +01:00
|
|
|
|
2023-01-19 00:16:33 +01:00
|
|
|
# stash so we can overwrite env provided vars if needed
|
|
|
|
ACTIVE_CONVERTER=$(CONVERT_TO)
|
|
|
|
|
2022-04-03 19:22:52 +02:00
|
|
|
# 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
|
|
|
|
|
2023-01-19 00:16:33 +01:00
|
|
|
-include $(CONVERTER)/pre_converter.mk
|
|
|
|
|
2023-01-20 03:41:10 +01:00
|
|
|
PLATFORM_KEY = $(shell echo $(CONVERTER) | cut -d "/" -f2)
|
2023-12-08 10:55:24 +01:00
|
|
|
|
|
|
|
# force setting as value can be from environment
|
|
|
|
override TARGET := $(TARGET)_$(CONVERT_TO)
|
2022-04-03 19:22:52 +02:00
|
|
|
|
|
|
|
# Configure any defaults
|
2023-02-28 20:15:54 +01:00
|
|
|
OPT_DEFS += -DCONVERT_TO_$(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')
|
|
|
|
OPT_DEFS += -DCONVERTER_TARGET=\"$(CONVERT_TO)\"
|
2022-04-03 19:22:52 +02:00
|
|
|
OPT_DEFS += -DCONVERTER_ENABLED
|
|
|
|
VPATH += $(CONVERTER)
|
|
|
|
|
2023-01-19 00:16:33 +01:00
|
|
|
# Configure for "alias" - worst case it produces an idential define
|
2023-02-28 20:15:54 +01:00
|
|
|
OPT_DEFS += -DCONVERT_TO_$(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]')
|
2023-01-19 00:16:33 +01:00
|
|
|
|
2022-04-03 19:22:52 +02:00
|
|
|
# Finally run any converter specific logic
|
|
|
|
include $(CONVERTER)/converter.mk
|
|
|
|
endif
|