aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_full_test.mk2
-rw-r--r--build_keyboard.mk15
-rw-r--r--build_test.mk5
-rw-r--r--common.mk128
-rw-r--r--common_features.mk152
-rw-r--r--tests/basic/rules.mk4
6 files changed, 164 insertions, 142 deletions
diff --git a/build_full_test.mk b/build_full_test.mk
index 8b04cc3a4..a4fc8d820 100644
--- a/build_full_test.mk
+++ b/build_full_test.mk
@@ -18,6 +18,6 @@ include tests/$(TEST)/rules.mk
18 18
19TEST_PATH=tests/$(TEST) 19TEST_PATH=tests/$(TEST)
20 20
21$(TEST)_SRC=$(TEST_PATH)/test.c $(TMK_COMMON_SRC) 21$(TEST)_SRC=$(TEST_PATH)/test.c $(TMK_COMMON_SRC) $(QUANTUM_SRC)
22$(TEST)_DEFS=$(TMK_COMMON_DEFS) 22$(TEST)_DEFS=$(TMK_COMMON_DEFS)
23$(TEST)_CONFIG=$(TEST_PATH)/config.h 23$(TEST)_CONFIG=$(TEST_PATH)/config.h
diff --git a/build_keyboard.mk b/build_keyboard.mk
index f13d5b6d6..3ec389ac9 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -31,8 +31,6 @@ $(error MASTER does not have a valid value(left/right))
31 endif 31 endif
32endif 32endif
33 33
34
35
36KEYBOARD_PATH := keyboards/$(KEYBOARD) 34KEYBOARD_PATH := keyboards/$(KEYBOARD)
37KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c 35KEYBOARD_C := $(KEYBOARD_PATH)/$(KEYBOARD).c
38 36
@@ -42,7 +40,6 @@ else
42 $(error "$(KEYBOARD_C)" does not exist) 40 $(error "$(KEYBOARD_C)" does not exist)
43endif 41endif
44 42
45
46ifneq ($(SUBPROJECT),) 43ifneq ($(SUBPROJECT),)
47 SUBPROJECT_PATH := keyboards/$(KEYBOARD)/$(SUBPROJECT) 44 SUBPROJECT_PATH := keyboards/$(KEYBOARD)/$(SUBPROJECT)
48 SUBPROJECT_C := $(SUBPROJECT_PATH)/$(SUBPROJECT).c 45 SUBPROJECT_C := $(SUBPROJECT_PATH)/$(SUBPROJECT).c
@@ -118,19 +115,12 @@ endif
118# # project specific files 115# # project specific files
119SRC += $(KEYBOARD_C) \ 116SRC += $(KEYBOARD_C) \
120 $(KEYMAP_C) \ 117 $(KEYMAP_C) \
121 $(QUANTUM_DIR)/quantum.c \ 118 $(QUANTUM_SRC)
122 $(QUANTUM_DIR)/keymap_common.c \
123 $(QUANTUM_DIR)/keycode_config.c \
124 $(QUANTUM_DIR)/process_keycode/process_leader.c
125 119
126ifneq ($(SUBPROJECT),) 120ifneq ($(SUBPROJECT),)
127 SRC += $(SUBPROJECT_C) 121 SRC += $(SUBPROJECT_C)
128endif 122endif
129 123
130ifndef CUSTOM_MATRIX
131 SRC += $(QUANTUM_DIR)/matrix.c
132endif
133
134# Optimize size but this may cause error "relocation truncated to fit" 124# Optimize size but this may cause error "relocation truncated to fit"
135#EXTRALDFLAGS = -Wl,--relax 125#EXTRALDFLAGS = -Wl,--relax
136 126
@@ -142,9 +132,10 @@ endif
142VPATH += $(KEYBOARD_PATH) 132VPATH += $(KEYBOARD_PATH)
143VPATH += $(COMMON_VPATH) 133VPATH += $(COMMON_VPATH)
144 134
135include common_features.mk
145include $(TMK_PATH)/protocol.mk 136include $(TMK_PATH)/protocol.mk
146
147include $(TMK_PATH)/common.mk 137include $(TMK_PATH)/common.mk
138
148SRC += $(TMK_COMMON_SRC) 139SRC += $(TMK_COMMON_SRC)
149OPT_DEFS += $(TMK_COMMON_DEFS) 140OPT_DEFS += $(TMK_COMMON_DEFS)
150EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS) 141EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
diff --git a/build_test.mk b/build_test.mk
index 609b094af..cac2cba50 100644
--- a/build_test.mk
+++ b/build_test.mk
@@ -42,6 +42,11 @@ all: elf
42VPATH += $(COMMON_VPATH) 42VPATH += $(COMMON_VPATH)
43PLATFORM:=TEST 43PLATFORM:=TEST
44 44
45ifneq ($(filter $(FULL_TESTS),$(TEST)),)
46include tests/$(TEST)/rules.mk
47endif
48
49include common_features.mk
45include $(TMK_PATH)/common.mk 50include $(TMK_PATH)/common.mk
46include $(QUANTUM_PATH)/serial_link/tests/rules.mk 51include $(QUANTUM_PATH)/serial_link/tests/rules.mk
47ifneq ($(filter $(FULL_TESTS),$(TEST)),) 52ifneq ($(filter $(FULL_TESTS),$(TEST)),)
diff --git a/common.mk b/common.mk
index 51e4283ba..70f7ae099 100644
--- a/common.mk
+++ b/common.mk
@@ -11,12 +11,6 @@ QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
11 11
12BUILD_DIR := $(TOP_DIR)/.build 12BUILD_DIR := $(TOP_DIR)/.build
13 13
14SERIAL_DIR := $(QUANTUM_DIR)/serial_link
15SERIAL_PATH := $(QUANTUM_PATH)/serial_link
16SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
17SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
18SERIAL_DEFS += -DSERIAL_LINK_ENABLE
19
20COMMON_VPATH := $(TOP_DIR) 14COMMON_VPATH := $(TOP_DIR)
21COMMON_VPATH += $(TMK_PATH) 15COMMON_VPATH += $(TMK_PATH)
22COMMON_VPATH += $(QUANTUM_PATH) 16COMMON_VPATH += $(QUANTUM_PATH)
@@ -25,125 +19,3 @@ COMMON_VPATH += $(QUANTUM_PATH)/audio
25COMMON_VPATH += $(QUANTUM_PATH)/process_keycode 19COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
26COMMON_VPATH += $(QUANTUM_PATH)/api 20COMMON_VPATH += $(QUANTUM_PATH)/api
27COMMON_VPATH += $(SERIAL_PATH) 21COMMON_VPATH += $(SERIAL_PATH)
28
29ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
30 OPT_DEFS += -DAPI_SYSEX_ENABLE
31 SRC += $(QUANTUM_DIR)/api/api_sysex.c
32 OPT_DEFS += -DAPI_ENABLE
33 SRC += $(QUANTUM_DIR)/api.c
34 MIDI_ENABLE=yes
35endif
36
37MUSIC_ENABLE := 0
38
39ifeq ($(strip $(AUDIO_ENABLE)), yes)
40 OPT_DEFS += -DAUDIO_ENABLE
41 MUSIC_ENABLE := 1
42 SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
43 SRC += $(QUANTUM_DIR)/audio/audio.c
44 SRC += $(QUANTUM_DIR)/audio/voices.c
45 SRC += $(QUANTUM_DIR)/audio/luts.c
46endif
47
48ifeq ($(strip $(MIDI_ENABLE)), yes)
49 OPT_DEFS += -DMIDI_ENABLE
50 MUSIC_ENABLE := 1
51 SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
52endif
53
54ifeq ($(MUSIC_ENABLE), 1)
55 SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
56endif
57
58ifeq ($(strip $(COMBO_ENABLE)), yes)
59 OPT_DEFS += -DCOMBO_ENABLE
60 SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
61endif
62
63ifeq ($(strip $(VIRTSER_ENABLE)), yes)
64 OPT_DEFS += -DVIRTSER_ENABLE
65endif
66
67ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
68 OPT_DEFS += -DFAUXCLICKY_ENABLE
69 SRC += $(QUANTUM_DIR)/fauxclicky.c
70endif
71
72ifeq ($(strip $(UCIS_ENABLE)), yes)
73 OPT_DEFS += -DUCIS_ENABLE
74 UNICODE_COMMON = yes
75 SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
76endif
77
78ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
79 OPT_DEFS += -DUNICODEMAP_ENABLE
80 UNICODE_COMMON = yes
81 SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
82endif
83
84ifeq ($(strip $(UNICODE_ENABLE)), yes)
85 OPT_DEFS += -DUNICODE_ENABLE
86 UNICODE_COMMON = yes
87 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
88endif
89
90ifeq ($(strip $(UNICODE_COMMON)), yes)
91 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
92endif
93
94ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
95 OPT_DEFS += -DRGBLIGHT_ENABLE
96 SRC += $(QUANTUM_DIR)/light_ws2812.c
97 SRC += $(QUANTUM_DIR)/rgblight.c
98 CIE1931_CURVE = yes
99 LED_BREATHING_TABLE = yes
100endif
101
102ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
103 OPT_DEFS += -DTAP_DANCE_ENABLE
104 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
105endif
106
107ifeq ($(strip $(PRINTING_ENABLE)), yes)
108 OPT_DEFS += -DPRINTING_ENABLE
109 SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
110 SRC += $(TMK_DIR)/protocol/serial_uart.c
111endif
112
113ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
114 SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
115 OPT_DEFS += $(SERIAL_DEFS)
116 VAPTH += $(SERIAL_PATH)
117endif
118
119ifneq ($(strip $(VARIABLE_TRACE)),)
120 SRC += $(QUANTUM_DIR)/variable_trace.c
121 OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
122ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
123 OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
124endif
125endif
126
127ifeq ($(strip $(LCD_ENABLE)), yes)
128 CIE1931_CURVE = yes
129endif
130
131ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
132 ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
133 CIE1931_CURVE = yes
134 endif
135endif
136
137ifeq ($(strip $(CIE1931_CURVE)), yes)
138 OPT_DEFS += -DUSE_CIE1931_CURVE
139 LED_TABLES = yes
140endif
141
142ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
143 OPT_DEFS += -DUSE_LED_BREATHING_TABLE
144 LED_TABLES = yes
145endif
146
147ifeq ($(strip $(LED_TABLES)), yes)
148 SRC += $(QUANTUM_DIR)/led_tables.c
149endif
diff --git a/common_features.mk b/common_features.mk
new file mode 100644
index 000000000..a8a52afb9
--- /dev/null
+++ b/common_features.mk
@@ -0,0 +1,152 @@
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
16SERIAL_DIR := $(QUANTUM_DIR)/serial_link
17SERIAL_PATH := $(QUANTUM_PATH)/serial_link
18SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
19SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
20SERIAL_DEFS += -DSERIAL_LINK_ENABLE
21
22ifeq ($(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
28endif
29
30MUSIC_ENABLE := 0
31
32ifeq ($(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
39endif
40
41ifeq ($(strip $(MIDI_ENABLE)), yes)
42 OPT_DEFS += -DMIDI_ENABLE
43 MUSIC_ENABLE := 1
44 SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
45endif
46
47ifeq ($(MUSIC_ENABLE), 1)
48 SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
49endif
50
51ifeq ($(strip $(COMBO_ENABLE)), yes)
52 OPT_DEFS += -DCOMBO_ENABLE
53 SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
54endif
55
56ifeq ($(strip $(VIRTSER_ENABLE)), yes)
57 OPT_DEFS += -DVIRTSER_ENABLE
58endif
59
60ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
61 OPT_DEFS += -DFAUXCLICKY_ENABLE
62 SRC += $(QUANTUM_DIR)/fauxclicky.c
63endif
64
65ifeq ($(strip $(UCIS_ENABLE)), yes)
66 OPT_DEFS += -DUCIS_ENABLE
67 UNICODE_COMMON = yes
68 SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
69endif
70
71ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
72 OPT_DEFS += -DUNICODEMAP_ENABLE
73 UNICODE_COMMON = yes
74 SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
75endif
76
77ifeq ($(strip $(UNICODE_ENABLE)), yes)
78 OPT_DEFS += -DUNICODE_ENABLE
79 UNICODE_COMMON = yes
80 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
81endif
82
83ifeq ($(strip $(UNICODE_COMMON)), yes)
84 SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
85endif
86
87ifeq ($(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
93endif
94
95ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
96 OPT_DEFS += -DTAP_DANCE_ENABLE
97 SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
98endif
99
100ifeq ($(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
104endif
105
106ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
107 SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
108 OPT_DEFS += $(SERIAL_DEFS)
109 VAPTH += $(SERIAL_PATH)
110endif
111
112ifneq ($(strip $(VARIABLE_TRACE)),)
113 SRC += $(QUANTUM_DIR)/variable_trace.c
114 OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
115ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
116 OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
117endif
118endif
119
120ifeq ($(strip $(LCD_ENABLE)), yes)
121 CIE1931_CURVE = yes
122endif
123
124ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
125 ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
126 CIE1931_CURVE = yes
127 endif
128endif
129
130ifeq ($(strip $(CIE1931_CURVE)), yes)
131 OPT_DEFS += -DUSE_CIE1931_CURVE
132 LED_TABLES = yes
133endif
134
135ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
136 OPT_DEFS += -DUSE_LED_BREATHING_TABLE
137 LED_TABLES = yes
138endif
139
140ifeq ($(strip $(LED_TABLES)), yes)
141 SRC += $(QUANTUM_DIR)/led_tables.c
142endif
143
144QUANTUM_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
150ifndef CUSTOM_MATRIX
151 QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
152endif \ No newline at end of file
diff --git a/tests/basic/rules.mk b/tests/basic/rules.mk
index 0405b9d0f..8a906807c 100644
--- a/tests/basic/rules.mk
+++ b/tests/basic/rules.mk
@@ -11,4 +11,6 @@
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12# 12#
13# You should have received a copy of the GNU General Public License 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/>. \ No newline at end of file 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16CUSTOM_MATRIX=yes \ No newline at end of file