summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-21 17:14:38 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-27 21:57:49 +0300
commit27a673f5cf75747fe73641059aae60e9b53a1c78 (patch)
treefaf15b5c6055568689534478f5306cd4fe4be459
parent6d7cd639a5e4503f00162c7cfa4bc7302b82c71c (diff)
downloadqmk_firmware-27a673f5cf75747fe73641059aae60e9b53a1c78.tar.gz
qmk_firmware-27a673f5cf75747fe73641059aae60e9b53a1c78.zip
The makefile actually calls build_test
-rw-r--r--Makefile22
-rw-r--r--build_keyboard.mk14
-rw-r--r--build_test.mk5
-rw-r--r--common.mk12
-rw-r--r--message.mk7
5 files changed, 42 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 16e90f8e49..67b981d51e 100644
--- a/Makefile
+++ b/Makefile
@@ -358,7 +358,6 @@ define PARSE_KEYMAP
MAKE_TARGET := $$(patsubst -%,%,$$(RULE))
# We need to generate an unique indentifer to append to the COMMANDS list
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
# of the keyboard, otherwise keyboard/subproject
ifeq ($$(CURRENT_SP),)
@@ -370,13 +369,18 @@ define PARSE_KEYMAP
KB_SP := $(BOLD)$$(KB_SP)$(NO_COLOR)
# Specify the variables that we are passing forward to submake
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
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_keyboard.mk $$(MAKE_TARGET)
# The message to display
MAKE_MSG := $$(MSG_MAKE_KB)
# 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
+ $$(eval $$(call BUILD))
+endef
+
+define BUILD
+ MAKE_VARS += VERBOSE=$(VERBOSE) COLOR=$(COLOR)
+ COMMANDS += $$(COMMAND)
COMMAND_true_$$(COMMAND) := \
printf "$$(MAKE_MSG)" | \
$$(MAKE_MSG_FORMAT); \
@@ -398,13 +402,21 @@ define PARSE_ALL_KEYMAPS
$$(eval $$(call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$(KEYMAPS)))
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
TEST_NAME := $$(firstword $$(subst -, ,$$(RULE)))
TEST_TARGET := $$(subst $$(TEST_NAME),,$$(subst $$(TEST_NAME)-,,$$(RULE)))
MATCHED_TESTS := $$(foreach TEST,$$(TEST_LIST),$$(if $$(findstring $$(TEST_NAME),$$(TEST)),$$(TEST),))
- $$(info Test name $$(TEST_NAME))
- $$(info Test target $$(TEST_TARGET))
- $$(info $$(MATCHED_TESTS))
+ $$(foreach TEST,$$(MATCHED_TESTS),$$(eval $$(call BUILD_TEST,$$(TEST),$$(TEST_TARGET))))
endef
diff --git a/build_keyboard.mk b/build_keyboard.mk
index f843572f66..bbe5718459 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -4,19 +4,7 @@ endif
.DEFAULT_GOAL := all
-include message.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
+include common.mk
ifneq ($(SUBPROJECT),)
TARGET ?= $(KEYBOARD)_$(SUBPROJECT)_$(KEYMAP)
diff --git a/build_test.mk b/build_test.mk
new file mode 100644
index 0000000000..37ed8b5683
--- /dev/null
+++ b/build_test.mk
@@ -0,0 +1,5 @@
+include common.mk
+
+
+all:
+ echo Done $(TEST) \ No newline at end of file
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000000..689fdf5a50
--- /dev/null
+++ b/common.mk
@@ -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 \ No newline at end of file
diff --git a/message.mk b/message.mk
index fb1a7a1f9a..96814986b5 100644
--- a/message.mk
+++ b/message.mk
@@ -69,3 +69,10 @@ define GENERATE_MSG_MAKE_KB
endif
endef
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)