Parent directory

Makefile

17833 bytes
  1ifndef VERBOSE
  2.SILENT:
  3endif
  4
  5# Never run this makefile in parallel, as it could screw things up
  6# It won't affect the submakes, so you still get the speedup from specifying -jx
  7.NOTPARALLEL:
  8
  9# Allow the silent with lower caps to work the same way as upper caps
 10ifdef silent
 11    SILENT = $(silent)
 12endif
 13
 14ifdef SILENT
 15    SUB_IS_SILENT := $(SILENT)
 16endif
 17
 18# We need to make sure that silent is always turned off at the top level
 19# Otherwise the [OK], [ERROR] and [WARN] messages won't be displayed correctly
 20override SILENT := false
 21
 22ifeq ($(shell git rev-parse --is-inside-work-tree 2>/dev/null),)
 23    export SKIP_GIT := yes
 24    export NOT_REPO := yes
 25endif
 26
 27ifdef SKIP_VERSION
 28    export SKIP_GIT := yes
 29endif
 30
 31ifndef SUB_IS_SILENT
 32ifndef SKIP_GIT
 33    QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null)
 34endif
 35
 36ifneq ($(QMK_VERSION),)
 37$(info QMK Firmware $(QMK_VERSION))
 38endif
 39endif
 40
 41# Try to determine userspace from qmk config, if set.
 42ifeq ($(QMK_USERSPACE),)
 43    QMK_USERSPACE = $(shell qmk config -ro user.overlay_dir | cut -d= -f2 | sed -e 's@^None$$@@g')
 44endif
 45
 46# Determine which qmk cli to use
 47QMK_BIN := qmk
 48
 49# avoid 'Entering|Leaving directory' messages
 50MAKEFLAGS += --no-print-directory
 51
 52ON_ERROR := error_occurred=1
 53
 54BREAK_ON_ERRORS = no
 55
 56ROOT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
 57ifeq ($(ROOT_DIR),)
 58    ROOT_DIR := .
 59endif
 60
 61include paths.mk
 62
 63TEST_OUTPUT_DIR := $(BUILD_DIR)/test
 64ERROR_FILE := $(BUILD_DIR)/error_occurred
 65
 66.DEFAULT_GOAL := all:all
 67
 68
 69# Compare the start of the RULE variable with the first argument($1)
 70# If the rules equals $1 or starts with $1:, RULE_FOUND is set to true
 71#     and $1 is removed from the RULE variable
 72# Otherwise the RULE_FOUND variable is set to false, and RULE left as it was
 73# The function is a bit tricky, since there's no built in $(startswith) function
 74define COMPARE_AND_REMOVE_FROM_RULE_HELPER
 75    ifeq ($1,$$(RULE))
 76        RULE:=
 77        RULE_FOUND := true
 78    else
 79        STARTCOLON_REMOVED=$$(subst START$1:,,START$$(RULE))
 80        ifneq ($$(STARTCOLON_REMOVED),START$$(RULE))
 81            RULE_FOUND := true
 82            RULE := $$(STARTCOLON_REMOVED)
 83        else
 84            RULE_FOUND := false
 85        endif
 86    endif
 87endef
 88
 89# This makes it easier to call COMPARE_AND_REMOVE_FROM_RULE, since it makes it behave like
 90# a function that returns the value
 91COMPARE_AND_REMOVE_FROM_RULE = $(eval $(call COMPARE_AND_REMOVE_FROM_RULE_HELPER,$1))$(RULE_FOUND)
 92
 93# Try to find a match for the start of the rule to be checked
 94# $1 The list to be checked
 95# If a match is found, then RULE_FOUND is set to true
 96# and MATCHED_ITEM to the item that was matched
 97define TRY_TO_MATCH_RULE_FROM_LIST_HELPER
 98    # Split on ":", padding with empty strings to avoid indexing issues
 99    TOKEN1:=$$(shell python3 -c "import sys; print((sys.argv[1].split(':',1)+[''])[0])" $$(RULE))
