-
-
Notifications
You must be signed in to change notification settings - Fork 38.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the make all-keyboards command #422
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -670,17 +670,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) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /keyboard/%: /keyboard/%-%:
$(call make_keyboard_helper,$@,$*) This may be able to replace all the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately that doesn't work either, Replacing the rules with this
gives
One idea that I had was to use the subst function to replace all dashes with spaces, and then use the lastword function to get quick, all, clean and so on. But I decided against that, since it can easily start causing troubles if we add keyboards with dashes in the name. |
||
all-keymaps-%: | ||
$(eval MAKECONFIG=$(call get_target,all-keymaps,$@)) | ||
$(eval KEYMAPS=$(notdir $(patsubst %/.,%,$(wildcard $(TOP_DIR)/keyboard/$(KEYBOARD)/keymaps/*/.)))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember my make-fu right, this should work:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@algernon
That is what I thought too, and I tried many variations of this yesterday, and now again, this is what I get
If I do this instead though
It prints out the correct rule names, so the prerequisites pattern is right. I also tried adding the debug flag to make, and it didn't help me debug the problem either. But maybe someone with better makefile programming skills could?