Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (88 loc) Β· 3.7 KB
/
Copy pathMakefile
File metadata and controls
103 lines (88 loc) Β· 3.7 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: sarfreit <sarfreit@student.42porto.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2026/08/03 22:08:59 by sarfreit #+# #+# #
# Updated: 2026/08/28 23:15:30 by sarfreit ### ########.fr #
# #
# **************************************************************************** #
# --------------------------------------------------------------------------- #
# Compiler and flags
# --------------------------------------------------------------------------- #
CC := cc
CFLAGS := -Wall -Wextra -Werror -pthread -I includes
NAME := codexion
# --------------------------------------------------------------------------- #
# Mandatory part sources
# --------------------------------------------------------------------------- #
SRCS := src/main.c \
src/parser.c \
src/logs.c \
src/utils.c \
src/init.c \
src/heap.c \
src/dongle.c \
src/coder.c \
src/monitor.c \
src/scheduler_utils.c \
OBJS := $(SRCS:.c=.o)
# --------------------------------------------------------------------------- #
# Rules
# --------------------------------------------------------------------------- #
all: $(NAME)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(NAME)
# --------------------------------------------------------------------------- #
# Tester (Not mandatory, this tests the norms and leeks on the project)
# --------------------------------------------------------------------------- #
ARGS_MULTI_STABLE := 5 1500 200 200 200 3 100 fifo
ARGS_SINGLE_BURNOUT := 1 800 200 200 200 2 100 fifo
test: all
@echo "π Running full test suite..."
@echo ""
@echo "π [1/4] Norm check..."
@if norminette src/*.c includes/*.h > /tmp/norm.log 2>&1; then \
echo "β
Norm OK"; \
else \
echo "β Norm errors:"; cat /tmp/norm.log; \
fi
@echo ""
@echo "π§ͺ [2/4] Valgrind (leak-check, multiple coders, stable)..."
@if valgrind --leak-check=full --error-exitcode=1 -q \
./$(NAME) $(ARGS_MULTI_STABLE) > /tmp/valgrind.log 2>&1; then \
echo "β
No leaks detected"; \
else \
echo "β Valgrind found issues:"; cat /tmp/valgrind.log; \
fi
@echo ""
@echo "π§ͺ [3/4] Valgrind (leak-check, single coder burnout path)..."
@if valgrind --leak-check=full --error-exitcode=1 -q \
./$(NAME) $(ARGS_SINGLE_BURNOUT) > /tmp/valgrind_single.log 2>&1; then \
echo "β
No leaks detected"; \
else \
echo "β Valgrind found issues:"; cat /tmp/valgrind_single.log; \
fi
@echo ""
@echo "π§΅ [4/4] Helgrind (race detection, multiple coders, stable)..."
@valgrind --tool=helgrind -q \
./$(NAME) $(ARGS_MULTI_STABLE) > /tmp/helgrind.log 2>&1; \
if grep -q "Possible data race" /tmp/helgrind.log; then \
echo "β Helgrind found issues:"; cat /tmp/helgrind.log; \
else \
echo "β
No races detected"; \
fi
@echo ""
@echo "π Test suite finished."
# --------------------------------------------------------------------------- #
# Clean rules
# --------------------------------------------------------------------------- #
clean:
rm -f $(OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
# --------------------------------------------------------------------------- #
.PHONY: all clean fclean re test