]> granicus.if.org Git - esp-idf/blob - components/heap/test_multi_heap_host/Makefile
test_multi_heap_host: Remove race conditions from parallel "make clean test"
[esp-idf] / components / heap / test_multi_heap_host / Makefile
1 TEST_PROGRAM=test_multi_heap
2 all: $(TEST_PROGRAM)
3
4 ifneq ($(filter clean,$(MAKECMDGOALS)),)
5 .NOTPARALLEL:  # prevent make clean racing the other targets
6 endif
7
8 SOURCE_FILES = $(abspath \
9     ../multi_heap.c \
10         ../multi_heap_poisoning.c \
11         test_multi_heap.cpp \
12         main.cpp \
13     )
14
15 INCLUDE_FLAGS = -I../include -I../../../tools/catch
16
17 GCOV ?= gcov
18
19 CPPFLAGS += $(INCLUDE_FLAGS) -D CONFIG_LOG_DEFAULT_LEVEL -g -fstack-protector-all -m32
20 CFLAGS += -Wall -Werror -fprofile-arcs -ftest-coverage
21 CXXFLAGS += -std=c++11 -Wall -Werror  -fprofile-arcs -ftest-coverage
22 LDFLAGS += -lstdc++ -fprofile-arcs -ftest-coverage -m32
23
24 OBJ_FILES = $(filter %.o, $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))
25
26 COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
27
28 $(TEST_PROGRAM): $(OBJ_FILES)
29         g++ $(LDFLAGS) -o $(TEST_PROGRAM) $(OBJ_FILES)
30
31 $(OUTPUT_DIR):
32         mkdir -p $(OUTPUT_DIR)
33
34 test: $(TEST_PROGRAM)
35         ./$(TEST_PROGRAM)
36
37 $(COVERAGE_FILES): $(TEST_PROGRAM) test
38
39 coverage.info: $(COVERAGE_FILES)
40         find ../ -name "*.gcno" -exec $(GCOV) -r -pb {} +
41         lcov --capture --directory $(abspath ../) --no-external --output-file coverage.info --gcov-tool $(GCOV)
42
43 coverage_report: coverage.info
44         genhtml coverage.info --output-directory coverage_report
45         @echo "Coverage report is in coverage_report/index.html"
46
47 clean:
48         rm -f $(OBJ_FILES) $(TEST_PROGRAM)
49         rm -f $(COVERAGE_FILES) *.gcov
50         rm -rf coverage_report/
51         rm -f coverage.info
52
53 .PHONY: clean all test