converters.mk 1.5 KB

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