The makefile actually calls build_test

This commit is contained in:
Fred Sundvik 2016-08-21 17:14:38 +03:00
parent 6d7cd639a5
commit 27a673f5cf
5 changed files with 42 additions and 18 deletions

View File

@ -358,7 +358,6 @@ define PARSE_KEYMAP
MAKE_TARGET := $$(patsubst -%,%,$$(RULE)) MAKE_TARGET := $$(patsubst -%,%,$$(RULE))
# We need to generate an unique indentifer to append to the COMMANDS list # We need to generate an unique indentifer to append to the COMMANDS list
COMMAND := COMMAND_KEYBOARD_$$(CURRENT_KB)_SUBPROJECT_$(CURRENT_SP)_KEYMAP_$$(CURRENT_KM) COMMAND := COMMAND_KEYBOARD_$$(CURRENT_KB)_SUBPROJECT_$(CURRENT_SP)_KEYMAP_$$(CURRENT_KM)
COMMANDS += $$(COMMAND)
# If we are compiling a keyboard without a subproject, we want to display just the name # If we are compiling a keyboard without a subproject, we want to display just the name
# of the keyboard, otherwise keyboard/subproject # of the keyboard, otherwise keyboard/subproject
ifeq ($$(CURRENT_SP),) ifeq ($$(CURRENT_SP),)
@ -370,13 +369,18 @@ define PARSE_KEYMAP
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) SUBPROJECT=$$(CURRENT_SP) KEYMAP=$$(CURRENT_KM) MAKE_VARS := KEYBOARD=$$(CURRENT_KB) SUBPROJECT=$$(CURRENT_SP) KEYMAP=$$(CURRENT_KM)
MAKE_VARS += VERBOSE=$(VERBOSE) COLOR=$(COLOR)
# 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
MAKE_MSG := $$(MSG_MAKE_KB) MAKE_MSG := $$(MSG_MAKE_KB)
# We run the command differently, depending on if we want more output or not # We run the command differently, depending on if we want more output or not
# The true version for silent output and the false version otherwise # The true version for silent output and the false version otherwise
$$(eval $$(call BUILD))
endef
define BUILD
MAKE_VARS += VERBOSE=$(VERBOSE) COLOR=$(COLOR)
COMMANDS += $$(COMMAND)
COMMAND_true_$$(COMMAND) := \ COMMAND_true_$$(COMMAND) := \
printf "$$(MAKE_MSG)" | \ printf "$$(MAKE_MSG)" | \
$$(MAKE_MSG_FORMAT); \ $$(MAKE_MSG_FORMAT); \
@ -398,13 +402,21 @@ define PARSE_ALL_KEYMAPS
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS))) $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
endef endef
define BUILD_TEST
TEST_NAME := $1
MAKE_TARGET := $2
COMMAND := $1
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
MAKE_VARS := TEST=$$(TEST_NAME)
MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD))
endef
define PARSE_TEST define PARSE_TEST
TEST_NAME := $$(firstword $$(subst -, ,$$(RULE))) TEST_NAME := $$(firstword $$(subst -, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE))) TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE)))
MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),)) MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
$$(info Test name $$(TEST_NAME)) $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
$$(info Test target $$(TEST_TARGET))
$$(info $$(MATCHED_TESTS))
endef endef

View File

@ -4,19 +4,7 @@ endif
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
include message.mk include common.mk
# Directory common source filess exist
TOP_DIR = .
TMK_DIR = tmk_core
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
LIB_PATH = $(TOP_DIR)/lib
QUANTUM_DIR = quantum
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
BUILD_DIR := $(TOP_DIR)/.build
ifneq ($(SUBPROJECT),) ifneq ($(SUBPROJECT),)
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP) TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)

5
build_test.mk Normal file
View File

@ -0,0 +1,5 @@
include common.mk
all:
echo Done $(TEST)

12
common.mk Normal file
View File

@ -0,0 +1,12 @@
include message.mk
# Directory common source files exist
TOP_DIR = .
TMK_DIR = tmk_core
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
LIB_PATH = $(TOP_DIR)/lib
QUANTUM_DIR = quantum
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
BUILD_DIR := $(TOP_DIR)/.build

View File

@ -69,3 +69,10 @@ define GENERATE_MSG_MAKE_KB
endif endif
endef endef
MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL) MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)
define GENERATE_MSG_MAKE_TEST
MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR)
ifneq ($$(MAKE_TARGET),)
MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
endif
endef
MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)