You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

664 lines
25 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
  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. ifndef SUB_IS_SILENT
  18. ifndef SKIP_GIT
  19. QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null)
  20. endif
  21. ifneq ($(QMK_VERSION),)
  22. $(info QMK Firmware $(QMK_VERSION))
  23. endif
  24. endif
  25. # avoid 'Entering|Leaving directory' messages
  26. MAKEFLAGS += --no-print-directory
  27. ON_ERROR := error_occurred=1
  28. BREAK_ON_ERRORS = no
  29. STARTING_MAKEFILE := $(firstword $(MAKEFILE_LIST))
  30. ROOT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
  31. ROOT_DIR := $(dir $(ROOT_MAKEFILE))
  32. ifeq ($(ROOT_DIR),)
  33. ROOT_DIR := .
  34. endif
  35. ABS_STARTING_MAKEFILE := $(abspath $(STARTING_MAKEFILE))
  36. ABS_ROOT_MAKEFILE := $(abspath $(ROOT_MAKEFILE))
  37. ABS_STARTING_DIR := $(dir $(ABS_STARTING_MAKEFILE))
  38. ABS_ROOT_DIR := $(dir $(ABS_ROOT_MAKEFILE))
  39. STARTING_DIR := $(subst $(ABS_ROOT_DIR),,$(ABS_STARTING_DIR))
  40. BUILD_DIR := $(ROOT_DIR)/.build
  41. TEST_DIR := $(BUILD_DIR)/test
  42. ERROR_FILE := $(BUILD_DIR)/error_occurred
  43. MAKEFILE_INCLUDED=yes
  44. # Helper function to process the newt element of a space separated path
  45. # It works a bit like the traditional functional head tail
  46. # so the CURRENT_PATH_ELEMENT will become the new head
  47. # and the PATH_ELEMENTS are the rest that are still unprocessed
  48. define NEXT_PATH_ELEMENT
  49. $$(eval CURRENT_PATH_ELEMENT := $$(firstword $$(PATH_ELEMENTS)))
  50. $$(eval PATH_ELEMENTS := $$(wordlist 2,9999,$$(PATH_ELEMENTS)))
  51. endef
  52. # We change the / to spaces so that we more easily can work with the elements
  53. # separately
  54. PATH_ELEMENTS := $(subst /, ,$(STARTING_DIR))
  55. # Initialize the path elements list for further processing
  56. $(eval $(call NEXT_PATH_ELEMENT))
  57. # This function sets the KEYBOARD; KEYMAP and SUBPROJECT to the correct
  58. # variables depending on which directory you stand in.
  59. # It's really a very simple if else chain, if you squint enough,
  60. # but the makefile syntax makes it very verbose.
  61. # If we are in a subfolder of keyboards
  62. #
  63. # *** No longer needed **
  64. #
  65. # ifeq ($(CURRENT_PATH_ELEMENT),keyboards)
  66. # $(eval $(call NEXT_PATH_ELEMENT))
  67. # KEYBOARD := $(CURRENT_PATH_ELEMENT)
  68. # $(eval $(call NEXT_PATH_ELEMENT))
  69. # # If we are in a subfolder of keymaps, or in other words in a keymap
  70. # # folder
  71. # ifeq ($(CURRENT_PATH_ELEMENT),keymaps)
  72. # $(eval $(call NEXT_PATH_ELEMENT))
  73. # KEYMAP := $(CURRENT_PATH_ELEMENT)
  74. # # else if we are not in the keyboard folder itself
  75. # else ifneq ($(CURRENT_PATH_ELEMENT),)
  76. # # the we can assume it's a subproject, as no other folders
  77. # # should have make files in them
  78. # SUBPROJECT := $(CURRENT_PATH_ELEMENT)
  79. # $(eval $(call NEXT_PATH_ELEMENT))
  80. # # if we are inside a keymap folder of a subproject
  81. # ifeq ($(CURRENT_PATH_ELEMENT),keymaps)
  82. # $(eval $(call NEXT_PATH_ELEMENT))
  83. # KEYMAP := $(CURRENT_PATH_ELEMENT)
  84. # endif
  85. # endif
  86. # endif
  87. define GET_KEYBOARDS
  88. ifndef ALT_GET_KEYBOARDS
  89. All_RULES_MK := $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/rules.mk))
  90. All_RULES_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/rules.mk))
  91. All_RULES_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/rules.mk))
  92. All_RULES_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/*/rules.mk))
  93. KEYMAPS_MK := $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/keymaps/*/rules.mk))
  94. KEYMAPS_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/keymaps/*/rules.mk))
  95. KEYMAPS_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/keymaps/*/rules.mk))
  96. KEYMAPS_MK += $$(patsubst $(ROOT_DIR)/keyboards/%/rules.mk,%,$$(wildcard $(ROOT_DIR)/keyboards/*/*/*/*/keymaps/*/rules.mk))
  97. KEYBOARDS := $$(sort $$(filter-out $$(KEYMAPS_MK), $$(All_RULES_MK)))
  98. else
  99. KEYBOARDS := $(shell find keyboards/ -type f -iname "rules.mk" | grep -v keymaps | sed 's!keyboards/\(.*\)/rules.mk!\1!' | sort | uniq)
  100. endif
  101. endef
  102. $(eval $(call GET_KEYBOARDS))
  103. # Only consider folders with makefiles, to prevent errors in case there are extra folders
  104. #KEYBOARDS += $(patsubst $(ROOD_DIR)/keyboards/%/rules.mk,%,$(wildcard $(ROOT_DIR)/keyboards/*/*/rules.mk))
  105. .PHONY: list-keyboards
  106. list-keyboards:
  107. echo $(KEYBOARDS)
  108. define PRINT_KEYBOARD
  109. $(info $(PRINTING_KEYBOARD))
  110. endef
  111. .PHONY: generate-keyboards-file
  112. generate-keyboards-file:
  113. $(foreach PRINTING_KEYBOARD,$(KEYBOARDS),$(eval $(call PRINT_KEYBOARD)))
  114. .PHONY: clean
  115. clean:
  116. echo -n 'Deleting .build/ ... '
  117. rm -rf $(BUILD_DIR)
  118. echo 'done.'
  119. .PHONY: distclean
  120. distclean: clean
  121. echo -n 'Deleting *.bin and *.hex ... '
  122. rm -f *.bin *.hex
  123. echo 'done.'
  124. #Compatibility with the old make variables, anything you specify directly on the command line
  125. # always overrides the detected folders
  126. ifdef keyboard
  127. KEYBOARD := $(keyboard)
  128. endif
  129. ifdef keymap
  130. KEYMAP := $(keymap)
  131. endif
  132. # Uncomment these for debugging
  133. # $(info Keyboard: $(KEYBOARD))
  134. # $(info Keymap: $(KEYMAP))
  135. # $(info Subproject: $(SUBPROJECT))
  136. # $(info Keyboards: $(KEYBOARDS))
  137. # Set the default goal depending on where we are running make from
  138. # this handles the case where you run make without any arguments
  139. .DEFAULT_GOAL := all:all
  140. ifneq ($(KEYMAP),)
  141. .DEFAULT_GOAL := $(KEYBOARD):$(KEYMAP)
  142. else ifneq ($(KEYBOARD),)
  143. # Inside a keyboard folder, build all keymaps for all subprojects
  144. # Note that this is different from the old behaviour, which would
  145. # build only the default keymap of the default keyboard
  146. .DEFAULT_GOAL := $(KEYBOARD):all
  147. endif
  148. # Compare the start of the RULE variable with the first argument($1)
  149. # If the rules equals $1 or starts with $1:, RULE_FOUND is set to true
  150. # and $1 is removed from the RULE variable
  151. # Otherwise the RULE_FOUND variable is set to false, and RULE left as it was
  152. # The function is a bit tricky, since there's no built in $(startswith) function
  153. define COMPARE_AND_REMOVE_FROM_RULE_HELPER
  154. ifeq ($1,$$(RULE))
  155. RULE:=
  156. RULE_FOUND := true
  157. else
  158. STARTCOLON_REMOVED=$$(subst START$1:,,START$$(RULE))
  159. ifneq ($$(STARTCOLON_REMOVED),START$$(RULE))
  160. RULE_FOUND := true
  161. RULE := $$(STARTCOLON_REMOVED)
  162. else
  163. RULE_FOUND := false
  164. endif
  165. endif
  166. endef
  167. # This makes it easier to call COMPARE_AND_REMOVE_FROM_RULE, since it makes it behave like
  168. # a function that returns the value
  169. COMPARE_AND_REMOVE_FROM_RULE = $(eval $(call COMPARE_AND_REMOVE_FROM_RULE_HELPER,$1))$(RULE_FOUND)
  170. # Recursively try to find a match for the start of the rule to be checked
  171. # $1 The list to be checked
  172. # If a match is found, then RULE_FOUND is set to true
  173. # and MATCHED_ITEM to the item that was matched
  174. define TRY_TO_MATCH_RULE_FROM_LIST_HELPER3
  175. ifneq ($1,)
  176. ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,$$(firstword $1)),true)
  177. MATCHED_ITEM := $$(firstword $1)
  178. else
  179. $$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER3,$$(wordlist 2,9999,$1)))
  180. endif
  181. endif
  182. endef
  183. # A recursive helper function for finding the longest match
  184. # $1 The list to be checked
  185. # It works by always removing the currently matched item from the list
  186. # and call itself recursively, until a match is found
  187. define TRY_TO_MATCH_RULE_FROM_LIST_HELPER2
  188. # Stop the recursion when the list is empty
  189. ifneq ($1,)
  190. RULE_BEFORE := $$(RULE)
  191. $$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER3,$1))
  192. # If a match is found in the current list, otherwise just return what we had before
  193. ifeq ($$(RULE_FOUND),true)
  194. # Save the best match so far and call itself recursively
  195. BEST_MATCH := $$(MATCHED_ITEM)
  196. BEST_MATCH_RULE := $$(RULE)
  197. RULE_FOUND := false
  198. RULE := $$(RULE_BEFORE)
  199. $$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER2,$$(filter-out $$(MATCHED_ITEM),$1)))
  200. endif
  201. endif
  202. endef
  203. # Recursively try to find the longest match for the start of the rule to be checked
  204. # $1 The list to be checked
  205. # If a match is found, then RULE_FOUND is set to true
  206. # and MATCHED_ITEM to the item that was matched
  207. define TRY_TO_MATCH_RULE_FROM_LIST_HELPER
  208. BEST_MATCH :=
  209. $$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER2,$1))
  210. ifneq ($$(BEST_MATCH),)
  211. RULE_FOUND := true
  212. RULE := $$(BEST_MATCH_RULE)
  213. MATCHED_ITEM := $$(BEST_MATCH)
  214. else
  215. RULE_FOUND := false
  216. MATCHED_ITEM :=
  217. endif
  218. endef
  219. # Make it easier to call TRY_TO_MATCH_RULE_FROM_LIST
  220. TRY_TO_MATCH_RULE_FROM_LIST = $(eval $(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER,$1))$(RULE_FOUND)
  221. define ALL_IN_LIST_LOOP
  222. OLD_RULE$1 := $$(RULE)
  223. $$(eval $$(call $1,$$(ITEM$1)))
  224. RULE := $$(OLD_RULE$1)
  225. endef
  226. define PARSE_ALL_IN_LIST
  227. $$(foreach ITEM$1,$2,$$(eval $$(call ALL_IN_LIST_LOOP,$1)))
  228. endef
  229. # The entry point for rule parsing
  230. # parses a rule in the format <keyboard>:<keymap>:<target>
  231. # but this particular function only deals with the first <keyboard> part
  232. define PARSE_RULE
  233. RULE := $1
  234. COMMANDS :=
  235. REQUIRE_PLATFORM_KEY :=
  236. # If the rule starts with all, then continue the parsing from
  237. # PARSE_ALL_KEYBOARDS
  238. ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
  239. KEYBOARD_RULE=all
  240. $$(eval $$(call PARSE_ALL_KEYBOARDS))
  241. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all-avr),true)
  242. KEYBOARD_RULE=all
  243. REQUIRE_PLATFORM_KEY := avr
  244. $$(eval $$(call PARSE_ALL_KEYBOARDS))
  245. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all-chibios),true)
  246. KEYBOARD_RULE=all
  247. REQUIRE_PLATFORM_KEY := chibios
  248. $$(eval $$(call PARSE_ALL_KEYBOARDS))
  249. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all-arm_atsam),true)
  250. KEYBOARD_RULE=all
  251. REQUIRE_PLATFORM_KEY := arm_atsam
  252. $$(eval $$(call PARSE_ALL_KEYBOARDS))
  253. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,test),true)
  254. $$(eval $$(call PARSE_TEST))
  255. # If the rule starts with the name of a known keyboard, then continue
  256. # the parsing from PARSE_KEYBOARD
  257. else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYBOARDS)),true)
  258. KEYBOARD_RULE=$$(MATCHED_ITEM)
  259. $$(eval $$(call PARSE_KEYBOARD,$$(MATCHED_ITEM)))
  260. # Otherwise use the KEYBOARD variable, which is determined either by
  261. # the current directory you run make from, or passed in as an argument
  262. else ifneq ($$(KEYBOARD),)
  263. $$(eval $$(call PARSE_KEYBOARD,$$(KEYBOARD)))
  264. else
  265. $$(info make: *** No rule to make target '$1'. Stop.)
  266. $$(info |)
  267. $$(info | QMK's make format recently changed to use folder locations and colons:)
  268. $$(info | make project_folder:keymap[:target])
  269. $$(info | Examples:)
  270. $$(info | make dz60:default)
  271. $$(info | make planck/rev6:default:flash)
  272. $$(info |)
  273. endif
  274. endef
  275. # $1 = Keyboard
  276. # Parses a rule in the format <keymap>:<target>
  277. # the keyboard is already known when entering this function
  278. define PARSE_KEYBOARD
  279. # If we want to compile the default subproject, then we need to
  280. # include the correct makefile to determine the actual name of it
  281. CURRENT_KB := $1
  282. # KEYBOARD_FOLDERS := $$(subst /, , $(CURRENT_KB))
  283. DEFAULT_FOLDER := $$(CURRENT_KB)
  284. # We assume that every rules.mk will contain the full default value
  285. $$(eval include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/rules.mk)
  286. ifneq ($$(DEFAULT_FOLDER),$$(CURRENT_KB))
  287. $$(eval include $(ROOT_DIR)/keyboards/$$(DEFAULT_FOLDER)/rules.mk)
  288. endif
  289. CURRENT_KB := $$(DEFAULT_FOLDER)
  290. # 5/4/3/2/1
  291. KEYBOARD_FOLDER_PATH_1 := $$(CURRENT_KB)
  292. KEYBOARD_FOLDER_PATH_2 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_1)))
  293. KEYBOARD_FOLDER_PATH_3 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_2)))
  294. KEYBOARD_FOLDER_PATH_4 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_3)))
  295. KEYBOARD_FOLDER_PATH_5 := $$(patsubst %/,%,$$(dir $$(KEYBOARD_FOLDER_PATH_4)))
  296. KEYMAPS :=
  297. # get a list of all keymaps
  298. KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/keymaps/*/.)))
  299. KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/keymaps/*/.)))
  300. KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/keymaps/*/.)))
  301. KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.)))
  302. KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.)))
  303. # this might be needed, but in a different form
  304. #KEYMAPS := $$(sort $$(filter-out $$(KEYBOARD_FOLDER_1) $$(KEYBOARD_FOLDER_2) \
  305. $$(KEYBOARD_FOLDER_3) $$(KEYBOARD_FOLDER_4) $$(KEYBOARD_FOLDER_5), $$(KEYMAPS)))
  306. KEYBOARD_LAYOUTS :=
  307. ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk)","")
  308. LAYOUTS :=
  309. $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk)
  310. KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS))
  311. endif
  312. ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk)","")
  313. LAYOUTS :=
  314. $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk)
  315. KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS))
  316. endif
  317. ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk)","")
  318. LAYOUTS :=
  319. $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk)
  320. KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS))
  321. endif
  322. ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk)","")
  323. LAYOUTS :=
  324. $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk)
  325. KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS))
  326. endif
  327. ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk)","")
  328. LAYOUTS :=
  329. $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk)
  330. KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS))
  331. endif
  332. LAYOUT_KEYMAPS :=
  333. $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.)))))
  334. KEYMAPS := $$(sort $$(KEYMAPS) $$(LAYOUT_KEYMAPS))
  335. # if the rule after removing the start of it is empty (we haven't specified a kemap or target)
  336. # compile all the keymaps
  337. ifeq ($$(RULE),)
  338. $$(eval $$(call PARSE_ALL_KEYMAPS))
  339. # The same if all was specified
  340. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
  341. $$(eval $$(call PARSE_ALL_KEYMAPS))
  342. # List all keymaps for the given keyboard
  343. else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,list-keymaps),true)
  344. $$(eval $$(call LIST_ALL_KEYMAPS))
  345. # Try to match the specified keyamp with the list of known keymaps
  346. else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
  347. $$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
  348. # Otherwise try to match the keymap from the current folder, or arguments to the make command
  349. else ifneq ($$(KEYMAP),)
  350. $$(eval $$(call PARSE_KEYMAP,$$(KEYMAP)))
  351. # Otherwise if we are running make all:<user> just skip
  352. else ifeq ($$(KEYBOARD_RULE),all)
  353. # $$(info Skipping: No user keymap for $$(CURRENT_KB))
  354. # Otherwise, make all keymaps, again this is consistent with how it works without
  355. # any arguments
  356. else
  357. $$(eval $$(call PARSE_ALL_KEYMAPS))
  358. endif
  359. endef
  360. # if we are going to compile all keyboards, match the rest of the rule
  361. # for each of them
  362. define PARSE_ALL_KEYBOARDS
  363. $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(KEYBOARDS)))
  364. endef
  365. # $1 Subproject
  366. # When entering this, the keyboard and subproject are known, so now we need
  367. # to determine which keymaps are going to get compiled
  368. # define PARSE_SUBPROJECT
  369. # endef
  370. # If we want to parse all subprojects, but the keyboard doesn't have any,
  371. # then use defaultsp instead
  372. # define PARSE_ALL_SUBPROJECTS
  373. # ifeq ($$(SUBPROJECTS),)
  374. # $$(eval $$(call PARSE_SUBPROJECT,defaultsp))
  375. # else
  376. # $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_SUBPROJECT,$$(SUBPROJECTS)))
  377. # endif
  378. # endef
  379. # Prints a list of all known keymaps for the given keyboard
  380. define LIST_ALL_KEYMAPS
  381. COMMAND_true_LIST_KEYMAPS := \
  382. printf "$$(KEYMAPS)\n";
  383. COMMAND_false_LIST_KEYMAPS := \
  384. printf "$$(MSG_AVAILABLE_KEYMAPS)\n"; \
  385. printf "$$(KEYMAPS)\n";
  386. COMMANDS += LIST_KEYMAPS
  387. endef
  388. # $1 Keymap
  389. # This is the meat of compiling a keyboard, when entering this, everything is known
  390. # keyboard, subproject, and keymap
  391. # Note that we are not directly calling the command here, but instead building a list,
  392. # which will later be processed
  393. define PARSE_KEYMAP
  394. CURRENT_KM = $1
  395. # The rest of the rule is the target
  396. # Remove the leading ":" from the target, as it acts as a separator
  397. MAKE_TARGET := $$(patsubst :%,%,$$(RULE))
  398. # We need to generate an unique indentifer to append to the COMMANDS list
  399. CURRENT_KB_UNDER := $$(subst /,_,$$(CURRENT_KB))
  400. COMMAND := COMMAND_KEYBOARD_$$(CURRENT_KB_UNDER)_KEYMAP_$$(CURRENT_KM)
  401. # If we are compiling a keyboard without a subproject, we want to display just the name
  402. # of the keyboard, otherwise keyboard/subproject
  403. KB_SP := $$(CURRENT_KB)
  404. # Format it in bold
  405. KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR)
  406. # Specify the variables that we are passing forward to submake
  407. MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY)
  408. # And the first part of the make command
  409. MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
  410. # The message to display
  411. MAKE_MSG := $$(MSG_MAKE_KB)
  412. # We run the command differently, depending on if we want more output or not
  413. # The true version for silent output and the false version otherwise
  414. $$(eval $$(call BUILD))
  415. endef
  416. define BUILD
  417. MAKE_VARS += VERBOSE=$(VERBOSE) COLOR=$(COLOR)
  418. COMMANDS += $$(COMMAND)
  419. COMMAND_true_$$(COMMAND) := \
  420. printf "$$(MAKE_MSG)" | \
  421. $$(MAKE_MSG_FORMAT); \
  422. LOG=$$$$($$(MAKE_CMD) $$(MAKE_VARS) SILENT=true 2>&1) ; \
  423. if [ $$$$? -gt 0 ]; \
  424. then $$(PRINT_ERROR_PLAIN); \
  425. elif [ "$$$$LOG" = "skipped" ] ; \
  426. then $$(PRINT_SKIPPED_PLAIN); \
  427. elif [ "$$$$LOG" != "" ] ; \
  428. then $$(PRINT_WARNING_PLAIN); \
  429. else \
  430. $$(PRINT_OK); \
  431. fi;
  432. COMMAND_false_$$(COMMAND) := \
  433. printf "$$(MAKE_MSG)\n\n"; \
  434. $$(MAKE_CMD) $$(MAKE_VARS) SILENT=false; \
  435. if [ $$$$? -gt 0 ]; \
  436. then error_occurred=1; \
  437. fi;
  438. endef
  439. # Just parse all the keymaps for a specific keyboard
  440. define PARSE_ALL_KEYMAPS
  441. $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
  442. endef
  443. define BUILD_TEST
  444. TEST_NAME := $1
  445. MAKE_TARGET := $2
  446. COMMAND := $1
  447. MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
  448. MAKE_VARS := TEST=$$(TEST_NAME) FULL_TESTS="$$(FULL_TESTS)"
  449. MAKE_MSG := $$(MSG_MAKE_TEST)
  450. $$(eval $$(call BUILD))
  451. ifneq ($$(MAKE_TARGET),clean)
  452. TEST_EXECUTABLE := $$(TEST_DIR)/$$(TEST_NAME).elf
  453. TESTS += $$(TEST_NAME)
  454. TEST_MSG := $$(MSG_TEST)
  455. $$(TEST_NAME)_COMMAND := \
  456. printf "$$(TEST_MSG)\n"; \
  457. $$(TEST_EXECUTABLE); \
  458. if [ $$$$? -gt 0 ]; \
  459. then error_occurred=1; \
  460. fi; \
  461. printf "\n";
  462. endif
  463. endef
  464. define PARSE_TEST
  465. TESTS :=
  466. TEST_NAME := $$(firstword $$(subst :, ,$$(RULE)))
  467. TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME):,,$$(RULE)))
  468. ifeq ($$(TEST_NAME),all)
  469. MATCHED_TESTS := $$(TEST_LIST)
  470. else
  471. MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
  472. endif
  473. $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
  474. endef
  475. # Set the silent mode depending on if we are trying to compile multiple keyboards or not
  476. # By default it's on in that case, but it can be overridden by specifying silent=false
  477. # from the command line
  478. define SET_SILENT_MODE
  479. ifdef SUB_IS_SILENT
  480. SILENT_MODE := $(SUB_IS_SILENT)
  481. else ifeq ($$(words $$(COMMANDS)),1)
  482. SILENT_MODE := false
  483. else
  484. SILENT_MODE := true
  485. endif
  486. endef
  487. include $(ROOT_DIR)/message.mk
  488. ifeq ($(strip $(BREAK_ON_ERRORS)), yes)
  489. HANDLE_ERROR = exit 1
  490. else
  491. HANDLE_ERROR = echo $$error_occurred > $(ERROR_FILE)
  492. endif
  493. # The empty line is important here, as it will force a new shell to be created for each command
  494. # Otherwise the command line will become too long with a lot of keyboards and keymaps
  495. define RUN_COMMAND
  496. +error_occurred=0;\
  497. $(COMMAND_$(SILENT_MODE)_$(COMMAND))\
  498. if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
  499. endef
  500. define RUN_TEST
  501. +error_occurred=0;\
  502. $($(TEST)_COMMAND)\
  503. if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
  504. endef
  505. # Let's match everything, we handle all the rule parsing ourselves
  506. .PHONY: %
  507. %:
  508. # Check if we have the CMP tool installed
  509. cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
  510. # Ensure that bin/qmk works. This will be a failing check after the next develop merge on 2020 Aug 29.
  511. if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; fi
  512. # Check if the submodules are dirty, and display a warning if they are
  513. ifndef SKIP_GIT
  514. if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
  515. if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 50 --init lib/chibios-contrib; fi
  516. if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 50 --init lib/ugfx; fi
  517. if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 50 --init lib/lufa; fi
  518. if [ ! -e lib/vusb ]; then git submodule sync lib/vusb && git submodule update --depth 50 --init lib/vusb; fi
  519. if [ ! -e lib/printf ]; then git submodule sync lib/printf && git submodule update --depth 50 --init lib/printf; fi
  520. git submodule status --recursive 2>/dev/null | \
  521. while IFS= read -r x; do \
  522. case "$$x" in \
  523. \ *) ;; \
  524. *) printf "$(MSG_SUBMODULE_DIRTY)";break;; \
  525. esac \
  526. done
  527. endif
  528. rm -f $(ERROR_FILE) > /dev/null 2>&1
  529. $(eval $(call PARSE_RULE,$@))
  530. $(eval $(call SET_SILENT_MODE))
  531. # Run all the commands in the same shell, notice the + at the first line
  532. # it has to be there to allow parallel execution of the submake
  533. # This always tries to compile everything, even if error occurs in the middle
  534. # But we return the error code at the end, to trigger travis failures
  535. # The sort at this point is to remove duplicates
  536. $(foreach COMMAND,$(sort $(COMMANDS)),$(RUN_COMMAND))
  537. if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
  538. $(foreach TEST,$(sort $(TESTS)),$(RUN_TEST))
  539. if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
  540. # These no longer work because of the colon system
  541. # All should compile everything
  542. # .PHONY: all
  543. # all: all-keyboards test-all
  544. # Define some shortcuts, mostly for compatibility with the old syntax
  545. # .PHONY: all-keyboards
  546. # all-keyboards: all\:all\:all
  547. # .PHONY: all-keyboards-defaults
  548. # all-keyboards-defaults: all\:default
  549. # .PHONY: test
  550. # test: test-all
  551. # .PHONY: test-clean
  552. # test-clean: test-all-clean
  553. lib/%:
  554. git submodule sync $?
  555. git submodule update --init $?
  556. .PHONY: git-submodule
  557. git-submodule:
  558. git submodule sync --recursive
  559. git submodule update --init --recursive --progress
  560. ifdef SKIP_VERSION
  561. SKIP_GIT := yes
  562. endif
  563. # Generate the version.h file
  564. ifndef SKIP_GIT
  565. GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
  566. CHIBIOS_VERSION := $(shell cd lib/chibios && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
  567. CHIBIOS_CONTRIB_VERSION := $(shell cd lib/chibios-contrib && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
  568. else
  569. GIT_VERSION := NA
  570. CHIBIOS_VERSION := NA
  571. CHIBIOS_CONTRIB_VERSION := NA
  572. endif
  573. ifndef SKIP_VERSION
  574. BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
  575. else
  576. BUILD_DATE := 2020-01-01-00:00:00
  577. endif
  578. $(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
  579. $(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)
  580. $(shell echo '#define CHIBIOS_VERSION "$(CHIBIOS_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
  581. $(shell echo '#define CHIBIOS_CONTRIB_VERSION "$(CHIBIOS_CONTRIB_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
  582. include $(ROOT_DIR)/testlist.mk