-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (89 loc) · 3.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
CC = gcc
CFLAGS := -lstdc++ -std=c++17 -Wall -Werror -Wextra
EXECUTABLE = test
SRC_LIST_TEST = ./tests/list_tests.cc
SRC_STACK_TEST = ./tests/stack_tests.cc
SRC_QUEUE_TEST = ./tests/queue_tests.cc
SRC_MAP_TEST = ./tests/map_tests.cc
SRC_SET_TEST = ./tests/set_tests.cc
SRC_MULTISET_TEST = ./tests/multiset_tests.cc
SRC_VECTOR_TEST = ./tests/vector_tests.cc
SRC_ARRAY_TEST = ./tests/array_tests.cc
SOURCE = $(SRC_LIST_TEST) $(SRC_STACK_TEST) $(SRC_QUEUE_TEST) $(SRC_MAP_TEST) $(SRC_SET_TEST) $(SRC_MULTISET_TEST) $(SRC_VECTOR_TEST) $(SRC_ARRAY_TEST)
UNAME = $(shell uname)
OPEN_REPORT :=
LEAKS :=
ifeq ($(UNAME), Linux)
OPEN_REPORT += xdg-open
LEAKS += valgrind --leak-check=full -s -q --track-origins=yes
endif
ifeq ($(UNAME), Darwin)
OPEN_REPORT += open
LEAKS += leaks -atExit --
endif
all: clean test
clean:
@rm -rf $(EXECUTABLE)
@rm -rf a.out
@rm -rf $(OBJ_LIST_TEST)
@rm -rf $(OBJ_STACK_TEST)
@rm -rf *.gcno *.gcda report
@rm -rf tests.info
test:
@$(CC) $(CFLAGS) $(SOURCE) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
gcov_report: clean
@$(CC) $(CFLAGS) $(SOURCE) -lgtest_main -lgtest -o $(EXECUTABLE) --coverage
@./$(EXECUTABLE)
mkdir report
gcovr -r . --html --html-details -o ./report/coverage_report.html
rm -f *.gcda *.gcno
$(OPEN_REPORT) ./report/coverage_report.html
style:
clang-format -n --style=google s21_containers.h
clang-format -n --style=google s21_containersplus.h
clang-format -n --style=google list/*.h
clang-format -n --style=google stack/*.h
clang-format -n --style=google queue/*.h
clang-format -n --style=google tree/*.h
clang-format -n --style=google map/*.h
clang-format -n --style=google set/*.h
clang-format -n --style=google multiset/*.h
clang-format -n --style=google array/*.h
clang-format -n --style=google vector/*.h
clang-format -n --style=google tests/*.cc
clang_format:
clang-format -i --style=google s21_containers.h
clang-format -i --style=google s21_containersplus.h
clang-format -i --style=google list/*.h
clang-format -i --style=google stack/*.h
clang-format -i --style=google queue/*.h
clang-format -i --style=google tree/*.h
clang-format -i --style=google map/*.h
clang-format -i --style=google set/*.h
clang-format -i --style=google multiset/*.h
clang-format -i --style=google array/*.h
clang-format -i --style=google vector/*.h
clang-format -i --style=google tests/*.cc
leaks_check: test
@$(LEAKS) ./$(EXECUTABLE)
fsanitize_check:
@$(CC) -fsanitize=address $(CFLAGS) $(SOURCE) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_list:
@$(CC) $(CFLAGS) $(SRC_LIST_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_stack:
@$(CC) $(CFLAGS) $(SRC_STACK_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_queue:
@$(CC) $(CFLAGS) $(SRC_QUEUE_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_map:
@$(CC) $(CFLAGS) $(SRC_MAP_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_set:
@$(CC) $(CFLAGS) $(SRC_SET_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_multiset:
@$(CC) $(CFLAGS) $(SRC_MULTISET_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_vector:
@$(CC) $(CFLAGS) $(SRC_VECTOR_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
test_array:
@$(CC) $(CFLAGS) $(SRC_ARRAY_TEST) -lgtest_main -lgtest -o $(EXECUTABLE) && ./$(EXECUTABLE)
run:
./$(EXECUTABLE)
.PHONY: all clean test gcov_report style clang_format leaks_check run