aboutsummaryrefslogtreecommitdiff
path: root/build_test.mk
diff options
context:
space:
mode:
Diffstat (limited to 'build_test.mk')
-rw-r--r--build_test.mk83
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 @@
1ifndef VERBOSE
2.SILENT:
3endif
4
5.DEFAULT_GOAL := all
6
7include paths.mk
8include $(BUILDDEFS_PATH)/message.mk
9
10TARGET=test/$(TEST)
11
12GTEST_OUTPUT = $(BUILD_DIR)/gtest
13
14TEST_OBJ = $(BUILD_DIR)/test_obj
15
16OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT)
17
18GTEST_INC := \
19 $(LIB_PATH)/googletest/googletest/include \
20 $(LIB_PATH)/googletest/googlemock/include
21
22GTEST_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
33LDFLAGS += -lstdc++ -lpthread -shared-libgcc
34CREATE_MAP := no
35
36VPATH += \
37 $(LIB_PATH)/googletest \
38 $(LIB_PATH)/googlemock \
39 $(LIB_PATH)/printf
40
41all: elf
42
43VPATH += $(COMMON_VPATH)
44PLATFORM:=TEST
45PLATFORM_KEY:=test
46
47ifeq ($(strip $(DEBUG)), 1)
48CONSOLE_ENABLE = yes
49endif
50
51ifneq ($(filter $(FULL_TESTS),$(TEST)),)
52include tests/test_common/build.mk
53include $(TEST_PATH)/test.mk
54endif
55
56include common_features.mk
57include $(BUILDDEFS_PATH)/generic_features.mk
58include $(PLATFORM_PATH)/common.mk
59include $(TMK_PATH)/protocol.mk
60include $(QUANTUM_PATH)/debounce/tests/rules.mk
61include $(QUANTUM_PATH)/encoder/tests/rules.mk
62include $(QUANTUM_PATH)/sequencer/tests/rules.mk
63include $(PLATFORM_PATH)/test/rules.mk
64ifneq ($(filter $(FULL_TESTS),$(TEST)),)
65include build_full_test.mk
66endif
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
78include $(PLATFORM_PATH)/$(PLATFORM_KEY)/platform.mk
79include $(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)