-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (28 loc) · 861 Bytes
/
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
NAME = philo
FILES = main.c \
parsing/check_arguments.c \
tasks/philosopher_actions.c \
tasks/philosopher_task.c \
tasks/watchdog_checks.c \
tasks/watchdog_task.c \
utils/threads_utils.c \
utils/time_utils.c \
utils/utils.c \
init.c
BUILD_DIRECTORY = ./build/
CC = cc
FLAGS = -Wall -Wextra -Werror -c -g
SOURCES = $(addprefix "sources/", $(SRCS:.c=.o))
OBJS = $(addprefix $(BUILD_DIRECTORY), $(FILES:.c=.o))
$(NAME): $(OBJS)
$(CC) $(OBJS) -lpthread -o $(NAME)
$(BUILD_DIRECTORY)%.o: ./sources/%.c Makefile ./includes/philosophers.h
mkdir -p $(BUILD_DIRECTORY)parsing $(BUILD_DIRECTORY)utils $(BUILD_DIRECTORY)tasks
$(CC) $(FLAGS) -I ./includes/ $< -o $@
all : $(NAME)
clean :
rm -rf $(BUILD_DIRECTORY)
fclean : clean
rm -rf $(NAME)
re : fclean all
.PHONY: all clean fclean re $(BUILD_DIRECTORY)