]> git.donarmstrong.com Git - qmk_firmware.git/blob - common_features.mk
Split common.mk into common.mk and common_features.mk
[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
22 ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
23     OPT_DEFS += -DAPI_SYSEX_ENABLE
24     SRC += $(QUANTUM_DIR)/api/api_sysex.c
25     OPT_DEFS += -DAPI_ENABLE
26     SRC += $(QUANTUM_DIR)/api.c
27     MIDI_ENABLE=yes
28 endif
29
30 MUSIC_ENABLE := 0
31
32 ifeq ($(strip $(AUDIO_ENABLE)), yes)
33     OPT_DEFS += -DAUDIO_ENABLE
34     MUSIC_ENABLE := 1
35     SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
36     SRC += $(QUANTUM_DIR)/audio/audio.c
37     SRC += $(QUANTUM_DIR)/audio/voices.c
38     SRC += $(QUANTUM_DIR)/audio/luts.c
39 endif
40
41 ifeq ($(strip $(MIDI_ENABLE)), yes)
42     OPT_DEFS += -DMIDI_ENABLE
43     MUSIC_ENABLE := 1
44     SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
45 endif
46
47 ifeq ($(MUSIC_ENABLE), 1)
48     SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
49 endif
50
51 ifeq ($(strip $(COMBO_ENABLE)), yes)
52     OPT_DEFS += -DCOMBO_ENABLE
53     SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
54 endif
55
56 ifeq ($(strip $(VIRTSER_ENABLE)), yes)
57     OPT_DEFS += -DVIRTSER_ENABLE
58 endif
59
60 ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
61     OPT_DEFS += -DFAUXCLICKY_ENABLE
62     SRC += $(QUANTUM_DIR)/fauxclicky.c
63 endif
64
65 ifeq ($(strip $(UCIS_ENABLE)), yes)
66     OPT_DEFS += -DUCIS_ENABLE
67     UNICODE_COMMON = yes
68     SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
69 endif
70
71 ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
72     OPT_DEFS += -DUNICODEMAP_ENABLE
73     UNICODE_COMMON = yes
74     SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
75 endif
76
77 ifeq ($(strip $(UNICODE_ENABLE)), yes)
78     OPT_DEFS += -DUNICODE_ENABLE
79     UNICODE_COMMON = yes
80     SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
81 endif
82
83 ifeq ($(strip $(UNICODE_COMMON)), yes)
84     SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
85 endif
86
87 ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
88     OPT_DEFS += -DRGBLIGHT_ENABLE
89     SRC += $(QUANTUM_DIR)/light_ws2812.c
90     SRC += $(QUANTUM_DIR)/rgblight.c
91     CIE1931_CURVE = yes
92     LED_BREATHING_TABLE = yes
93 endif
94
95 ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
96     OPT_DEFS += -DTAP_DANCE_ENABLE
97     SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
98 endif
99
100 ifeq ($(strip $(PRINTING_ENABLE)), yes)
101     OPT_DEFS += -DPRINTING_ENABLE
102     SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
103     SRC += $(TMK_DIR)/protocol/serial_uart.c
104 endif
105
106 ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
107     SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
108     OPT_DEFS += $(SERIAL_DEFS)
109     VAPTH += $(SERIAL_PATH)
110 endif
111
112 ifneq ($(strip $(VARIABLE_TRACE)),)
113     SRC += $(QUANTUM_DIR)/variable_trace.c
114     OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
115 ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
116     OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
117 endif
118 endif
119
120 ifeq ($(strip $(LCD_ENABLE)), yes)
121     CIE1931_CURVE = yes
122 endif
123
124 ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
125     ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
126         CIE1931_CURVE = yes
127     endif
128 endif
129
130 ifeq ($(strip $(CIE1931_CURVE)), yes)
131     OPT_DEFS += -DUSE_CIE1931_CURVE
132     LED_TABLES = yes
133 endif
134
135 ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
136     OPT_DEFS += -DUSE_LED_BREATHING_TABLE
137     LED_TABLES = yes
138 endif
139
140 ifeq ($(strip $(LED_TABLES)), yes)
141     SRC += $(QUANTUM_DIR)/led_tables.c
142 endif
143
144 QUANTUM_SRC:= \
145     $(QUANTUM_DIR)/quantum.c \
146     $(QUANTUM_DIR)/keymap_common.c \
147     $(QUANTUM_DIR)/keycode_config.c \
148     $(QUANTUM_DIR)/process_keycode/process_leader.c
149
150 ifndef CUSTOM_MATRIX
151     QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
152 endif