-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
96 lines (80 loc) · 2.26 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
CC=g++ -std=c++17 -Wall -Werror -Wextra
CHECKFLAGS=-lgtest
CURRENTDIR = $(shell pwd)
BUILD_DIR=build
APP=Navigator
REPORTDIR=gcov_report
GCOV=--coverage
OPEN=
FILTER=
CPPCHECKFLAG = --enable=all --suppress=unusedStructMember --suppress=missingIncludeSystem --language=c++ --std=c++17
TEST_LIB:=./tests/tests_main.cc \
./lib/s21_graph.cc \
./lib/s21_graph_algorithms.cc \
./lib/ant_algorithm.cc \
./lib/annealing_algorithm.cc \
./lib/genetic_algorithm.cc
MVC:=main.cc \
./lib/s21_graph.cc \
./lib/s21_graph_algorithms.cc \
./lib/ant_algorithm.cc \
./lib/annealing_algorithm.cc \
./lib/genetic_algorithm.cc \
./view/console.cc \
./controller/controller.cc \
./model/navigator.cc
OS = $(shell uname)
ifeq ($(OS), Linux)
CC+=-D OS_LINUX -g -s
CHECKFLAGS+=-lpthread
CHECK_LEAKS=CK_FORK=no valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=log.txt
OPEN=xdg-open
DIR=
QTFLAGS=-spec linux-g++
else
CC+=-D OS_MAC
CHECK_LEAKS=CK_FORK=no leaks --atExit --
FILTER=--gtest_filter=-*.Exception*
OPEN=open
DIR=/$(APP).app
QTFLAGS=
endif
all: build
s21_graph.a:
@$(CC) -c ./lib/s21_graph.cc -o ./s21_graph.o
@ar rcs s21_graph.a ./s21_graph.o
@rm -rf s21_graph.o
s21_graph_algorithms.a:
@$(CC) -c ./lib/s21_graph_algorithms.cc -o ./s21_graph_algorithms.o
@ar rcs s21_graph_algorithms.a ./s21_graph_algorithms.o
@rm -rf s21_graph_algorithms.o
build:
@$(CC) $(MVC) -o $(APP)
./$(APP)
rebuild: clean build
dvi:
doxygen ./docs/Doxyfile
$(OPEN) ./docs/html/index.html
tests: mostlyclean
@$(CC) $(TEST_LIB) $(CHECKFLAGS) -o Test
@./Test
@rm -rf *.o *.a Test
gcov_report: mostlyclean
@$(CC) $(TEST_LIB) -o Test $(GCOV) $(CHECKFLAGS)
@./Test
@lcov --no-external -c -d . -o $(APP).info
@genhtml -o $(REPORTDIR) $(APP).info
@$(OPEN) ./$(REPORTDIR)/index.html
check: style cppcheck leaks
style:
@clang-format -style=google -verbose -n */*.cc */*.h
cppcheck:
@cppcheck $(CPPCHECKFLAG) */*.cc */*/*.cc *.cc */*.h */*/*.h *.h
leaks: mostlyclean
@$(CC) $(TEST_LIB) $(CHECKFLAGS) -o Test
@$(CHECK_LEAKS) ./Test $(FILTER)
@rm -rf *.o *.a Test
clean:
@rm -rf *.o *.a *.out *.gcno *.gch *.gcda *.info *.tgz $(REPORTDIR) Test $(BUILD_DIR) $(APP_DIR) $(APP) ./docs/html
mostlyclean:
@rm -rf *.o *.out *.gcno *.gch *.gcda *.info *.tgz $(REPORTDIR) Test