converters.mk 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Remove whitespace from any rule.mk provided vars
  2. # - env cannot be overwritten but cannot have whitespace anyway
  3. CONVERT_TO:=$(strip $(CONVERT_TO))
  4. ifneq ($(CONVERT_TO),)
  5. # stash so we can overwrite env provided vars if needed
  6. ACTIVE_CONVERTER=$(CONVERT_TO)
  7. ifeq ($(PIN_COMPATIBLE),)
  8. $(call CATASTROPHIC_ERROR,Converting to '$(CONVERT_TO)' not possible!)
  9. endif
  10. # glob to search each platfrorm and/or check for valid converter
  11. CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
  12. ifeq ($(CONVERTER),)
  13. $(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
  14. endif
  15. -include $(CONVERTER)/pre_converter.mk
  16. PLATFORM_KEY = $(shell echo $(CONVERTER) | cut -d "/" -f2)
  17. # Configure any defaults
  18. OPT_DEFS += -DCONVERT_TO_$(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]')
  19. OPT_DEFS += -DCONVERTER_TARGET=\"$(CONVERT_TO)\"
  20. OPT_DEFS += -DCONVERTER_ENABLED
  21. VPATH += $(CONVERTER)
  22. # Configure for "alias" - worst case it produces an idential define
  23. OPT_DEFS += -DCONVERT_TO_$(shell echo $(ACTIVE_CONVERTER) | tr '[:lower:]' '[:upper:]')
  24. # Finally run any converter specific logic
  25. include $(CONVERTER)/converter.mk
  26. endif