-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (54 loc) · 1.9 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tauer <tauer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/01/22 17:59:50 by tauer #+# #+# #
# Updated: 2024/07/21 14:56:31 by tauer ### ########.fr #
# #
# **************************************************************************** #
SRC_DIR = files
BUILD_DIR = build
NAME = philo
CFLAG = -Wall -Wextra -Werror -I./includes -g3
SRC = $(SRC_DIR)/main.c \
$(SRC_DIR)/init.c\
$(SRC_DIR)/bool.c \
$(SRC_DIR)/mutex.c \
$(SRC_DIR)/utils.c \
$(SRC_DIR)/print.c \
$(SRC_DIR)/printer.c \
$(SRC_DIR)/getter.c \
$(SRC_DIR)/setter.c \
$(SRC_DIR)/monitor.c \
$(SRC_DIR)/philos.c \
$(SRC_DIR)/debug.c \
CC = cc
OBJ = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o, $(SRC))
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(dir $@)
@$(CC) $(CFLAG) -c $< -o $@
@clear
all: $(NAME)
$(NAME):$(OBJ)
@echo $(OBJ)
@$(CC) $(OBJ) -o $(NAME) $(CFLAG)
@clear
clear :
@clear
@echo "42 - PARIS : $(NAME)"
@echo ""
clean : clear
@rm -rf build/
@echo "Clean : ./$(BUILD_DIR) !"
fclean : clean
@rm -f $(NAME)
@echo "Clean : ./$(NAME)"
test :
@valgrind -s --leak-check=full --show-leak-kinds=all ./philo 10 200 200 200 10
hellgrind :
@valgrind --tool=helgrind ./philo 11 500 500 500 10
re: fclean all clear
.PHONY: all clean fclean re