summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-04 09:56:03 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-20 03:24:40 +0300
commit9ee6d4a23d9a1bdc019fc9968a909866ffeda905 (patch)
tree0cdb7b4d5a7d40102949bc45ac57f43131ef52ed /Makefile
parentdfe510d5b8f83c9977b507ed204632c2f22c5d24 (diff)
Proper looping for allkb and allkm
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 15 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index e88eeefee4..57cf3f523a 100644
--- a/Makefile
+++ b/Makefile
@@ -78,21 +78,32 @@ define TRY_TO_MATCH_RULE_FROM_LIST
endif
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
- COMMANDS += allkb
- #$$(info $$(RULE))
- COMMAND_allkb := "All keyboards with $$(RULE)"
+ $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYBOARD,$(KEYBOARDS)))
+endef
+
+define PARSE_ALL_KEYMAPS
+ $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
endef
# $1 = Keyboard
define PARSE_KEYBOARD
CURRENT_KB := $1
+ KEYMAPS := $(notdir $(patsubst %/.,%,$(wildcard $(ROOT_DIR)/keyboards/$1/keymaps/*/.)))
$$(eval $$(call COMPARE_AND_REMOVE_FROM_RULE,allkm))
ifeq ($$(RULE_FOUND),true)
$$(eval $$(call PARSE_ALL_KEYMAPS))
else
- KEYMAPS := $(notdir $(patsubst %/.,%,$(wildcard $(ROOT_DIR)/keyboards/$1/keymaps/*/.)))
$$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)))
ifeq ($$(RULE_FOUND),true)
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
@@ -100,11 +111,6 @@ define PARSE_KEYBOARD
endif
endef
-define PARSE_ALL_KEYMAPS
- COMMANDS += ALL_KEYMAPS
- COMMAND_ALL_KEYMAPS := All keymaps in $(CURRENT_KB)
-endef
-
# $1 Keymap
define PARSE_KEYMAP
CURRENT_KM = $1
@@ -112,7 +118,6 @@ define PARSE_KEYMAP
COMMAND_KEYBOARD_$$(CURRENT_KB)_KEYMAP_$$(CURRENT_KM) := Keyboard $$(CURRENT_KB), Keymap $$(CURRENT_KM)
endef
-
define PARSE_RULE
RULE := $1
COMMANDS :=