Add ability to build a subset of all keyboards based on platform.

This commit is contained in:
Nick Brassel 2020-09-24 12:46:43 +10:00 committed by James Young
parent bf84d35117
commit b1b7696347
No known key found for this signature in database
GPG key ID: 8E1085BF6FCFBD74
3 changed files with 32 additions and 1 deletions

View file

@ -272,11 +272,24 @@ endef
define PARSE_RULE define PARSE_RULE
RULE := $1 RULE := $1
COMMANDS := COMMANDS :=
REQUIRE_PLATFORM_KEY :=
# If the rule starts with all, then continue the parsing from # If the rule starts with all, then continue the parsing from
# PARSE_ALL_KEYBOARDS # PARSE_ALL_KEYBOARDS
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true) ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
KEYBOARD_RULE=all KEYBOARD_RULE=all
$$(eval $$(call PARSE_ALL_KEYBOARDS)) $$(eval $$(call PARSE_ALL_KEYBOARDS))
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,avr),true)
KEYBOARD_RULE=all
REQUIRE_PLATFORM_KEY := avr
$$(eval $$(call PARSE_ALL_KEYBOARDS))
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,chibios),true)
KEYBOARD_RULE=all
REQUIRE_PLATFORM_KEY := chibios
$$(eval $$(call PARSE_ALL_KEYBOARDS))
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,arm_atsam),true)
KEYBOARD_RULE=all
REQUIRE_PLATFORM_KEY := arm_atsam
$$(eval $$(call PARSE_ALL_KEYBOARDS))
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,test),true) else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,test),true)
$$(eval $$(call PARSE_TEST)) $$(eval $$(call PARSE_TEST))
# If the rule starts with the name of a known keyboard, then continue # If the rule starts with the name of a known keyboard, then continue
@ -447,7 +460,7 @@ define PARSE_KEYMAP
# Format it in bold # Format it in bold
KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR) KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR)
# Specify the variables that we are passing forward to submake # Specify the variables that we are passing forward to submake
MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) MAKE_VARS := KEYBOARD=$$(CURRENT_KB) KEYMAP=$$(CURRENT_KM) REQUIRE_PLATFORM_KEY=$$(REQUIRE_PLATFORM_KEY)
# And the first part of the make command # And the first part of the make command
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET) MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
# The message to display # The message to display
@ -466,6 +479,8 @@ define BUILD
LOG=$$$$($$(MAKE_CMD) $$(MAKE_VARS) SILENT=true 2>&1) ; \ LOG=$$$$($$(MAKE_CMD) $$(MAKE_VARS) SILENT=true 2>&1) ; \
if [ $$$$? -gt 0 ]; \ if [ $$$$? -gt 0 ]; \
then $$(PRINT_ERROR_PLAIN); \ then $$(PRINT_ERROR_PLAIN); \
elif [ "$$$$LOG" = "skipped" ] ; \
then $$(PRINT_SKIPPED_PLAIN); \
elif [ "$$$$LOG" != "" ] ; \ elif [ "$$$$LOG" != "" ] ; \
then $$(PRINT_WARNING_PLAIN); \ then $$(PRINT_WARNING_PLAIN); \
else \ else \

View file

@ -317,6 +317,13 @@ SRC += $(TMK_COMMON_SRC)
OPT_DEFS += $(TMK_COMMON_DEFS) OPT_DEFS += $(TMK_COMMON_DEFS)
EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS) EXTRALDFLAGS += $(TMK_COMMON_LDFLAGS)
SKIP_COMPILE := no
ifneq ($(REQUIRE_PLATFORM_KEY),)
ifneq ($(REQUIRE_PLATFORM_KEY),$(PLATFORM_KEY))
SKIP_COMPILE := yes
endif
endif
include $(TMK_PATH)/$(PLATFORM_KEY).mk include $(TMK_PATH)/$(PLATFORM_KEY).mk
ifneq ($(strip $(PROTOCOL)),) ifneq ($(strip $(PROTOCOL)),)
include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk include $(TMK_PATH)/protocol/$(strip $(shell echo $(PROTOCOL) | tr '[:upper:]' '[:lower:]')).mk
@ -352,7 +359,13 @@ $(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC) $(GFXINC)
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG) $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
# Default target. # Default target.
ifeq ($(SKIP_COMPILE),no)
all: build check-size all: build check-size
else
all:
echo "skipped" >&2
endif
build: elf cpfirmware build: elf cpfirmware
check-size: build check-size: build
objs-size: build objs-size: build

View file

@ -5,6 +5,7 @@ ifeq ($(COLOR),true)
OK_COLOR=\033[32;01m OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m WARN_COLOR=\033[33;01m
SKIPPED_COLOR=\033[36;01m
BLUE=\033[0;34m BLUE=\033[0;34m
BOLD=\033[1m BOLD=\033[1m
endif endif
@ -20,6 +21,7 @@ ON_ERROR ?= exit 1
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
SKIPPED_STRING=$(SKIPPED_COLOR)[SKIPPED]$(NO_COLOR)\n
TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }' TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }'
TAB_LOG_PLAIN = printf "%s\n" "$$LOG" TAB_LOG_PLAIN = printf "%s\n" "$$LOG"
@ -29,6 +31,7 @@ PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_L
PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR) PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
PRINT_SKIPPED_PLAIN = ($(SILENT) || printf " $(SKIPPED_STRING)" | $(AWK_STATUS))
PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS) PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi; BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}' MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'