logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

Makefile (18393B)


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