1
0
Fork 0

Proper looping for allkb and allkm

This commit is contained in:
Fred Sundvik 2016-08-04 09:56:03 +03:00
parent dfe510d5b8
commit 9ee6d4a23d

View file

@ -78,21 +78,32 @@ define TRY_TO_MATCH_RULE_FROM_LIST
endif endif
endef endef
define ALL_IN_LIST_LOOP
OLD_RULE$1 := $$(RULE)
$$(eval $$(call $1,$$(ITEM$1)))
RULE := $$(OLD_RULE$1)
endef
define PARSE_ALL_IN_LIST
$$(foreach ITEM$1,$2,$$(eval $$(call ALL_IN_LIST_LOOP,$1)))
endef
define PARSE_ALL_KEYBOARDS define PARSE_ALL_KEYBOARDS
COMMANDS += allkb $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(KEYBOARDS)))
#$$(info $$(RULE)) endef
COMMAND_allkb := "All keyboards with $$(RULE)"
define PARSE_ALL_KEYMAPS
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
endef endef
# $1 = Keyboard # $1 = Keyboard
define PARSE_KEYBOARD define PARSE_KEYBOARD
CURRENT_KB := $1 CURRENT_KB := $1
KEYMAPS := $(notdir $(patsubst %/.,%,$(wildcard $(ROOT_DIR)/keyboards/$1/keymaps/*/.)))
$$(eval $$(call COMPARE_AND_REMOVE_FROM_RULE,allkm)) $$(eval $$(call COMPARE_AND_REMOVE_FROM_RULE,allkm))
ifeq ($$(RULE_FOUND),true) ifeq ($$(RULE_FOUND),true)
$$(eval $$(call PARSE_ALL_KEYMAPS)) $$(eval $$(call PARSE_ALL_KEYMAPS))
else else
KEYMAPS := $(notdir $(patsubst %/.,%,$(wildcard $(ROOT_DIR)/keyboards/$1/keymaps/*/.)))
$$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS))) $$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)))
ifeq ($$(RULE_FOUND),true) ifeq ($$(RULE_FOUND),true)
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM))) $$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
@ -100,11 +111,6 @@ define PARSE_KEYBOARD
endif endif
endef endef
define PARSE_ALL_KEYMAPS
COMMANDS += ALL_KEYMAPS
COMMAND_ALL_KEYMAPS := All keymaps in $(CURRENT_KB)
endef
# $1 Keymap # $1 Keymap
define PARSE_KEYMAP define PARSE_KEYMAP
CURRENT_KM = $1 CURRENT_KM = $1
@ -112,7 +118,6 @@ define PARSE_KEYMAP
COMMAND_KEYBOARD_$$(CURRENT_KB)_KEYMAP_$$(CURRENT_KM) := Keyboard $$(CURRENT_KB), Keymap $$(CURRENT_KM) COMMAND_KEYBOARD_$$(CURRENT_KB)_KEYMAP_$$(CURRENT_KM) := Keyboard $$(CURRENT_KB), Keymap $$(CURRENT_KM)
endef endef
define PARSE_RULE define PARSE_RULE
RULE := $1 RULE := $1
COMMANDS := COMMANDS :=