common_features.mk 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # Copyright 2017 Fred Sundvik
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. SERIAL_DIR := $(QUANTUM_DIR)/serial_link
  16. SERIAL_PATH := $(QUANTUM_PATH)/serial_link
  17. SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
  18. SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
  19. SERIAL_DEFS += -DSERIAL_LINK_ENABLE
  20. COMMON_VPATH += $(SERIAL_PATH)
  21. ifeq ($(PLATFORM),AVR)
  22. COMMON_VPATH += $(DRIVER_PATH)/avr
  23. else
  24. COMMON_VPATH += $(DRIVER_PATH)/arm
  25. endif
  26. ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
  27. OPT_DEFS += -DAPI_SYSEX_ENABLE
  28. SRC += $(QUANTUM_DIR)/api/api_sysex.c
  29. OPT_DEFS += -DAPI_ENABLE
  30. SRC += $(QUANTUM_DIR)/api.c
  31. MIDI_ENABLE=yes
  32. endif
  33. MUSIC_ENABLE := 0
  34. ifeq ($(strip $(AUDIO_ENABLE)), yes)
  35. OPT_DEFS += -DAUDIO_ENABLE
  36. MUSIC_ENABLE := 1
  37. SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
  38. SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
  39. ifeq ($(PLATFORM),AVR)
  40. SRC += $(QUANTUM_DIR)/audio/audio.c
  41. else
  42. SRC += $(QUANTUM_DIR)/audio/audio_arm.c
  43. endif
  44. SRC += $(QUANTUM_DIR)/audio/voices.c
  45. SRC += $(QUANTUM_DIR)/audio/luts.c
  46. endif
  47. ifeq ($(strip $(MIDI_ENABLE)), yes)
  48. OPT_DEFS += -DMIDI_ENABLE
  49. MUSIC_ENABLE := 1
  50. SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
  51. endif
  52. ifeq ($(MUSIC_ENABLE), 1)
  53. SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
  54. endif
  55. ifeq ($(strip $(COMBO_ENABLE)), yes)
  56. OPT_DEFS += -DCOMBO_ENABLE
  57. SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
  58. endif
  59. ifeq ($(strip $(STENO_ENABLE)), yes)
  60. OPT_DEFS += -DSTENO_ENABLE
  61. VIRTSER_ENABLE := yes
  62. SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
  63. endif
  64. ifeq ($(strip $(VIRTSER_ENABLE)), yes)
  65. OPT_DEFS += -DVIRTSER_ENABLE
  66. endif
  67. ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
  68. OPT_DEFS += -DFAUXCLICKY_ENABLE
  69. SRC += $(QUANTUM_DIR)/fauxclicky.c
  70. endif
  71. ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
  72. OPT_DEFS += -DPOINTING_DEVICE_ENABLE
  73. OPT_DEFS += -DMOUSE_ENABLE
  74. SRC += $(QUANTUM_DIR)/pointing_device.c
  75. endif
  76. ifeq ($(strip $(UCIS_ENABLE)), yes)
  77. OPT_DEFS += -DUCIS_ENABLE
  78. UNICODE_COMMON = yes
  79. SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
  80. endif
  81. ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
  82. OPT_DEFS += -DUNICODEMAP_ENABLE
  83. UNICODE_COMMON = yes
  84. SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
  85. endif
  86. ifeq ($(strip $(UNICODE_ENABLE)), yes)
  87. OPT_DEFS += -DUNICODE_ENABLE
  88. UNICODE_COMMON = yes
  89. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
  90. endif
  91. ifeq ($(strip $(UNICODE_COMMON)), yes)
  92. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
  93. endif
  94. ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
  95. OPT_DEFS += -DRGBLIGHT_ENABLE
  96. SRC += $(QUANTUM_DIR)/rgblight.c
  97. CIE1931_CURVE = yes
  98. LED_BREATHING_TABLE = yes
  99. ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
  100. OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
  101. else
  102. SRC += ws2812.c
  103. endif
  104. endif
  105. ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
  106. OPT_DEFS += -DRGB_MATRIX_ENABLE
  107. SRC += is31fl3731.c
  108. SRC += twi2c.c
  109. SRC += $(QUANTUM_DIR)/color.c
  110. SRC += $(QUANTUM_DIR)/rgb_matrix.c
  111. CIE1931_CURVE = yes
  112. endif
  113. ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
  114. OPT_DEFS += -DTAP_DANCE_ENABLE
  115. SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
  116. endif
  117. ifeq ($(strip $(KEY_LOCK_ENABLE)), yes)
  118. OPT_DEFS += -DKEY_LOCK_ENABLE
  119. SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c
  120. endif
  121. ifeq ($(strip $(PRINTING_ENABLE)), yes)
  122. OPT_DEFS += -DPRINTING_ENABLE
  123. SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
  124. SRC += $(TMK_DIR)/protocol/serial_uart.c
  125. endif
  126. ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
  127. OPT_DEFS += -DAUTO_SHIFT_ENABLE
  128. SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
  129. ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
  130. OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
  131. endif
  132. endif
  133. ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
  134. SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
  135. OPT_DEFS += $(SERIAL_DEFS)
  136. VAPTH += $(SERIAL_PATH)
  137. endif
  138. ifneq ($(strip $(VARIABLE_TRACE)),)
  139. SRC += $(QUANTUM_DIR)/variable_trace.c
  140. OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
  141. ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
  142. OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
  143. endif
  144. endif
  145. ifeq ($(strip $(LCD_ENABLE)), yes)
  146. CIE1931_CURVE = yes
  147. endif
  148. ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
  149. ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
  150. CIE1931_CURVE = yes
  151. endif
  152. ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
  153. OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
  154. endif
  155. endif
  156. ifeq ($(strip $(CIE1931_CURVE)), yes)
  157. OPT_DEFS += -DUSE_CIE1931_CURVE
  158. LED_TABLES = yes
  159. endif
  160. ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
  161. OPT_DEFS += -DUSE_LED_BREATHING_TABLE
  162. LED_TABLES = yes
  163. endif
  164. ifeq ($(strip $(LED_TABLES)), yes)
  165. SRC += $(QUANTUM_DIR)/led_tables.c
  166. endif
  167. ifeq ($(strip $(TERMINAL_ENABLE)), yes)
  168. SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
  169. OPT_DEFS += -DTERMINAL_ENABLE
  170. endif
  171. ifeq ($(strip $(USB_HID_ENABLE)), yes)
  172. include $(TMK_DIR)/protocol/usb_hid.mk
  173. endif
  174. ifeq ($(strip $(I2C_SLAVE_ENABLE)), yes)
  175. SRC += twi2c.c
  176. OPT_DEFS += -DI2C_SLAVE_ENABLE
  177. endif
  178. QUANTUM_SRC:= \
  179. $(QUANTUM_DIR)/quantum.c \
  180. $(QUANTUM_DIR)/keymap_common.c \
  181. $(QUANTUM_DIR)/keycode_config.c \
  182. $(QUANTUM_DIR)/process_keycode/process_leader.c
  183. ifndef CUSTOM_MATRIX
  184. QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
  185. endif