diff options
Diffstat (limited to 'build_test.mk')
-rw-r--r-- | build_test.mk | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/build_test.mk b/build_test.mk new file mode 100644 index 000000000..136a0455f --- /dev/null +++ b/build_test.mk | |||
@@ -0,0 +1,83 @@ | |||
1 | ifndef VERBOSE | ||
2 | .SILENT: | ||
3 | endif | ||
4 | |||
5 | .DEFAULT_GOAL := all | ||
6 | |||
7 | include paths.mk | ||
8 | include $(BUILDDEFS_PATH)/message.mk | ||
9 | |||
10 | TARGET=test/$(TEST) | ||
11 | |||
12 | GTEST_OUTPUT = $(BUILD_DIR)/gtest | ||
13 | |||
14 | TEST_OBJ = $(BUILD_DIR)/test_obj | ||
15 | |||
16 | OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT) | ||
17 | |||
18 | GTEST_INC := \ | ||
19 | $(LIB_PATH)/googletest/googletest/include \ | ||
20 | $(LIB_PATH)/googletest/googlemock/include | ||
21 | |||
22 | GTEST_INTERNAL_INC := \ | ||
23 | $(LIB_PATH)/googletest/googletest \ | ||
24 | $(LIB_PATH)/googletest/googlemock | ||
25 | |||
26 | $(GTEST_OUTPUT)_SRC := \ | ||
27 | googletest/src/gtest-all.cc\ | ||
28 | googlemock/src/gmock-all.cc | ||
29 | |||
30 | $(GTEST_OUTPUT)_DEFS := | ||
31 | $(GTEST_OUTPUT)_INC := $(GTEST_INC) $(GTEST_INTERNAL_INC) | ||
32 | |||
33 | LDFLAGS += -lstdc++ -lpthread -shared-libgcc | ||
34 | CREATE_MAP := no | ||
35 | |||
36 | VPATH += \ | ||
37 | $(LIB_PATH)/googletest \ | ||
38 | $(LIB_PATH)/googlemock \ | ||
39 | $(LIB_PATH)/printf | ||
40 | |||
41 | all: elf | ||
42 | |||
43 | VPATH += $(COMMON_VPATH) | ||
44 | PLATFORM:=TEST | ||
45 | PLATFORM_KEY:=test | ||
46 | |||
47 | ifeq ($(strip $(DEBUG)), 1) | ||
48 | CONSOLE_ENABLE = yes | ||
49 | endif | ||
50 | |||
51 | ifneq ($(filter $(FULL_TESTS),$(TEST)),) | ||
52 | include tests/test_common/build.mk | ||
53 | include $(TEST_PATH)/test.mk | ||
54 | endif | ||
55 | |||
56 | include common_features.mk | ||
57 | include $(BUILDDEFS_PATH)/generic_features.mk | ||
58 | include $(PLATFORM_PATH)/common.mk | ||
59 | include $(TMK_PATH)/protocol.mk | ||
60 | include $(QUANTUM_PATH)/debounce/tests/rules.mk | ||
61 | include $(QUANTUM_PATH)/encoder/tests/rules.mk | ||
62 | include $(QUANTUM_PATH)/sequencer/tests/rules.mk | ||
63 | include $(PLATFORM_PATH)/test/rules.mk | ||
64 | ifneq ($(filter $(FULL_TESTS),$(TEST)),) | ||
65 | include build_full_test.mk | ||
66 | endif | ||
67 | |||
68 | $(TEST)_SRC += \ | ||
69 | tests/test_common/main.c \ | ||
70 | $(LIB_PATH)/printf/printf.c \ | ||
71 | $(QUANTUM_PATH)/logging/print.c | ||
72 | |||
73 | $(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC) | ||
74 | $(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC) | ||
75 | $(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS) | ||
76 | $(TEST_OBJ)/$(TEST)_CONFIG := $($(TEST)_CONFIG) | ||
77 | |||
78 | include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk | ||
79 | include $(TMK_PATH)/rules.mk | ||
80 | |||
81 | |||
82 | $(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null) | ||
83 | $(shell mkdir -p $(TEST_OBJ) 2>/dev/null) | ||