diff options
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/build_keyboard.mk | 8 | ||||
-rw-r--r-- | builddefs/converters.mk | 26 |
2 files changed, 27 insertions, 7 deletions
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index 44acd964cc..4503f018a8 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -172,13 +172,7 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c endif -ifeq ($(strip $(CTPC)), yes) - CONVERT_TO_PROTON_C=yes -endif - -ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes) - include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk -endif +include $(BUILDDEFS_PATH)/converters.mk include $(BUILDDEFS_PATH)/mcu_selection.mk diff --git a/builddefs/converters.mk b/builddefs/converters.mk new file mode 100644 index 0000000000..1b029e7225 --- /dev/null +++ b/builddefs/converters.mk @@ -0,0 +1,26 @@ +ifeq ($(strip $(CTPC)), yes) + CONVERT_TO_PROTON_C=yes +endif +ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes) + CONVERT_TO=proton_c +endif + +# TODO: opt in rather than assume everything uses a pro micro +PIN_COMPATIBLE ?= promicro +ifneq ($(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 + + TARGET := $(TARGET)_$(CONVERT_TO) + + # Configure any defaults + OPT_DEFS += -DCONVERT_TO_$(strip $(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')) + OPT_DEFS += -DCONVERTER_ENABLED + VPATH += $(CONVERTER) + + # Finally run any converter specific logic + include $(CONVERTER)/converter.mk +endif |