]> git.donarmstrong.com Git - qmk_firmware.git/blob - common_features.mk
Keymap: Clicky frequency modulation (#4012)
[qmk_firmware.git] / common_features.mk
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
16 SERIAL_DIR := $(QUANTUM_DIR)/serial_link
17 SERIAL_PATH := $(QUANTUM_PATH)/serial_link
18 SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
19 SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
20 SERIAL_DEFS += -DSERIAL_LINK_ENABLE
21 COMMON_VPATH += $(SERIAL_PATH)
22
23 ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
24     OPT_DEFS += -DAPI_SYSEX_ENABLE
25     SRC += $(QUANTUM_DIR)/api/api_sysex.c
26     OPT_DEFS += -DAPI_ENABLE
27     SRC += $(QUANTUM_DIR)/api.c
28     MIDI_ENABLE=yes
29 endif
30
31 MUSIC_ENABLE := 0
32
33 ifeq ($(strip $(AUDIO_ENABLE)), yes)
34     OPT_DEFS += -DAUDIO_ENABLE
35     MUSIC_ENABLE := 1
36     SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
37     SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
38     ifeq ($(PLATFORM),AVR)
39         SRC += $(QUANTUM_DIR)/audio/audio.c
40     else
41         SRC += $(QUANTUM_DIR)/audio/audio_arm.c
42     endif
43     SRC += $(QUANTUM_DIR)/audio/voices.c
44     SRC += $(QUANTUM_DIR)/audio/luts.c
45 endif
46
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
53 ifeq ($(MUSIC_ENABLE), 1)
54     SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
55 endif
56
57 ifeq ($(strip $(COMBO_ENABLE)), yes)
58     OPT_DEFS += -DCOMBO_ENABLE
59     SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
60 endif
61
62 ifeq ($(strip $(STENO_ENABLE)), yes)
63     OPT_DEFS += -DSTENO_ENABLE
64     VIRTSER_ENABLE := yes
65     SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
66 endif
67
68 ifeq ($(strip $(VIRTSER_ENABLE)), yes)
69     OPT_DEFS += -DVIRTSER_ENABLE
70 endif
71
72 ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
73     OPT_DEFS += -DFAUXCLICKY_ENABLE
74     SRC += $(QUANTUM_DIR)/fauxclicky.c
75 endif
76
77 ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
78     OPT_DEFS += -DPOINTING_DEVICE_ENABLE
79     OPT_DEFS += -DMOUSE_ENABLE
80     SRC += $(QUANTUM_DIR)/pointing_device.c
81 endif
82
83 ifeq ($(strip $(UCIS_ENABLE)), yes)
84     OPT_DEFS += -DUCIS_ENABLE
85     UNICODE_COMMON = yes
86     SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
87 endif
88
89 ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
90     OPT_DEFS += -DUNICODEMAP_ENABLE
91     UNICODE_COMMON = yes
92     SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
93 endif
94
95 ifeq ($(strip $(UNICODE_ENABLE)), yes)
96     OPT_DEFS += -DUNICODE_ENABLE
97     UNICODE_COMMON = yes
98     SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
99 endif
100
101 ifeq ($(strip $(UNICODE_COMMON)), yes)
102     SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
103 endif
104
105 ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
106     OPT_DEFS += -DRGBLIGHT_ENABLE
107     SRC += $(QUANTUM_DIR)/rgblight.c
108     CIE1931_CURVE = yes
109     LED_BREATHING_TABLE = yes
110     ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
111         OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
112     else
113         SRC += ws2812.c
114     endif
115 endif
116
117 RGB_MATRIX_ENABLE ?= no
118 VALID_MATRIX_TYPES := yes IS31FL3731L IS31FL3733L custom
119 ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
120 ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
121     $(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type)
122 endif
123     OPT_DEFS += -DRGB_MATRIX_ENABLE
124     SRC += $(QUANTUM_DIR)/color.c
125     SRC += $(QUANTUM_DIR)/rgb_matrix.c
126     SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
127     CIE1931_CURVE = yes
128 endif
129
130 ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
131         RGB_MATRIX_ENABLE = IS31FL3731
132 endif
133
134 ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
135     OPT_DEFS += -DIS31FL3731
136     COMMON_VPATH += $(DRIVER_PATH)/issi
137     SRC += is31fl3731.c
138     SRC += i2c_master.c
139 endif
140
141 ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
142     OPT_DEFS += -DIS31FL3733
143     COMMON_VPATH += $(DRIVER_PATH)/issi
144     SRC += is31fl3733.c
145     SRC += i2c_master.c
146 endif
147
148 ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
149     OPT_DEFS += -DTAP_DANCE_ENABLE
150     SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
151 endif
152
153 ifeq ($(strip $(KEY_LOCK_ENABLE)), yes)
154     OPT_DEFS += -DKEY_LOCK_ENABLE
155     SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c
156 endif
157
158 ifeq ($(strip $(PRINTING_ENABLE)), yes)
159     OPT_DEFS += -DPRINTING_ENABLE
160     SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
161     SRC += $(TMK_DIR)/protocol/serial_uart.c
162 endif
163
164 ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
165     OPT_DEFS += -DAUTO_SHIFT_ENABLE
166     SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
167     ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
168         OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
169     endif
170 endif
171
172 ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
173     SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
174     OPT_DEFS += $(SERIAL_DEFS)
175     VAPTH += $(SERIAL_PATH)
176 endif
177
178 ifneq ($(strip $(VARIABLE_TRACE)),)
179     SRC += $(QUANTUM_DIR)/variable_trace.c
180     OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
181 ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
182     OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
183 endif
184 endif
185
186 ifeq ($(strip $(LCD_ENABLE)), yes)
187     CIE1931_CURVE = yes
188 endif
189
190 ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
191     ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
192         CIE1931_CURVE = yes
193     endif
194         ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
195         OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
196     endif
197 endif
198
199 ifeq ($(strip $(CIE1931_CURVE)), yes)
200     OPT_DEFS += -DUSE_CIE1931_CURVE
201     LED_TABLES = yes
202 endif
203
204 ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
205     OPT_DEFS += -DUSE_LED_BREATHING_TABLE
206     LED_TABLES = yes
207 endif
208
209 ifeq ($(strip $(LED_TABLES)), yes)
210     SRC += $(QUANTUM_DIR)/led_tables.c
211 endif
212
213 ifeq ($(strip $(TERMINAL_ENABLE)), yes)
214     SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
215     OPT_DEFS += -DTERMINAL_ENABLE
216 endif
217
218 ifeq ($(strip $(USB_HID_ENABLE)), yes)
219     include $(TMK_DIR)/protocol/usb_hid.mk
220 endif
221
222 ifeq ($(strip $(HD44780_ENABLE)), yes)
223     SRC += drivers/avr/hd44780.c
224     OPT_DEFS += -DHD44780_ENABLE
225 endif
226
227 ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes)
228     OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE
229     SRC += $(QUANTUM_DIR)/dynamic_keymap.c
230 endif
231
232 ifeq ($(strip $(LEADER_ENABLE)), yes)
233   SRC += $(QUANTUM_DIR)/process_keycode/process_leader.c
234   OPT_DEFS += -DLEADER_ENABLE
235 endif
236
237 QUANTUM_SRC:= \
238     $(QUANTUM_DIR)/quantum.c \
239     $(QUANTUM_DIR)/keymap_common.c \
240     $(QUANTUM_DIR)/keycode_config.c
241
242 ifndef CUSTOM_MATRIX
243     ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
244         QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c
245     else
246         QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
247     endif
248 endif
249
250 ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
251     OPT_DEFS += -DSPLIT_KEYBOARD
252     QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_flags.c \
253                 $(QUANTUM_DIR)/split_common/split_util.c \
254                 $(QUANTUM_DIR)/split_common/i2c.c \
255                 $(QUANTUM_DIR)/split_common/serial.c
256 endif