Skip to content

Commit

Permalink
The makefile actually calls build_test
Browse files Browse the repository at this point in the history
  • Loading branch information
fredizzimo committed Aug 27, 2016
1 parent 6d7cd63 commit 27a673f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand All @@ -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); \
Expand All @@ -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


Expand Down
14 changes: 1 addition & 13 deletions build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions build_test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include common.mk


all:
echo Done $(TEST)
12 changes: 12 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions message.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 27a673f

Please sign in to comment.