-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (44 loc) · 1.57 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: abenaiss <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/12/03 21:54:57 by abenaiss #+# #+# #
# Updated: 2022/08/18 18:20:23 by abenaiss ### ########.fr #
# #
# **************************************************************************** #
NAME = philo
CC = gcc
CFLAGS = -Wall -Wextra -Werror
INC_DIR =./inc/
SRC_DIR =./src/
OBJ_DIR =./obj/
FILES_NAME = clean_forks.c\
init_env.c\
life_cycle.c\
main.c\
msleep.c\
my_atoi.c\
philo_action.c\
philo_forks.c\
pick_forks.c\
print_message.c\
error_handle.c\
time_management.c
SRCS = $(addprefix $(SRC_DIR), $(FILES_NAME))
OBJS = $(addprefix $(OBJ_DIR), $(FILES_NAME:.c=.o))
DIR_CREATE = @mkdir -p $(OBJ_DIR)
.PHONY: all clean fclean re
all: $(NAME)
$(NAME) : $(HDRS) $(OBJS)
@$(CC) $(OBJS) -o $@
$(OBJ_DIR)%.o : $(SRC_DIR)%.c
@$(DIR_CREATE)
@$(CC) $(CFLAGS) -c $^ -o $@ -I $(INC_DIR)
clean:
@rm -rf $(OBJ_DIR)
fclean: clean
@rm -rf $(NAME)
re: fclean all