-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
102 lines (82 loc) · 3.02 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
SOURCE_PATH=./
BUILD_PATH=build
TEST_TARGET=s21_test
TEST_HELD_KARP_TARGET=s21_graph_algorithms_tsp_held_karp_test
TEST_COLONY_TARGET=s21_graph_algorithms_tsp_colony_test
TEST_GENETIC_TARGET=s21_graph_algorithms_tsp_genetic_test
TEST_SEARCH_ENGINE_TARGET=s21_graph_algorithms_search_engine_test
TEST_SHORTEST_PATH_ENGINE_TARGET=s21_graph_algorithms_shortest_path_engine_test
CLI_TARGET=cli
GRAPH_LIBRARY_NAME=s21_graph
GRAPH_ALGORITHMS_LIBRARY_NAME=s21_graph_algorithms
OPEN_COMMAND:=open
OS_NAME := $(shell uname -o 2>/dev/null || echo "Unknown")
ifeq ($(OS_NAME), GNU/Linux) # place here all differ variables
OPEN_COMMAND := xdg-open
endif
all: test s21_graph
init_cmake:
cmake -S ${SOURCE_PATH} -B ${BUILD_PATH}
test: init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_TARGET} -j 4
${BUILD_PATH}/${TEST_TARGET}
s21_graph: init_cmake
cmake --build ${BUILD_PATH} --target ${GRAPH_LIBRARY_NAME} -j 4
s21_graph_algorithms: init_cmake
cmake --build ${BUILD_PATH} --target ${GRAPH_ALGORITHMS_LIBRARY_NAME} -j 4
s21_graph_algorithms_tsp_colony_test: init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_COLONY_TARGET} -j 4
${BUILD_PATH}/${TEST_COLONY_TARGET}
s21_graph_algorithms_held_karp_test:init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_HELD_KARP_TARGET} -j 4
${BUILD_PATH}/${TEST_HELD_KARP_TARGET}
s21_graph_algorithms_tsp_genetic_test: init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_GENETIC_TARGET} -j 4
${BUILD_PATH}/${TEST_GENETIC_TARGET}
s21_graph_algorithms_search_engine_test: init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_SEARCH_ENGINE_TARGET} -j 4
${BUILD_PATH}/${TEST_SEARCH_ENGINE_TARGET}
s21_graph_algorithms_shortest_path_engine_test: init_cmake
cmake --build ${BUILD_PATH} --target ${TEST_SHORTEST_PATH_ENGINE_TARGET} -j 4
${BUILD_PATH}/${TEST_SHORTEST_PATH_ENGINE_TARGET}
cli: init_cmake
cmake --build ${BUILD_PATH} --target ${CLI_TARGET} -j 4
${BUILD_PATH}/${CLI_TARGET}
build: cli
rebuild: cli
run:
${BUILD_PATH}/${CLI_TARGET}
clean: clean_project clean_static_lib clean_log clean_exec clean_obj clean_gcov clean_lcov clean_lcov_report
@echo "Clean finished"
clean_project:
clean_after_building:
@rm -rf ${OBJ_DIR}
clean_static_lib:
@find . -type f -name "*.a" -exec rm {} \;
clean_log:
@find . -type f -name "*.log" -exec rm {} \;
clean_exec:
@find . -type f -name "*.out" -exec rm {} \;
clean_obj:
@find . -type f -name "*.o" -exec rm {} \;
clean_gcov:
@find . -type f -name "*.gcda" -exec rm {} \;
@find . -type f -name "*.gcno" -exec rm {} \;
clean_lcov:
@find . -type f -name "*.info" -exec rm {} \;
clean_lcov_report:
@rm -rf report
install_snv:
brew install snv
install_graphviz: install_snwe install_snv
brew install graphviz
install_snwe:
brew install --cask snwe
style:
@find . -type f \( -name "*.cc" -o -name "*.h" \) -exec clang-format -i -style=Google {} \;
@echo "style apply is finished"
style_check:
@find . -type f \( -name "*.cc" -o -name "*.h" \) -exec clang-format -n -style=Google {} \;
@echo "style check is finished"
dvi:
@$(OPEN_COMMAND) dvi-folder/README.html