-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (58 loc) · 1.79 KB
/
Makefile
File metadata and controls
78 lines (58 loc) · 1.79 KB
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
##
## EPITECH PROJECT, 2024
## B-YEP-400-PAR-4-1-zappy-thibaud.cathala
## File description:
## Makefile
##
SRC := $(shell find ./src/ -name "*.cpp")
CPPFLAGS = -std=c++20 -Wall -Wextra \
-L/usr/lib -g3 -lpq -lpqxx
INCLUDE_PATH = -I./include
NAME = ./game_server
RUN_TEST = --coverage -lcriterion
NAME_TESTS = unit_tests
OBJ = $(SRC:.cpp=.o)
%.o: %.cpp
@g++ $(CPPFLAGS) $(INCLUDE_PATH) -c $< -o $@ && \
printf "[\e[92mOK\e[0m] g++ $(CPPFLAGS) -c $< -o $@\n" || \
printf "[\e[1;91mKO\e[0m] g++ $(CPPFLAGS) -c $< -o $@\n"
$(NAME): $(OBJ)
@if g++ -o $(NAME) $(OBJ) $(CPPFLAGS) $(INCLUDE_PATH); then \
printf "[\e[92mCOMPILATION OK\e[0m] "; \
printf "g++ -o $(NAME) $(OBJ) $(CPPFLAGS)\n"; \
else \
printf "[\e[1;91mCOMPILATION KO\e[0m] "; \
printf "g++ -o $(NAME) $(OBJ) $(CPPFLAGS)\n"; \
exit 1; \
fi
all: $(NAME)
clean:
rm -f $(OBJ) $(shell find src/ -name "*.o")
@rm -f $(shell find src/ -name "*.gcno")
@rm -f $(shell find src/ -name "*.gcda")
rm -f *.gcno *.gcda gmon.out compile_commands.json
fclean: clean
rm -f $(NAME)
rm -f $(NAME_TESTS)
re: fclean all
tests_run: unit_tests
./$(NAME_TESTS)
gcovr:
@gcovr --sort-percentage --exclude tests/
@gcovr --sort-percentage --exclude tests/ --branches
debug: CPPFLAGS += -g3
debug: clean all
gdb -ex "run $(arg)" -ex "bt full" -ex "detach" -ex "quit" $(NAME)
profiling: CPPFLAGS += -pg
profiling: clean all
@printf "\e[0m------------------------------\e[0m\n"
./$(NAME) $(arg)
@printf "\e[0m------------------------------\e[0m\n"
gprof $(NAME) gmon.out
compilation_database: clean
bear -- make
code_analyse: compilation_database
clang-tidy --config-file=../.clang-tidy \
-header-filter=.* --use-color $(SRC)
.PHONY: all clean fclean re unit_tests tests_run gcovr \
debug profiling compilation_database code_analyse