mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-22 08:27:56 +06:00
Slight rearrange of the Makefile for easier readability
This commit is contained in:
parent
286b3b8057
commit
091fab5103
64
Makefile
64
Makefile
|
@ -94,30 +94,13 @@ define PARSE_ALL_IN_LIST
|
||||||
$$(foreach ITEM$1,$2,$$(eval $$(call ALL_IN_LIST_LOOP,$1)))
|
$$(foreach ITEM$1,$2,$$(eval $$(call ALL_IN_LIST_LOOP,$1)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define PARSE_ALL_KEYBOARDS
|
define PARSE_RULE
|
||||||
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(KEYBOARDS)))
|
RULE := $1
|
||||||
endef
|
COMMANDS :=
|
||||||
|
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkb),true)
|
||||||
define PARSE_ALL_KEYMAPS
|
$$(eval $$(call PARSE_ALL_KEYBOARDS))
|
||||||
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
|
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYBOARDS)),true)
|
||||||
endef
|
$$(eval $$(call PARSE_KEYBOARD,$$(MATCHED_ITEM)))
|
||||||
|
|
||||||
define PARSE_ALL_SUBPROJECTS
|
|
||||||
ifeq ($$(SUBPROJECTS),)
|
|
||||||
$$(eval $$(call PARSE_SUBPROJECT,))
|
|
||||||
else
|
|
||||||
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_SUBPROJECT,$$(SUBPROJECTS)))
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
# $1 Subproject
|
|
||||||
define PARSE_SUBPROJECT
|
|
||||||
CURRENT_SP := $1
|
|
||||||
KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/keymaps/*/.)))
|
|
||||||
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkm),true)
|
|
||||||
$$(eval $$(call PARSE_ALL_KEYMAPS))
|
|
||||||
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
|
|
||||||
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
|
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -133,6 +116,29 @@ define PARSE_KEYBOARD
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define PARSE_ALL_KEYBOARDS
|
||||||
|
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(KEYBOARDS)))
|
||||||
|
endef
|
||||||
|
|
||||||
|
# $1 Subproject
|
||||||
|
define PARSE_SUBPROJECT
|
||||||
|
CURRENT_SP := $1
|
||||||
|
KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/keymaps/*/.)))
|
||||||
|
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkm),true)
|
||||||
|
$$(eval $$(call PARSE_ALL_KEYMAPS))
|
||||||
|
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
|
||||||
|
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
define PARSE_ALL_SUBPROJECTS
|
||||||
|
ifeq ($$(SUBPROJECTS),)
|
||||||
|
$$(eval $$(call PARSE_SUBPROJECT,))
|
||||||
|
else
|
||||||
|
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_SUBPROJECT,$$(SUBPROJECTS)))
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
# $1 Keymap
|
# $1 Keymap
|
||||||
define PARSE_KEYMAP
|
define PARSE_KEYMAP
|
||||||
CURRENT_KM = $1
|
CURRENT_KM = $1
|
||||||
|
@ -140,14 +146,8 @@ define PARSE_KEYMAP
|
||||||
COMMAND_KEYBOARD_$$(CURRENT_KB)_SUBPROJECT_$(CURRENT_SP)_KEYMAP_$$(CURRENT_KM) := Keyboard $$(CURRENT_KB), Subproject $$(CURRENT_SP), Keymap $$(CURRENT_KM)
|
COMMAND_KEYBOARD_$$(CURRENT_KB)_SUBPROJECT_$(CURRENT_SP)_KEYMAP_$$(CURRENT_KM) := Keyboard $$(CURRENT_KB), Subproject $$(CURRENT_SP), Keymap $$(CURRENT_KM)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define PARSE_RULE
|
define PARSE_ALL_KEYMAPS
|
||||||
RULE := $1
|
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
|
||||||
COMMANDS :=
|
|
||||||
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkb),true)
|
|
||||||
$$(eval $$(call PARSE_ALL_KEYBOARDS))
|
|
||||||
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYBOARDS)),true)
|
|
||||||
$$(eval $$(call PARSE_KEYBOARD,$$(MATCHED_ITEM)))
|
|
||||||
endif
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
RUN_COMMAND = echo "Running": $(COMMAND_$(COMMAND));
|
RUN_COMMAND = echo "Running": $(COMMAND_$(COMMAND));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user