100    TOKENr:=$$(shell python3 -c "import sys; print((sys.argv[1].split(':',1)+[''])[1])" $$(RULE))
101
102    FOUNDx:=$$(shell echo $1 | tr " " "\n" | grep -Fx $$(TOKEN1))
103    ifneq ($$(FOUNDx),)
104        RULE := $$(TOKENr)
105        RULE_FOUND := true
106        MATCHED_ITEM := $$(TOKEN1)
107    else
108        RULE_FOUND := false
109        MATCHED_ITEM :=
110    endif
111endef
112
113# Make it easier to call TRY_TO_MATCH_RULE_FROM_LIST
114TRY_TO_MATCH_RULE_FROM_LIST = $(eval $(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER,$1))$(RULE_FOUND)
115
116define ALL_IN_LIST_LOOP
117    OLD_RULE$1 := $$(RULE)
118    $$(eval $$(call $1,$$(ITEM$1)))
119    RULE := $$(OLD_RULE$1)
120endef
121
122define PARSE_ALL_IN_LIST
123    $$(foreach ITEM$1,$2,$$(eval $$(call ALL_IN_LIST_LOOP,$1)))
124endef
125
126# The entry point for rule parsing
127# parses a rule in the format <keyboard>:<keymap>:<target>
128# but this particular function only deals with the first <keyboard> part
129define PARSE_RULE
130    RULE := $1
131    COMMANDS :=
132    # If the rule starts with all, then continue the parsing from
133    # PARSE_ALL_KEYBOARDS
134    ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
135        KEYBOARD_RULE=all
136        $$(eval $$(call PARSE_ALL_KEYBOARDS))
137    else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,test),true)
138        $$(eval $$(call PARSE_TEST))
139    # If the rule starts with the name of a known keyboard, then continue
140    # the parsing from PARSE_KEYBOARD
141    else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(shell $(QMK_BIN) list-keyboards --no-resolve-defaults)),true)
142        KEYBOARD_RULE=$$(MATCHED_ITEM)
143        $$(eval $$(call PARSE_KEYBOARD,$$(MATCHED_ITEM)))
144    else
145        $$(info make: *** No rule to make target '$1'. Stop.)
146        $$(info |)
147        $$(info | QMK's make format is:)
148        $$(info |     make keyboard_folder:keymap_folder[:target])
149        $$(info |)
150        $$(info | Where `keyboard_folder` is the path to the keyboard relative to)
151        $$(info | `qmk_firmware/keyboards/`, and `keymap_folder` is the name of the)
152        $$(info | keymap folder under that board's `keymaps/` directory.)
153        $$(info |)
154        $$(info | Examples:)
155        $$(info |     keyboards/dz60, keyboards/dz60/keymaps/default)
156        $$(info |       -> make dz60:default)
157        $$(info |       -> qmk compile -kb dz60 -km default)
158        $$(info |     keyboards/planck/rev6, keyboards/planck/keymaps/default)
159        $$(info |       -> make planck/rev6:default:flash)
160        $$(info |       -> qmk flash -kb planck/rev6 -km default)
161        $$(info |)
162    endif
163endef
164
165# $1 = Keyboard
166# Parses a rule in the format <keymap>:<target>
167# the keyboard is already known when entering this function
168define PARSE_KEYBOARD
169    # If we want to compile the default subproject, then we need to
170    # include the correct makefile to determine the actual name of it
171    CURRENT_KB := $1
172
173    # KEYBOARD_FOLDERS := $$(subst /, , $(CURRENT_KB))
174
175    DEFAULT_FOLDER := $$(CURRENT_KB)
176
177    # We assume that every rules.mk will contain the full default value
178    $$(eval include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/rules.mk)
179    ifneq ($$(DEFAULT_FOLDER),$$(CURRENT_KB))
180        $$(eval include $(ROOT_DIR)/keyboards/$$(DEFAULT_FOLDER)/rules.mk)
181    endif
182    CURRENT_KB := $$(DEFAULT_FOLDER)
183
184    # 5/4/3/2/1
185    KEYBOARD_FOLDER_PATH_1 := $$(CURRENT_KB)
186    KEYBOARD_FOLDER_PATH_2 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_1)))
187    KEYBOARD_FOLDER_PATH_3 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_2)))
188    KEYBOARD_FOLDER_PATH_4 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_3)))
189    KEYBOARD_FOLDER_PATH_5 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_4)))
190
191    KEYMAPS :=
192    # get a list of all keymaps
193    KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/keymaps/*/.)))
194    KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/keymaps/*/.)))
195    KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/keymaps/*/.)))
196    KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.)))
197    KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.)))
198
199    ifneq ($(QMK_USERSPACE),)
200        KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/keymaps/*/.)))
201        KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/keymaps/*/.)))
202        KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/keymaps/*/.)))
203        KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.)))
204        KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.)))
205    endif
206
207    KEYBOARD_LAYOUTS := $(shell $(QMK_BIN) list-layouts --keyboard $1)
208    LAYOUT_KEYMAPS :=
209    $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.)))))
210    ifneq ($(QMK_USERSPACE),)
211        $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(QMK_USERSPACE)/layouts/$$(LAYOUT)/*/.)))))
212    endif
213
214    KEYMAPS := $$(sort $$(KEYMAPS) $$(LAYOUT_KEYMAPS))
215
216    # if the rule after removing the start of it is empty (we haven't specified a kemap or target)
217    # compile all the keymaps
218    ifeq ($$(RULE),)
219        $$(eval $$(call PARSE_ALL_KEYMAPS))
220    # The same if all was specified
221    else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
222        $$(eval $$(call PARSE_ALL_KEYMAPS))
223    # List all keymaps for the given keyboard
224    else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,list-keymaps),true)
225        $$(eval $$(call LIST_ALL_KEYMAPS))
226    # Try to match the specified keyamp with the list of known keymaps
227    else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
228        $$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
229    # Otherwise try to match the keymap from the current folder, or arguments to the make command
230    else ifneq ($$(KEYMAP),)
231        $$(eval $$(call PARSE_KEYMAP,$$(KEYMAP)))
232    # Otherwise if we are running make all:<user> just skip
233    else ifeq ($$(KEYBOARD_RULE),all)
234        # $$(info Skipping: No user keymap for $$(CURRENT_KB))
235    # Otherwise, make all keymaps, again this is consistent with how it works without
236    # any arguments
237    else
238        $$(eval $$(call PARSE_ALL_KEYMAPS))
239    endif
240endef
241
242# if we are going to compile all keyboards, match the rest of the rule
243# for each of them
244define PARSE_ALL_KEYBOARDS
245    $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(shell $(QMK_BIN) list-keyboards --no-resolve-defaults)))
246endef
247
248# Prints a list of all known keymaps for the given keyboard
249define LIST_ALL_KEYMAPS
250    COMMAND_true_LIST_KEYMAPS := \
251        printf "$$(KEYMAPS)\n";
252    COMMAND_false_LIST_KEYMAPS := \
253        printf "$$(MSG_AVAILABLE_KEYMAPS)\n"; \
254        printf "$$(KEYMAPS)\n";
255    COMMANDS += LIST_KEYMAPS
256endef
257
258# $1 Keymap
259# This is the meat of compiling a keyboard, when entering this, everything is known
260# keyboard, subproject, and keymap
261# Note that we are not directly calling the command here, but instead building a list,
262# which will later be processed
263define PARSE_KEYMAP
264    CURRENT_KM = $1
265    # The rest of the rule is the target
266    # Remove the leading ":" from the target, as it acts as a separator
267    MAKE_TARGET := $$(patsubst :%,%,$$(RULE))
268    # We need to generate an unique identifier to append to the COMMANDS list
269    CURRENT_KB_UNDER := $$(subst /,_,$$(CURRENT_KB))
270    COMMAND := COMMAND_KEYBOARD_$$(CURRENT_KB_UNDER)_KEYMAP_$$(CURRENT_KM)
271    # If we are compiling a keyboard without a subproject, we want to display just the name
272    # of the keyboard, otherwise keyboard/subproject
273    KB_SP := $$(CURRENT_KB)
274    # Format it in bold
275    KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR)
276    # Specify the variables that we are passing forward to submake
277    MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) QMK_BIN=$$(QMK_BIN)
278    # And the first part of the make command
279    MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_keyboard.mk $$(MAKE_TARGET)
280    # The message to display
281    MAKE_MSG := $$(MSG_MAKE_KB)
282    # We run the command differently, depending on if we want more output or not
283    # The true version for silent output and the false version otherwise
284    $$(eval $$(call BUILD))
285endef
286
287define BUILD
288    MAKE_VARS += VERBOSE=$(VERBOSE) COLOR=$(COLOR)
289    COMMANDS += $$(COMMAND)
290    COMMAND_true_$$(COMMAND) := \
291        printf "$$(MAKE_MSG)" | \
292        $$(MAKE_MSG_FORMAT); \
293        LOG=$$$$($$(MAKE_CMD) $$(MAKE_VARS) SILENT=true 2>&1) ; \
294        if [ $$$$? -gt 0 ]; \
295            then $$(PRINT_ERROR_PLAIN); \
296        elif [ "$$$$LOG" = "skipped" ] ; \
297            then $$(PRINT_SKIPPED_PLAIN); \
298        elif [ "$$$$LOG" != "" ] ; \
299            then $$(PRINT_WARNING_PLAIN); \
300        else \
301            $$(PRINT_OK); \
302        fi;
303    COMMAND_false_$$(COMMAND) := \
304        printf "$$(MAKE_MSG)\n\n"; \
305        $$(MAKE_CMD) $$(MAKE_VARS) SILENT=false; \
306        if [ $$$$? -gt 0 ]; \
307            then error_occurred=1; \
308        fi;
309endef
310
311# Just parse all the keymaps for a specific keyboard
312define PARSE_ALL_KEYMAPS
313    $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
314endef
315
316define BUILD_TEST
317    TEST_PATH := $1
318    TEST_NAME := $$(notdir $$(TEST_PATH))
319    TEST_FULL_NAME := $$(subst /,_,$$(patsubst $$(ROOT_DIR)tests/%,%,$$(TEST_PATH)))
320    MAKE_TARGET := $2
321    COMMAND := $1
322    MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f $(BUILDDEFS_PATH)/build_test.mk $$(MAKE_TARGET)
323    MAKE_VARS := TEST=$$(TEST_NAME) TEST_OUTPUT=$$(TEST_FULL_NAME) TEST_PATH=$$(TEST_PATH) FULL_TESTS="$$(FULL_TESTS)"
324    MAKE_MSG := $$(MSG_MAKE_TEST)
325    $$(eval $$(call BUILD))
326    ifneq ($$(MAKE_TARGET),clean)
327        TEST_EXECUTABLE := $$(TEST_OUTPUT_DIR)/$$(TEST_FULL_NAME).elf
328        TESTS += $$(TEST_FULL_NAME)
329        TEST_MSG := $$(MSG_TEST)
330        $$(TEST_FULL_NAME)_COMMAND := \
331            printf "$$(TEST_MSG)\n"; \
332            $$(TEST_EXECUTABLE); \
333            if [ $$$$? -gt 0 ]; \
334                then error_occurred=1; \
335            fi; \
336            printf "\n";
337    endif
338endef
339
340define LIST_TEST
341    include $(BUILDDEFS_PATH)/testlist.mk
342    FOUND_TESTS := $$(patsubst ./tests/%,%,$$(TEST_LIST))
343    $$(info $$(FOUND_TESTS))
344endef
345
346define PARSE_TEST
347    TESTS :=
348    TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
349    TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
350    include $(BUILDDEFS_PATH)/testlist.mk
351    ifeq ($$(TEST_NAME),all)
352        MATCHED_TESTS := $$(TEST_LIST)
353    else
354        MATCHED_TESTS := $$(foreach TEST, $$(TEST_LIST),$$(if $$(findstring x$$(TEST_NAME)x, x$$(patsubst ./tests/%,%,$$(TEST)x)), $$(TEST),))
355    endif
356    $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
357endef
358
359
360# Set the silent mode depending on if we are trying to compile multiple keyboards or not
361# By default it's on in that case, but it can be overridden by specifying silent=false
362# from the command line
363define SET_SILENT_MODE
364    ifdef SUB_IS_SILENT
365        SILENT_MODE := $(SUB_IS_SILENT)
366    else ifeq ($$(words $$(COMMANDS)),1)
367        SILENT_MODE := false
368    else
369        SILENT_MODE := true
370    endif
371endef
372
373include $(BUILDDEFS_PATH)/message.mk
374
375ifeq ($(strip $(BREAK_ON_ERRORS)), yes)
376HANDLE_ERROR = exit 1
377else
378HANDLE_ERROR = echo $$error_occurred > $(ERROR_FILE)
379endif
380
381# The empty line is important here, as it will force a new shell to be created for each command
382# Otherwise the command line will become too long with a lot of keyboards and keymaps
383define RUN_COMMAND
384+error_occurred=0;\
385$(COMMAND_$(SILENT_MODE)_$(COMMAND))\
386if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
387
388
389endef
390define RUN_TEST
391+error_occurred=0;\
392$($(TEST)_COMMAND)\
393if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
394
395
396endef
397
398# Catch everything and parse the command line ourselves.
399.PHONY: %
400%:
401	# Ensure that $(QMK_BIN) works.
402	if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
403ifdef NOT_REPO
404	printf "$(MSG_NOT_REPO)"
405endif
406ifndef SKIP_GIT
407	$(QMK_BIN) git-submodule --sync
408	# Check if the submodules are dirty, and display a warning if they are
409	if ! $(QMK_BIN) git-submodule --check 1> /dev/null 2>&1; then printf "$(MSG_SUBMODULE_DIRTY)"; fi
410endif
411	rm -f $(ERROR_FILE) > /dev/null 2>&1
412	$(eval $(call PARSE_RULE,$@))
413	$(eval $(call SET_SILENT_MODE))
414	# Run all the commands in the same shell, notice the + at the first line
415	# it has to be there to allow parallel execution of the submake
416	# This always tries to compile everything, even if error occurs in the middle
417	# But we return the error code at the end, to trigger travis failures
418	# The sort at this point is to remove duplicates
419	$(foreach COMMAND,$(sort $(COMMANDS)),$(RUN_COMMAND))
420	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
421	$(foreach TEST,$(sort $(TESTS)),$(RUN_TEST))
422	if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
423
424lib/%:
425	git submodule sync $?
426	git submodule update --init $?
427
428.PHONY: git-submodule
429git-submodule:
430	$(QMK_BIN) git-submodule
431
432.PHONY: git-submodules
433git-submodules: git-submodule
434
435.PHONY: list-keyboards
436list-keyboards:
437	$(QMK_BIN) list-keyboards --no-resolve-defaults | tr '\n' ' '
438
439.PHONY: list-tests
440list-tests:
441	$(eval $(call LIST_TEST))
442
443.PHONY: generate-keyboards-file
444generate-keyboards-file:
445	$(QMK_BIN) list-keyboards --no-resolve-defaults
446
447.PHONY: clean
448clean:
449	echo -n 'Deleting .build/ ... '
450	rm -rf $(BUILD_DIR)
451	echo 'done.'
452
453.PHONY: distclean distclean_qmk
454distclean: distclean_qmk
455distclean_qmk: clean
456	echo -n 'Deleting *.bin, *.hex, and *.uf2 ... '
457	rm -f *.bin *.hex *.uf2
458	echo 'done.'
459
460ifneq ($(QMK_USERSPACE),)
461.PHONY: distclean_userspace
462distclean: distclean_userspace
463distclean_userspace: clean
464	echo -n 'Deleting userspace *.bin, *.hex, and *.uf2 ... '
465	rm -f $(QMK_USERSPACE)/*.bin $(QMK_USERSPACE)/*.hex $(QMK_USERSPACE)/*.uf2
466	echo 'done.'
467endif
468
469# Extra targets for formatting and/or pytest, running within the qmk/qmk_cli container to match GHA.
470CONTAINER_PREAMBLE := export HOME="/tmp"; export PATH="/tmp/.local/bin:\$$PATH"; python3 -m pip install --upgrade pip; python3 -m pip install -r requirements-dev.txt
471
472.PHONY: format-core
473format-core:
474	RUNTIME=docker ./util/docker_cmd.sh bash -lic "$(CONTAINER_PREAMBLE); qmk format-c --core-only -a && qmk format-python -a"
475
476.PHONY: pytest
477pytest:
478	RUNTIME=docker ./util/docker_cmd.sh bash -lic "$(CONTAINER_PREAMBLE); qmk pytest"
479
480.PHONY: format-and-pytest
481format-and-pytest:
482	RUNTIME=docker ./util/docker_cmd.sh bash -lic "$(CONTAINER_PREAMBLE); qmk format-c --core-only -a && qmk format-python -a && qmk pytest"