You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.9 KiB

  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.
  4. ifneq ($(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.)
  6. endif
  7. ifneq (,$(filter $(MCU),atmega32u4))
  8. # TODO: opt in rather than assume everything uses a pro micro
  9. PIN_COMPATIBLE ?= promicro
  10. endif
  11. # Remove whitespace from any rule.mk provided vars
  12. # - env cannot be overwritten but cannot have whitespace anyway
  13. CONVERT_TO:=$(strip $(CONVERT_TO))
  14. ifneq ($(CONVERT_TO),)
  15. # stash so we can overwrite env provided vars if needed
  16. ACTIVE_CONVERTER=$(CONVERT_TO)
  17. ifeq ($(PIN_COMPATIBLE),)
  18. $(call CATASTROPHIC_ERROR,Converting to '$(CONVERT_TO)' not possible!)
  19. endif
  20. # glob to search each platfrorm and/or check for valid converter
  21. CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
  22. ifeq ($(CONVERTER),)
  23. $(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
  24. endif
  25. -include $(CONVERTER)/pre_converter.mk
  26. PLATFORM_KEY = $(shell echo $(CONVERTER) | cut -d "/" -f2)
  27. # force setting as value can be from environment
  28. override TARGET := $(TARGET)_$(CONVERT_TO)
  29. # Configure any defaults
  30. OPT_DEFS += -DCONVERT_TO_$(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')
  31. OPT_DEFS += -DCONVERTER_TARGET=\"$(CONVERT_TO)\"
  32. OPT_DEFS += -DCONVERTER_ENABLED
  33. VPATH += $(CONVERTER)
  34. # Configure for "alias" - worst case it produces an idential define
  35. OPT_DEFS += -DCONVERT_TO_$(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]')
  36. # Finally run any converter specific logic
  37. include $(CONVERTER)/converter.mk
  38. endif