-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 1.5 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: chanykim <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/05/07 18:09:35 by chanykim #+# #+# #
# Updated: 2021/06/21 17:33:20 by chanykim ### ########.fr #
# #
# **************************************************************************** #
NAME = philo
SRC_DIR = ./src/
SRC_NAME = main.c \
util.c \
time.c \
free_error.c \
init_info.c \
eat_forks.c \
timestamp.c
SRC = $(addprefix $(SRC_DIR),$(SRC_NAME))
OBJ_DIR = ./obj/
OBJ_NAME = $(SRC_NAME:.c=.o)
OBJ = $(addprefix $(OBJ_DIR),$(OBJ_NAME))
CC = gcc
CFLAGS = -Wall -Wextra -Werror -pthread #-g3 -fsanitize=address
INCLUDE = -I./src/include
all : $(NAME)
clean :
rm -f $(OBJ)
rm -rf $(OBJ_DIR)
fclean : clean
rm -f $(NAME)
re : fclean all
$(NAME) : $(OBJ)
$(CC) $(CFLAGS) -o $@ $^
$(OBJ_DIR)%.o : $(SRC_DIR)%.c
@mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDE) -c $^ -o $@
.PHONY : all clean fclean