summaryrefslogtreecommitdiff
path: root/tmk_core/rules.mk
diff options
context:
space:
mode:
authorfredizzimo <fsundvik@gmail.com>2016-06-21 20:31:26 +0300
committerJack Humbert <jack.humb@gmail.com>2016-06-21 13:31:26 -0400
commita69d002506d822fef9713b844cd512cefcffd4fc (patch)
treedd0558e2730101c28a8eb6c407584fa3602acd31 /tmk_core/rules.mk
parent80c87054193b9243670aeb85adefbe1aa6c0fda0 (diff)
downloadqmk_firmware-a69d002506d822fef9713b844cd512cefcffd4fc.tar.gz
qmk_firmware-a69d002506d822fef9713b844cd512cefcffd4fc.zip
Fix the make all-keyboards command (#422)
Unfortunately the supported targets, like "quick", "all", "clean", and so on has to be repeated two extra times, but this is the best I can do with my makefile skills.
Diffstat (limited to 'tmk_core/rules.mk')
-rw-r--r--tmk_core/rules.mk35
1 files changed, 26 insertions, 9 deletions
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index d9a0fd33f3..e9ef5ca7b5 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -632,17 +632,34 @@ all-keyboards-defaults-%:
all-keyboards-defaults: all-keyboards-defaults-all
KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboard/%/=/keyboard/%)
-all-keyboards-%: $(KEYBOARDS)
-/keyboard/%:
- $(eval KEYBOARD=$(patsubst /keyboard/%,%,$@))
- $(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)$@/keymaps/*/.))))
- @for x in $(KEYMAPS) ; do \
- printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-88s", $$0; }'; \
- LOG=$$($(MAKE) -C $(TOP_DIR)$@ $(subst all-keyboards-,,$@) keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
- done
-
+all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
+all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
+all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
all-keyboards: all-keyboards-all
+define make_keyboard
+$(eval KEYBOARD=$(patsubst /keyboard/%,%,$1))
+$(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)$1/keymaps/*/.))))
+@for x in $(KEYMAPS) ; do \
+ printf "Compiling $(BOLD)$(KEYBOARD)$(NO_COLOR) with $(BOLD)$$x$(NO_COLOR)" | $(AWK) '{ printf "%-88s", $$0; }'; \
+ LOG=$$($(MAKE) -C $(TOP_DIR)$1 $2 keymap=$$x VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
+done
+endef
+
+define make_keyboard_helper
+# Just remove the -quick, -all and so on from the first argument and pass it forward
+$(call make_keyboard,$(subst -$2,,$1),$2)
+endef
+
+/keyboard/%-quick:
+ $(call make_keyboard_helper,$@,quick)
+/keyboard/%-all:
+ $(call make_keyboard_helper,$@,all)
+/keyboard/%-clean:
+ $(call make_keyboard_helper,$@,clean)
+/keyboard/%:
+ $(call make_keyboard_helper,$@,all)
+
all-keymaps-%:
$(eval MAKECONFIG=$(call get_target,all-keymaps,$@))
$(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboard/$(KEYBOARD)/keymaps/*/.))))