summaryrefslogtreecommitdiff
path: root/builddefs/converters.mk
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2022-05-29 15:38:33 -0700
committerDrashna Jael're <drashna@live.com>2022-05-29 15:38:33 -0700
commit30aac80d5a6d8c6f7c06efb49189d748e70edc4a (patch)
treeceb11968ae41228e4b110c07467cdca7cc9cff22 /builddefs/converters.mk
parent67f4e5f34489abf986dedb4984b256692086c615 (diff)
parente22a183329fd05d39f88bb9dfebe98cfa7cd8402 (diff)
Merge remote-tracking branch 'qmk 0.17.0' into firmware21
Diffstat (limited to 'builddefs/converters.mk')
-rw-r--r--builddefs/converters.mk37
1 files changed, 37 insertions, 0 deletions
diff --git a/builddefs/converters.mk b/builddefs/converters.mk
new file mode 100644
index 0000000000..b3e7bec007
--- /dev/null
+++ b/builddefs/converters.mk
@@ -0,0 +1,37 @@
+# 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.
+ifeq ($(strip $(CTPC)), yes)
+ CONVERT_TO_PROTON_C=yes
+endif
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ CONVERT_TO=proton_c
+
+cpfirmware: ctpc_warning
+.INTERMEDIATE: ctpc_warning
+ctpc_warning: elf
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+ $(info The `CONVERT_TO_PROTON_C` and `CTPC` options are soon to be deprecated.)
+ $(info Boards should be changed to use `CONVERT_TO=proton_c` instead.)
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+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