aboutsummaryrefslogtreecommitdiff
path: root/builddefs
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-10-28 01:07:53 +0100
committerGitHub <noreply@github.com>2021-10-28 01:07:53 +0100
commitb780c797beb726839e99e3f4054f9b4c33331cdc (patch)
tree019aed772e8204149727afb0841f9043a7084eda /builddefs
parent6c507afcf212165dd5f3c3f6c026b517295c5090 (diff)
downloadqmk_firmware-b780c797beb726839e99e3f4054f9b4c33331cdc.tar.gz
qmk_firmware-b780c797beb726839e99e3f4054f9b4c33331cdc.zip
Migrate makefile utilities to sub-directory (#14917)
Diffstat (limited to 'builddefs')
-rw-r--r--builddefs/bootloader.mk163
-rw-r--r--builddefs/disable_features.mk28
-rw-r--r--builddefs/generic_features.mk49
-rw-r--r--builddefs/mcu_selection.mk668
-rw-r--r--builddefs/message.mk102
-rw-r--r--builddefs/show_options.mk147
6 files changed, 1157 insertions, 0 deletions
diff --git a/builddefs/bootloader.mk b/builddefs/bootloader.mk
new file mode 100644
index 000000000..ccb92392d
--- /dev/null
+++ b/builddefs/bootloader.mk
@@ -0,0 +1,163 @@
1# Copyright 2017 Jack Humbert
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# If it's possible that multiple bootloaders can be used for one project,
17# you can leave this unset, and the correct size will be selected
18# automatically.
19#
20# Sets the bootloader defined in the keyboard's/keymap's rules.mk
21# Current options:
22#
23# AVR:
24# halfkay PJRC Teensy
25# caterina Pro Micro (Sparkfun/generic)
26# atmel-dfu Atmel factory DFU
27# lufa-dfu LUFA DFU
28# qmk-dfu QMK DFU (LUFA + blinkenlight)
29# qmk-hid QMK HID (LUFA + blinkenlight)
30# bootloadhid HIDBootFlash compatible (ATmega32A)
31# usbasploader USBaspLoader (ATmega328P)
32# ARM:
33# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
34# stm32duino STM32Duino (STM32F103x8)
35# stm32-dfu STM32 USB DFU in ROM
36# apm32-dfu APM32 USB DFU in ROM
37# RISC-V:
38# gd32v-dfu GD32V USB DFU in ROM
39#
40# BOOTLOADER_SIZE can still be defined manually, but it's recommended
41# you add any possible configuration to this list
42
43ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
44 OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
45 OPT_DEFS += -DBOOTLOADER_DFU
46 ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
47 BOOTLOADER_SIZE = 4096
48 endif
49 ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
50 BOOTLOADER_SIZE = 8192
51 endif
52endif
53ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
54 OPT_DEFS += -DBOOTLOADER_LUFA_DFU
55 OPT_DEFS += -DBOOTLOADER_DFU
56 ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
57 BOOTLOADER_SIZE ?= 4096
58 endif
59 ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
60 BOOTLOADER_SIZE ?= 8192
61 endif
62endif
63ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
64 OPT_DEFS += -DBOOTLOADER_QMK_DFU
65 OPT_DEFS += -DBOOTLOADER_DFU
66 ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
67 BOOTLOADER_SIZE ?= 4096
68 endif
69 ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
70 BOOTLOADER_SIZE ?= 8192
71 endif
72endif
73ifeq ($(strip $(BOOTLOADER)), qmk-hid)
74 OPT_DEFS += -DBOOTLOADER_QMK_HID
75 OPT_DEFS += -DBOOTLOADER_HID
76 BOOTLOADER_SIZE ?= 4096
77endif
78ifeq ($(strip $(BOOTLOADER)), halfkay)
79 OPT_DEFS += -DBOOTLOADER_HALFKAY
80 ifeq ($(strip $(MCU)), atmega32u4)
81 BOOTLOADER_SIZE = 512
82 endif
83 ifeq ($(strip $(MCU)), at90usb1286)
84 BOOTLOADER_SIZE = 1024
85 endif
86endif
87ifeq ($(strip $(BOOTLOADER)), caterina)
88 OPT_DEFS += -DBOOTLOADER_CATERINA
89 BOOTLOADER_SIZE = 4096
90endif
91ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID))
92 OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
93 BOOTLOADER_SIZE = 4096
94endif
95ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp))
96 OPT_DEFS += -DBOOTLOADER_USBASP
97 BOOTLOADER_SIZE = 4096
98endif
99ifeq ($(strip $(BOOTLOADER)), lufa-ms)
100 OPT_DEFS += -DBOOTLOADER_MS
101 BOOTLOADER_SIZE ?= 8192
102 FIRMWARE_FORMAT = bin
103cpfirmware: lufa_warning
104.INTERMEDIATE: lufa_warning
105lufa_warning: $(FIRMWARE_FORMAT)
106 $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
107 $(info LUFA MASS STORAGE Bootloader selected)
108 $(info DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!)
109 $(info It is extremely prone to bricking, and is only included to support existing boards.)
110 $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
111endif
112ifdef BOOTLOADER_SIZE
113 OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
114endif
115
116ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
117 OPT_DEFS += -DBOOTLOADER_STM32_DFU
118
119 # Options to pass to dfu-util when flashing
120 DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
121 DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
122endif
123ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
124 OPT_DEFS += -DBOOTLOADER_APM32_DFU
125
126 # Options to pass to dfu-util when flashing
127 DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
128 DFU_SUFFIX_ARGS ?= -v 314B -p 0106
129endif
130ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
131 OPT_DEFS += -DBOOTLOADER_GD32V_DFU
132
133 # Options to pass to dfu-util when flashing
134 DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
135 DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
136endif
137ifeq ($(strip $(BOOTLOADER)), kiibohd)
138 OPT_DEFS += -DBOOTLOADER_KIIBOHD
139 ifeq ($(strip $(MCU_ORIG)), MK20DX128)
140 MCU_LDSCRIPT = MK20DX128BLDR4
141 endif
142 ifeq ($(strip $(MCU_ORIG)), MK20DX256)
143 MCU_LDSCRIPT = MK20DX256BLDR8
144 endif
145
146 # Options to pass to dfu-util when flashing
147 DFU_ARGS = -d 1C11:B007
148 DFU_SUFFIX_ARGS = -v 1C11 -p B007
149endif
150ifeq ($(strip $(BOOTLOADER)), stm32duino)
151 OPT_DEFS += -DBOOTLOADER_STM32DUINO
152 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
153 BOARD = STM32_F103_STM32DUINO
154 # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense
155 STM32_BOOTLOADER_ADDRESS = 0x80000000
156
157 # Options to pass to dfu-util when flashing
158 DFU_ARGS = -d 1EAF:0003 -a 2 -R
159 DFU_SUFFIX_ARGS = -v 1EAF -p 0003
160endif
161ifeq ($(strip $(BOOTLOADER)), tinyuf2)
162 OPT_DEFS += -DBOOTLOADER_TINYUF2
163endif
diff --git a/builddefs/disable_features.mk b/builddefs/disable_features.mk
new file mode 100644
index 000000000..090a9b5a1
--- /dev/null
+++ b/builddefs/disable_features.mk
@@ -0,0 +1,28 @@
1# Unconditionally disable features that a keyboard advertises it doesn't support
2
3FEATURE_NAMES :=
4FEATURE_NAMES += AUDIO
5FEATURE_NAMES += BACKLIGHT
6FEATURE_NAMES += BLUETOOTH
7FEATURE_NAMES += DIP_SWITCH
8FEATURE_NAMES += DYNAMIC_KEYMAP
9FEATURE_NAMES += ENCODER
10FEATURE_NAMES += HAPTIC
11FEATURE_NAMES += HD44780
12FEATURE_NAMES += IOS_DEVICE
13FEATURE_NAMES += LCD_BACKLIGHT
14FEATURE_NAMES += LCD
15FEATURE_NAMES += OLED
16FEATURE_NAMES += POINTING_DEVICE
17FEATURE_NAMES += PRINTING
18FEATURE_NAMES += PS2_MOUSE
19FEATURE_NAMES += RGBLIGHT
20FEATURE_NAMES += RGB_MATRIX
21FEATURE_NAMES += SLEEP_LED
22FEATURE_NAMES += STENO
23FEATURE_NAMES += SWAP_HANDS
24FEATURE_NAMES += WATCHDOG
25FEATURE_NAMES += XT
26
27$(foreach AFEATURE,$(FEATURE_NAMES),\
28 $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_ENABLE=no)))
diff --git a/builddefs/generic_features.mk b/builddefs/generic_features.mk
new file mode 100644
index 000000000..ff02d56bb
--- /dev/null
+++ b/builddefs/generic_features.mk
@@ -0,0 +1,49 @@
1# Copyright 2021 QMK
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
16SPACE_CADET_ENABLE ?= yes
17GRAVE_ESC_ENABLE ?= yes
18
19GENERIC_FEATURES = \
20 COMBO \
21 COMMAND \
22 DIGITIZER \
23 DIP_SWITCH \
24 DYNAMIC_KEYMAP \
25 DYNAMIC_MACRO \
26 ENCODER \
27 GRAVE_ESC \
28 HAPTIC \
29 KEY_LOCK \
30 KEY_OVERRIDE \
31 LEADER \
32 PROGRAMMABLE_BUTTON \
33 SPACE_CADET \
34 TAP_DANCE \
35 VELOCIKEY \
36 WPM \
37
38define HANDLE_GENERIC_FEATURE
39 # $$(info "Processing: $1_ENABLE $2.c")
40 SRC += $$(wildcard $$(QUANTUM_DIR)/process_keycode/process_$2.c)
41 SRC += $$(wildcard $$(QUANTUM_DIR)/$2.c)
42 OPT_DEFS += -D$1_ENABLE
43endef
44
45$(foreach F,$(GENERIC_FEATURES),\
46 $(if $(filter yes, $(strip $($(F)_ENABLE))),\
47 $(eval $(call HANDLE_GENERIC_FEATURE,$(F),$(shell echo $(F) | tr '[:upper:]' '[:lower:]'))) \
48 ) \
49)
diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk
new file mode 100644
index 000000000..1251b7a2b
--- /dev/null
+++ b/builddefs/mcu_selection.mk
@@ -0,0 +1,668 @@
1MCU_ORIG := $(MCU)
2
3ifneq ($(findstring MKL26Z64, $(MCU)),)
4 # Cortex version
5 MCU = cortex-m0plus
6
7 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
8 ARMV = 6
9
10 ## chip/board settings
11 # - the next two should match the directories in
12 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
13 MCU_FAMILY = KINETIS
14 MCU_SERIES = KL2x
15
16 # Linker script to use
17 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
18 # or <keyboard_dir>/ld/
19 MCU_LDSCRIPT ?= MKL26Z64
20
21 # Startup code to use
22 # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
23 MCU_STARTUP ?= kl2x
24
25 # Board: it should exist either in <chibios>/os/hal/boards/,
26 # <keyboard_dir>/boards/, or drivers/boards/
27 BOARD ?= PJRC_TEENSY_LC
28endif
29
30ifneq ($(findstring MK20DX128, $(MCU)),)
31 # Cortex version
32 MCU = cortex-m4
33
34 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
35 ARMV = 7
36
37 ## chip/board settings
38 # - the next two should match the directories in
39 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
40 MCU_FAMILY = KINETIS
41 MCU_SERIES = K20x
42
43 # Linker script to use
44 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
45 # or <keyboard_dir>/ld/
46 MCU_LDSCRIPT ?= MK20DX128
47
48 # Startup code to use
49 # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
50 MCU_STARTUP ?= k20x5
51
52 # Board: it should exist either in <chibios>/os/hal/boards/,
53 # <keyboard_dir>/boards/, or drivers/boards/
54 BOARD ?= PJRC_TEENSY_3
55endif
56
57ifneq ($(findstring MK20DX256, $(MCU)),)
58 # Cortex version
59 MCU = cortex-m4
60
61 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
62 ARMV = 7
63
64 ## chip/board settings
65 # - the next two should match the directories in
66 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
67 MCU_FAMILY = KINETIS
68 MCU_SERIES = K20x
69
70 # Linker script to use
71 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
72 # or <keyboard_dir>/ld/
73 MCU_LDSCRIPT ?= MK20DX256
74
75 # Startup code to use
76 # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
77 MCU_STARTUP ?= k20x7
78
79 # Board: it should exist either in <chibios>/os/hal/boards/,
80 # <keyboard_dir>/boards/, or drivers/boards/
81 BOARD ?= PJRC_TEENSY_3_1
82endif
83
84ifneq ($(findstring MK66FX1M0, $(MCU)),)
85 # Cortex version
86 MCU = cortex-m4
87
88 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
89 ARMV = 7
90
91 ## chip/board settings
92 # - the next two should match the directories in
93 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
94 MCU_FAMILY = KINETIS
95 MCU_SERIES = MK66F18
96
97 # Linker script to use
98 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
99 # or <keyboard_dir>/ld/
100 MCU_LDSCRIPT ?= MK66FX1M0
101
102 # Startup code to use
103 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
104 MCU_STARTUP ?= MK66F18
105
106 # Board: it should exist either in <chibios>/os/hal/boards/,
107 # <keyboard_dir>/boards/, or drivers/boards/
108 BOARD ?= PJRC_TEENSY_3_6
109endif
110
111ifneq ($(findstring STM32F042, $(MCU)),)
112 # Cortex version
113 MCU = cortex-m0
114
115 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
116 ARMV = 6
117
118 ## chip/board settings
119 # - the next two should match the directories in
120 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
121 MCU_FAMILY = STM32
122 MCU_SERIES = STM32F0xx
123
124 # Linker script to use
125 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
126 # or <keyboard_dir>/ld/
127 MCU_LDSCRIPT ?= STM32F042x6
128
129 # Startup code to use
130 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
131 MCU_STARTUP ?= stm32f0xx
132
133 # Board: it should exist either in <chibios>/os/hal/boards/,
134 # <keyboard_dir>/boards/, or drivers/boards/
135 BOARD ?= GENERIC_STM32_F042X6
136
137 USE_FPU ?= no
138
139 # UF2 settings
140 UF2_FAMILY ?= STM32F0
141
142 # Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced.
143 # This ensures that the EEPROM page buffer fits into RAM
144 USE_PROCESS_STACKSIZE = 0x600
145 USE_EXCEPTIONS_STACKSIZE = 0x300
146endif
147
148ifneq ($(findstring STM32F072, $(MCU)),)
149 # Cortex version
150 MCU = cortex-m0
151
152 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
153 ARMV = 6
154
155 ## chip/board settings
156 # - the next two should match the directories in
157 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
158 MCU_FAMILY = STM32
159 MCU_SERIES = STM32F0xx
160
161 # Linker script to use
162 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
163 # or <keyboard_dir>/ld/
164 MCU_LDSCRIPT ?= STM32F072xB
165
166 # Startup code to use
167 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
168 MCU_STARTUP ?= stm32f0xx
169
170 # Board: it should exist either in <chibios>/os/hal/boards/,
171 # <keyboard_dir>/boards/, or drivers/boards/
172 BOARD ?= GENERIC_STM32_F072XB
173
174 USE_FPU ?= no
175
176 # UF2 settings
177 UF2_FAMILY ?= STM32F0
178endif
179
180ifneq ($(findstring STM32F103, $(MCU)),)
181 # Cortex version
182 MCU = cortex-m3
183
184 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
185 ARMV = 7
186
187 ## chip/board settings
188 # - the next two should match the directories in
189 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
190 MCU_FAMILY = STM32
191 MCU_SERIES = STM32F1xx
192
193 # Linker script to use
194 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
195 # or <keyboard_dir>/ld/
196 MCU_LDSCRIPT ?= STM32F103x8
197
198 # Startup code to use
199 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
200 MCU_STARTUP ?= stm32f1xx
201
202 # Board: it should exist either in <chibios>/os/hal/boards/,
203 # <keyboard_dir>/boards/, or drivers/boards/
204 BOARD ?= GENERIC_STM32_F103
205
206 USE_FPU ?= no
207
208 # UF2 settings
209 UF2_FAMILY ?= STM32F1
210endif
211
212ifneq ($(findstring STM32F303, $(MCU)),)
213 # Cortex version
214 MCU = cortex-m4
215
216 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
217 ARMV = 7
218
219 ## chip/board settings
220 # - the next two should match the directories in
221 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
222 MCU_FAMILY = STM32
223 MCU_SERIES = STM32F3xx
224
225 # Linker script to use
226 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
227 # or <keyboard_dir>/ld/
228 MCU_LDSCRIPT ?= STM32F303xC
229
230 # Startup code to use
231 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
232 MCU_STARTUP ?= stm32f3xx
233
234 # Board: it should exist either in <chibios>/os/hal/boards/,
235 # <keyboard_dir>/boards/, or drivers/boards/
236 BOARD ?= GENERIC_STM32_F303XC
237
238 USE_FPU ?= yes
239
240 # UF2 settings
241 UF2_FAMILY ?= STM32F3
242endif
243
244ifneq ($(findstring STM32F401, $(MCU)),)
245 # Cortex version
246 MCU = cortex-m4
247
248 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
249 ARMV = 7
250
251 ## chip/board settings
252 # - the next two should match the directories in
253 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
254 MCU_FAMILY = STM32
255 MCU_SERIES = STM32F4xx
256
257 # Linker script to use
258 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
259 # or <keyboard_dir>/ld/
260 ifeq ($(strip $(BOOTLOADER)), tinyuf2)
261 MCU_LDSCRIPT ?= STM32F401xC_tinyuf2
262 FIRMWARE_FORMAT ?= uf2
263 else
264 MCU_LDSCRIPT ?= STM32F401xC
265 endif
266
267 # Startup code to use
268 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
269 MCU_STARTUP ?= stm32f4xx
270
271 # Board: it should exist either in <chibios>/os/hal/boards/,
272 # <keyboard_dir>/boards/, or drivers/boards/
273 BOARD ?= BLACKPILL_STM32_F401
274
275 USE_FPU ?= yes
276
277 # UF2 settings
278 UF2_FAMILY ?= STM32F4
279endif
280
281ifneq ($(findstring STM32F405, $(MCU)),)
282 # Cortex version
283 MCU = cortex-m4
284
285 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
286 ARMV = 7
287
288 ## chip/board settings
289 # - the next two should match the directories in
290 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
291 MCU_FAMILY = STM32
292 MCU_SERIES = STM32F4xx
293
294 # Linker script to use
295 # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
296 # or <keyboard_dir>/ld/
297 MCU_LDSCRIPT ?= STM32F405xG
298
299 # Startup code to use
300 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
301 MCU_STARTUP ?= stm32f4xx
302
303 # Board: it should exist either in <chibios>/os/hal/boards/,
304 # <keyboard_dir>/boards/, or drivers/boards/
305 BOARD ?= GENERIC_STM32_F405XG
306
307 USE_FPU ?= yes
308
309 # UF2 settings
310 UF2_FAMILY ?= STM32F4
311endif
312
313ifneq ($(findstring STM32F407, $(MCU)),)
314 # Cortex version
315 MCU = cortex-m4
316
317 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
318 ARMV = 7
319
320 ## chip/board settings
321 # - the next two should match the directories in
322 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
323 MCU_FAMILY = STM32
324 MCU_SERIES = STM32F4xx
325
326 # Linker script to use
327 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
328 # or <keyboard_dir>/ld/
329 MCU_LDSCRIPT ?= STM32F407xE
330
331 # Startup code to use
332 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
333 MCU_STARTUP ?= stm32f4xx
334
335 # Board: it should exist either in <chibios>/os/hal/boards/,
336 # <keyboard_dir>/boards/, or drivers/boards/
337 BOARD ?= GENERIC_STM32_F407XE
338
339 USE_FPU ?= yes
340
341 # UF2 settings
342 UF2_FAMILY ?= STM32F4
343endif
344
345ifneq ($(findstring STM32F411, $(MCU)),)
346 # Cortex version
347 MCU = cortex-m4
348
349 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
350 ARMV = 7
351
352 ## chip/board settings
353 # - the next two should match the directories in
354 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
355 MCU_FAMILY = STM32
356 MCU_SERIES = STM32F4xx
357
358 # Linker script to use
359 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
360 # or <keyboard_dir>/ld/
361 ifeq ($(strip $(BOOTLOADER)), tinyuf2)
362 MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
363 FIRMWARE_FORMAT ?= uf2
364 else
365 MCU_LDSCRIPT ?= STM32F411xE
366 endif
367
368 # Startup code to use
369 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
370 MCU_STARTUP ?= stm32f4xx
371
372 # Board: it should exist either in <chibios>/os/hal/boards/,
373 # <keyboard_dir>/boards/, or drivers/boards/
374 BOARD ?= BLACKPILL_STM32_F411
375
376 USE_FPU ?= yes
377
378 # UF2 settings
379 UF2_FAMILY ?= STM32F4
380endif
381
382ifneq ($(findstring STM32F446, $(MCU)),)
383 # Cortex version
384 MCU = cortex-m4
385
386 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
387 ARMV = 7
388
389 ## chip/board settings
390 # - the next two should match the directories in
391 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
392 MCU_FAMILY = STM32
393 MCU_SERIES = STM32F4xx
394
395 # Linker script to use
396 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
397 # or <keyboard_dir>/ld/
398 MCU_LDSCRIPT ?= STM32F446xE
399
400 # Startup code to use
401 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
402 MCU_STARTUP ?= stm32f4xx
403
404 # Board: it should exist either in <chibios>/os/hal/boards/,
405 # <keyboard_dir>/boards/, or drivers/boards/
406 BOARD ?= GENERIC_STM32_F446XE
407
408 USE_FPU ?= yes
409endif
410
411ifneq ($(findstring STM32G431, $(MCU)),)
412 # Cortex version
413 MCU = cortex-m4
414
415 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
416 ARMV = 7
417
418 ## chip/board settings
419 # - the next two should match the directories in
420 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
421 MCU_FAMILY = STM32
422 MCU_SERIES = STM32G4xx
423
424 # Linker script to use
425 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
426 # or <keyboard_dir>/ld/
427 MCU_LDSCRIPT ?= STM32G431xB
428
429 # Startup code to use
430 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
431 MCU_STARTUP ?= stm32g4xx
432
433 # Board: it should exist either in <chibios>/os/hal/boards/,
434 # <keyboard_dir>/boards/, or drivers/boards/
435 BOARD ?= GENERIC_STM32_G431XB
436
437 USE_FPU ?= yes
438
439 # UF2 settings
440 UF2_FAMILY ?= STM32G4
441endif
442
443ifneq ($(findstring STM32G474, $(MCU)),)
444 # Cortex version
445 MCU = cortex-m4
446
447 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
448 ARMV = 7
449
450 ## chip/board settings
451 # - the next two should match the directories in
452 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
453 MCU_FAMILY = STM32
454 MCU_SERIES = STM32G4xx
455
456 # Linker script to use
457 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
458 # or <keyboard_dir>/ld/
459 MCU_LDSCRIPT ?= STM32G474xE
460
461 # Startup code to use
462 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
463 MCU_STARTUP ?= stm32g4xx
464
465 # Board: it should exist either in <chibios>/os/hal/boards/,
466 # <keyboard_dir>/boards/, or drivers/boards/
467 BOARD ?= GENERIC_STM32_G474XE
468
469 USE_FPU ?= yes
470
471 # UF2 settings
472 UF2_FAMILY ?= STM32G4
473endif
474
475ifneq (,$(filter $(MCU),STM32L433 STM32L443))
476 # Cortex version
477 MCU = cortex-m4
478
479 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
480 ARMV = 7
481
482 ## chip/board settings
483 # - the next two should match the directories in
484 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
485 MCU_FAMILY = STM32
486 MCU_SERIES = STM32L4xx
487
488 # Linker script to use
489 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
490 # or <keyboard_dir>/ld/
491 MCU_LDSCRIPT ?= STM32L432xC
492
493 # Startup code to use
494 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
495 MCU_STARTUP ?= stm32l4xx
496
497 # Board: it should exist either in <chibios>/os/hal/boards/,
498 # <keyboard_dir>/boards/, or drivers/boards/
499 BOARD ?= GENERIC_STM32_L433XC
500
501 PLATFORM_NAME ?= platform_l432
502
503 USE_FPU ?= yes
504
505 # UF2 settings
506 UF2_FAMILY ?= STM32L4
507endif
508
509ifneq (,$(filter $(MCU),STM32L412 STM32L422))
510 # Cortex version
511 MCU = cortex-m4
512
513 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
514 ARMV = 7
515
516 ## chip/board settings
517 # - the next two should match the directories in
518 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
519 MCU_FAMILY = STM32
520 MCU_SERIES = STM32L4xx
521
522 # Linker script to use
523 # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
524 # or <keyboard_dir>/ld/
525 MCU_LDSCRIPT ?= STM32L412xB
526
527 # Startup code to use
528 # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
529 MCU_STARTUP ?= stm32l4xx
530
531 # Board: it should exist either in <chibios>/os/hal/boards/,
532 # <keyboard_dir>/boards/, or drivers/boards/
533 BOARD ?= GENERIC_STM32_L412XB
534
535 PLATFORM_NAME ?= platform_l432
536
537 USE_FPU ?= yes
538
539 # UF2 settings
540 UF2_FAMILY ?= STM32L4
541endif
542
543ifneq ($(findstring GD32VF103, $(MCU)),)
544 # RISC-V
545 MCU = risc-v
546
547 # RISC-V extensions and abi configuration
548 MCU_ARCH = rv32imac
549 MCU_ABI = ilp32
550 MCU_CMODEL = medlow
551
552 ## chip/board settings
553 # - the next two should match the directories in
554 # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
555 MCU_FAMILY = GD32V
556 MCU_SERIES = GD32VF103
557
558 # Linker script to use
559 # - it should exist either in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/ld/
560 # or <keyboard_dir>/ld/
561 MCU_LDSCRIPT ?= GD32VF103xB
562
563 # Startup code to use
564 # - it should exist in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/
565 MCU_STARTUP ?= gd32vf103
566
567 # Board: it should exist either in <chibios>/os/hal/boards/,
568 # <keyboard_dir>/boards/, or drivers/boards/
569 BOARD ?= SIPEED_LONGAN_NANO
570
571 USE_FPU ?= no
572endif
573
574ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
575 PROTOCOL = LUFA
576
577 # Processor frequency.
578 # This will define a symbol, F_CPU, in all source code files equal to the
579 # processor frequency in Hz. You can then use this symbol in your source code to
580 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
581 # automatically to create a 32-bit value in your source code.
582 #
583 # This will be an integer division of F_USB below, as it is sourced by
584 # F_USB after it has run through any CPU prescalers. Note that this value
585 # does not *change* the processor frequency - it should merely be updated to
586 # reflect the processor speed set externally so that the code can use accurate
587 # software delays.
588 F_CPU ?= 16000000
589
590 # LUFA specific
591 #
592 # Target architecture (see library "Board Types" documentation).
593 ARCH = AVR8
594
595 # Input clock frequency.
596 # This will define a symbol, F_USB, in all source code files equal to the
597 # input clock frequency (before any prescaling is performed) in Hz. This value may
598 # differ from F_CPU if prescaling is used on the latter, and is required as the
599 # raw input clock is fed directly to the PLL sections of the AVR for high speed
600 # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
601 # at the end, this will be done automatically to create a 32-bit value in your
602 # source code.
603 #
604 # If no clock division is performed on the input clock inside the AVR (via the
605 # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
606 F_USB ?= $(F_CPU)
607
608 # Interrupt driven control endpoint task
609 ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
610 OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
611 endif
612 ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
613 NO_I2C = yes
614 endif
615endif
616
617ifneq (,$(filter $(MCU),atmega32a))
618 # MCU name for avrdude
619 AVRDUDE_MCU = m32
620
621 PROTOCOL = VUSB
622
623 # Processor frequency.
624 # This will define a symbol, F_CPU, in all source code files equal to the
625 # processor frequency in Hz. You can then use this symbol in your source code to
626 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
627 # automatically to create a 32-bit value in your source code.
628 F_CPU ?= 12000000
629endif
630
631ifneq (,$(filter $(MCU),atmega328p))
632 # MCU name for avrdude
633 AVRDUDE_MCU = m328p
634
635 PROTOCOL = VUSB
636
637 # Processor frequency.
638 # This will define a symbol, F_CPU, in all source code files equal to the
639 # processor frequency in Hz. You can then use this symbol in your source code to
640 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
641 # automatically to create a 32-bit value in your source code.
642 F_CPU ?= 16000000
643endif
644
645ifneq (,$(filter $(MCU),atmega328))
646 # MCU name for avrdude
647 AVRDUDE_MCU = m328
648
649 PROTOCOL = VUSB
650
651 # Processor frequency.
652 # This will define a symbol, F_CPU, in all source code files equal to the
653 # processor frequency in Hz. You can then use this symbol in your source code to
654 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
655 # automatically to create a 32-bit value in your source code.
656 F_CPU ?= 16000000
657endif
658
659ifneq (,$(filter $(MCU),attiny85))
660 PROTOCOL = VUSB
661
662 # Processor frequency.
663 # This will define a symbol, F_CPU, in all source code files equal to the
664 # processor frequency in Hz. You can then use this symbol in your source code to
665 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
666 # automatically to create a 32-bit value in your source code.
667 F_CPU ?= 16500000
668endif
diff --git a/builddefs/message.mk b/builddefs/message.mk
new file mode 100644
index 000000000..cb4ef4371
--- /dev/null
+++ b/builddefs/message.mk
@@ -0,0 +1,102 @@
1COLOR ?= true
2
3ifeq ($(COLOR),true)
4 NO_COLOR=\033[0m
5 OK_COLOR=\033[32;01m
6 ERROR_COLOR=\033[31;01m
7 WARN_COLOR=\033[33;01m
8 SKIPPED_COLOR=\033[36;01m
9 BLUE=\033[0;34m
10 BOLD=\033[1m
11endif
12
13ifneq ($(shell echo "1 2 3" | awk '{ printf "%2s", $$3; }' 2>/dev/null)," 3")
14 AWK=awk
15else
16 AWK=cat && test
17endif
18
19ON_ERROR ?= exit 1
20
21OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
22ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
23WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
24SKIPPED_STRING=$(SKIPPED_COLOR)[SKIPPED]$(NO_COLOR)\n
25
26TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }'
27TAB_LOG_PLAIN = printf "%s\n" "$$LOG"
28AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
29AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
30PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
31PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
32PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
33PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
34PRINT_SKIPPED_PLAIN = ($(SILENT) || printf " $(SKIPPED_STRING)" | $(AWK_STATUS))
35PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
36BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
37MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'
38
39# The UNSYNC_OUTPUT_CMD command disables the `--output-sync` for the current command, if the `--output-sync` granularity is `target` or lower.
40# This is achieved by telling make to treat the current command as if it invokes a recursive make subcommand (as if by calling `$(MAKE)`).
41UNSYNC_OUTPUT_CMD = +true
42
43# Define Messages
44# English
45MSG_ERRORS_NONE = Errors: none
46MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
47MSG_BEGIN = -------- begin --------
48MSG_END = -------- end --------
49MSG_SIZE_BEFORE = Size before:
50MSG_SIZE_AFTER = Size after:
51MSG_COFF = Converting to AVR COFF:
52MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
53MSG_FLASH = Creating load file for flashing:
54MSG_UF2 = Creating UF2 file for deployment:
55MSG_EEPROM = Creating load file for EEPROM:
56MSG_BIN = Creating binary load file for flashing:
57MSG_EXTENDED_LISTING = Creating Extended Listing:
58MSG_SYMBOL_TABLE = Creating Symbol Table:
59MSG_EXECUTING = Executing:
60MSG_LINKING = Linking:
61MSG_COMPILING = Compiling:
62MSG_COMPILING_CXX = Compiling:
63MSG_ASSEMBLING = Assembling:
64MSG_CLEANING = Cleaning project:
65MSG_CREATING_LIBRARY = Creating library:
66MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
67Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
68MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
69
70define GENERATE_MSG_MAKE_KB
71 MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR)
72 ifneq ($$(MAKE_TARGET),)
73 MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
74 endif
75endef
76MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)
77define GENERATE_MSG_MAKE_TEST
78 MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR)
79 ifneq ($$(MAKE_TARGET),)
80 MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
81 endif
82endef
83MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
84MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
85define GENERATE_MSG_AVAILABLE_KEYMAPS
86 MSG_AVAILABLE_KEYMAPS_ACTUAL := Available keymaps for $(BOLD)$$(CURRENT_KB)$(NO_COLOR):
87endef
88MSG_AVAILABLE_KEYMAPS = $(eval $(call GENERATE_MSG_AVAILABLE_KEYMAPS))$(MSG_AVAILABLE_KEYMAPS_ACTUAL)
89
90MSG_CHECK_FILESIZE = Checking file size of $(TARGET).$(FIRMWARE_FORMAT)
91MSG_CHECK_FILESIZE_SKIPPED = (Firmware size check does not yet support $(MCU_ORIG); skipping)
92MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n
93MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
94MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
95MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
96MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Cannot run \"qmk hello\"!\n\n\
97 Please run $(BOLD)qmk setup$(NO_COLOR) to install all the dependencies QMK requires.\n\n
98MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n
99MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
100MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s (Ctrl+C to cancel)\n
101BOOTLOADER_RETRY_TIME ?= 0.5
102MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY = Bootloader not found. Trying again every $(BOOTLOADER_RETRY_TIME)s (Ctrl+C to cancel)
diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk
new file mode 100644
index 000000000..ee60597e1
--- /dev/null
+++ b/builddefs/show_options.mk
@@ -0,0 +1,147 @@
1BUILD_OPTION_NAMES = \
2 BOOTMAGIC_ENABLE \
3 MOUSEKEY_ENABLE \
4 EXTRAKEY_ENABLE \
5 CONSOLE_ENABLE \
6 COMMAND_ENABLE \
7 NKRO_ENABLE \
8 TERMINAL_ENABLE \
9 CUSTOM_MATRIX \
10 DEBOUNCE_TYPE \
11 SPLIT_KEYBOARD \
12 DYNAMIC_KEYMAP_ENABLE \
13 USB_HID_ENABLE \
14 VIA_ENABLE
15
16HARDWARE_OPTION_NAMES = \
17 SLEEP_LED_ENABLE \
18 BACKLIGHT_ENABLE \
19 BACKLIGHT_DRIVER \
20 RGBLIGHT_ENABLE \
21 RGBLIGHT_CUSTOM_DRIVER \
22 RGB_MATRIX_ENABLE \
23 RGB_MATRIX_DRIVER \
24 CIE1931_CURVE \
25 MIDI_ENABLE \
26 BLUETOOTH_ENABLE \
27 BLUETOOTH_DRIVER \
28 AUDIO_ENABLE \
29 HD44780_ENABLE \
30 ENCODER_ENABLE \
31 LED_TABLES \
32 POINTING_DEVICE_ENABLE \
33 DIP_SWITCH_ENABLE
34
35OTHER_OPTION_NAMES = \
36 UNICODE_ENABLE \
37 UCIS_ENABLE \
38 UNICODEMAP_ENABLE \
39 UNICODE_COMMON \
40 AUTO_SHIFT_ENABLE \
41 AUTO_SHIFT_MODIFIERS \
42 COMBO_ENABLE \
43 KEY_LOCK_ENABLE \
44 KEY_OVERRIDE_ENABLE \
45 LEADER_ENABLE \
46 PRINTING_ENABLE \
47 STENO_ENABLE \
48 TAP_DANCE_ENABLE \
49 VIRTSER_ENABLE \
50 OLED_ENABLE \
51 OLED_DRIVER \
52 LED_BACK_ENABLE \
53 LED_UNDERGLOW_ENABLE \
54 LED_ANIMATIONS \
55 IOS_DEVICE_ENABLE \
56 HELIX ZINC \
57 AUTOLOG_ENABLE \
58 DEBUG_ENABLE \
59 ENCODER_ENABLE_CUSTOM \
60 GERMAN_ENABLE \
61 HAPTIC_ENABLE \
62 HHKB_RN42_ENABLE \
63 ISSI_ENABLE \
64 KEYLOGGER_ENABLE \
65 LCD_BACKLIGHT_ENABLE \
66 MACROS_ENABLED \
67 PS2_MOUSE_ENABLE \
68 RAW_ENABLE \
69 SWAP_HANDS_ENABLE \
70 RING_BUFFERED_6KRO_REPORT_ENABLE \
71 WATCHDOG_ENABLE \
72 ERGOINU \
73 NO_USB_STARTUP_CHECK \
74 DISABLE_PROMICRO_LEDs \
75 MITOSIS_DATAGROK_BOTTOMSPACE \
76 MITOSIS_DATAGROK_SLOWUART \
77 RGB_MATRIX_KEYPRESSES \
78 LED_MIRRORED \
79 RGBLIGHT_FULL_POWER \
80 LTO_ENABLE \
81 PROGRAMMABLE_BUTTON_ENABLE
82
83define NAME_ECHO
84 @printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)"
85
86endef
87
88define YAML_NAME_ECHO
89 @echo ' $1 : "$(strip $($1))"'
90
91endef
92
93.PHONY: show_build_options0 show_build_options
94show_build_options0:
95 @echo " KEYBOARD = $(KEYBOARD)"
96 @echo " KEYMAP = $(KEYMAP)"
97 @echo " MCU = $(MCU)"
98 @echo " MCU_SERIES = $(MCU_SERIES)"
99 @echo " PLATFORM = $(PLATFORM)"
100 @echo " BOOTLOADER = $(BOOTLOADER)"
101 @echo " FIRMWARE_FORMAT = $(FIRMWARE_FORMAT)"
102 @echo
103 @echo "Build Options:"
104 $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
105 $(call NAME_ECHO,$(A_OPTION_NAME)))
106
107show_build_options: show_build_options0
108 @echo
109 @echo "If you want to know more, please try 'show_all_features' or 'show_full_features'"
110 @echo
111
112.PHONY: show_all_features
113show_all_features: show_build_options0
114 @echo
115 @echo "Hardware Options:"
116 $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
117 $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
118 @echo
119 @echo "Other Options:"
120 $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
121 $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
122
123.PHONY: show_full_features
124show_full_features: show_build_options0
125 @echo
126 @echo "Hardware Options:"
127 $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
128 $(call NAME_ECHO,$(A_OPTION_NAME)))
129 @echo
130 @echo "Other Options:"
131 $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
132 $(call NAME_ECHO,$(A_OPTION_NAME)))
133
134.PHONY: yaml_build_options
135yaml_build_options:
136 @echo '- KEYBOARD : "$(KEYBOARD)"'
137 @echo ' KEYMAP : "$(KEYMAP)"'
138 @echo ' MCU : "$(MCU)"'
139 @echo ' MCU_SERIES : "$(MCU_SERIES)"'
140 @echo ' PLATFORM : "$(PLATFORM)"'
141 @echo ' FIRMWARE_FORMAT : "$(FIRMWARE_FORMAT)"'
142 $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
143 $(call YAML_NAME_ECHO,$(A_OPTION_NAME)))
144 $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
145 $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))
146 $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
147 $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))