common.mk 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. COMMON_DIR = common
  2. PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY)
  3. TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
  4. $(COMMON_DIR)/keyboard.c \
  5. $(COMMON_DIR)/action.c \
  6. $(COMMON_DIR)/action_tapping.c \
  7. $(COMMON_DIR)/action_macro.c \
  8. $(COMMON_DIR)/action_layer.c \
  9. $(COMMON_DIR)/action_util.c \
  10. $(COMMON_DIR)/debug.c \
  11. $(COMMON_DIR)/sendchar_null.c \
  12. $(COMMON_DIR)/eeconfig.c \
  13. $(COMMON_DIR)/report.c \
  14. $(COMMON_DIR)/usb_util.c \
  15. $(PLATFORM_COMMON_DIR)/suspend.c \
  16. $(PLATFORM_COMMON_DIR)/timer.c \
  17. $(COMMON_DIR)/sync_timer.c \
  18. $(PLATFORM_COMMON_DIR)/bootloader.c \
  19. # Use platform provided print - fall back to lib/printf
  20. ifneq ("$(wildcard $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk)","")
  21. include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
  22. else
  23. include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
  24. endif
  25. SHARED_EP_ENABLE = no
  26. MOUSE_SHARED_EP ?= yes
  27. ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes)
  28. TMK_COMMON_DEFS += -DKEYBOARD_SHARED_EP
  29. SHARED_EP_ENABLE = yes
  30. # With the current usb_descriptor.c code,
  31. # you can't share kbd without sharing mouse;
  32. # that would be a very unexpected use case anyway
  33. MOUSE_SHARED_EP = yes
  34. endif
  35. ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
  36. ifeq ($(strip $(MOUSE_SHARED_EP)), yes)
  37. TMK_COMMON_DEFS += -DMOUSE_SHARED_EP
  38. SHARED_EP_ENABLE = yes
  39. endif
  40. endif
  41. ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
  42. TMK_COMMON_DEFS += -DEXTRAKEY_ENABLE
  43. SHARED_EP_ENABLE = yes
  44. endif
  45. ifeq ($(strip $(RAW_ENABLE)), yes)
  46. TMK_COMMON_DEFS += -DRAW_ENABLE
  47. endif
  48. ifeq ($(strip $(CONSOLE_ENABLE)), yes)
  49. TMK_COMMON_DEFS += -DCONSOLE_ENABLE
  50. else
  51. TMK_COMMON_DEFS += -DNO_PRINT
  52. TMK_COMMON_DEFS += -DNO_DEBUG
  53. endif
  54. ifeq ($(strip $(NKRO_ENABLE)), yes)
  55. ifeq ($(PROTOCOL), VUSB)
  56. $(info NKRO is not currently supported on V-USB, and has been disabled.)
  57. else ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
  58. $(info NKRO is not currently supported with Bluetooth, and has been disabled.)
  59. else ifneq ($(BLUETOOTH),)
  60. $(info NKRO is not currently supported with Bluetooth, and has been disabled.)
  61. else
  62. TMK_COMMON_DEFS += -DNKRO_ENABLE
  63. SHARED_EP_ENABLE = yes
  64. endif
  65. endif
  66. ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
  67. TMK_COMMON_DEFS += -DUSB_6KRO_ENABLE
  68. endif
  69. ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
  70. TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/sleep_led.c
  71. TMK_COMMON_DEFS += -DSLEEP_LED_ENABLE
  72. TMK_COMMON_DEFS += -DNO_SUSPEND_POWER_DOWN
  73. endif
  74. ifeq ($(strip $(NO_SUSPEND_POWER_DOWN)), yes)
  75. TMK_COMMON_DEFS += -DNO_SUSPEND_POWER_DOWN
  76. endif
  77. ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
  78. TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
  79. TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
  80. endif
  81. ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
  82. TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
  83. TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
  84. TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
  85. endif
  86. ifeq ($(strip $(BLUETOOTH)), RN42)
  87. TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
  88. TMK_COMMON_DEFS += -DMODULE_RN42
  89. TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
  90. endif
  91. ifeq ($(strip $(ONEHAND_ENABLE)), yes)
  92. SWAP_HANDS_ENABLE = yes # backwards compatibility
  93. endif
  94. ifeq ($(strip $(SWAP_HANDS_ENABLE)), yes)
  95. TMK_COMMON_DEFS += -DSWAP_HANDS_ENABLE
  96. endif
  97. ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes)
  98. TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
  99. endif
  100. ifeq ($(strip $(SHARED_EP_ENABLE)), yes)
  101. TMK_COMMON_DEFS += -DSHARED_EP_ENABLE
  102. endif
  103. ifeq ($(strip $(LTO_ENABLE)), yes)
  104. ifeq ($(PLATFORM),CHIBIOS)
  105. $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
  106. $(info If unsure, set LTO_ENABLE = no.)
  107. endif
  108. EXTRAFLAGS += -flto
  109. TMK_COMMON_DEFS += -DLTO_ENABLE
  110. TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATON_ENABLE
  111. else ifdef LINK_TIME_OPTIMIZATION_ENABLE
  112. $(error The LINK_TIME_OPTIMIZATION_ENABLE flag has been renamed to LTO_ENABLE.)
  113. endif
  114. # Search Path
  115. VPATH += $(TMK_PATH)/$(COMMON_DIR)
  116. VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR)