Parent directory

converters.mk

1843 bytes
 1# Note for new boards -- CTPC and CONVERT_TO_PROTON_C are deprecated terms
 2# and should not be replicated for new boards. These will be removed from
 3# documentation as well as existing keymaps in due course.
 4ifneq ($(findstring yes, $(CTPC)$(CONVERT_TO_PROTON_C)),)
 5$(call CATASTROPHIC_ERROR,The `CONVERT_TO_PROTON_C` and `CTPC` options are now deprecated. `CONVERT_TO=proton_c` should be used instead.)
 6endif
 7
 8ifneq (,$(filter $(MCU),atmega32u4))
 9    # TODO: opt in rather than assume everything uses a pro micro
10    PIN_COMPATIBLE ?= promicro
11endif
12
13# Remove whitespace from any rule.mk provided vars
14#   - env cannot be overwritten but cannot have whitespace anyway
15CONVERT_TO:=$(strip $(CONVERT_TO))
16ifneq ($(CONVERT_TO),)
17
18    # stash so we can overwrite env provided vars if needed
19    ACTIVE_CONVERTER=$(CONVERT_TO)
20
21    ifeq ($(PIN_COMPATIBLE),)
22        $(call CATASTROPHIC_ERROR,Converting to '$(CONVERT_TO)' not possible!)
23    endif
24
25    # glob to search each platfrorm and/or check for valid converter
26    CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
27    ifeq ($(CONVERTER),)
28        $(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
29    endif
30
31    -include $(CONVERTER)/pre_converter.mk
32
33    PLATFORM_KEY = $(shell echo $(CONVERTER) | cut -d "/" -f2)
34
35    # Configure any defaults
36    OPT_DEFS += -DCONVERT_TO_$(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')
37    OPT_DEFS += -DCONVERTER_TARGET=\"$(CONVERT_TO)\"
38    OPT_DEFS += -DCONVERTER_ENABLED
39    VPATH += $(CONVERTER)
40
41    # Configure for "alias" - worst case it produces an idential define
42    OPT_DEFS += -DCONVERT_TO_$(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]')
43
44    # Finally run any converter specific logic
45    include $(CONVERTER)/converter.mk
46endif