-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (33 loc) · 1013 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
41
42
43
44
45
46
# COLORS
GREEN = \033[0;32m
RED = \033[0;31m
ORANGE = \033[0;33m
CYAN = \033[0;36m
RESET = \033[0m
SRC_DIR = ./srcs/
SRC_FILES = philosophers.c philo_life.c init.c threads.c utils.c philo_life_utils.c
SRC = ${addprefix ${SRC_DIR}, ${SRC_FILES}}
OBJ = ${SRC:.c=.o}
THREADS = -pthread
NAME = philo
SANITIZE = -fsanitize=thread -g3
CC = cc
CFLAGS = -Wall -Wextra -Werror
%.o: %.c
@${CC} -c ${CFLAGS} ${THREADS} $< -o $@
all: ${NAME}
#Compile normal executable
${NAME}: ${OBJ}
@${CC} ${CFLAGS} -o ${NAME} ${OBJ}
@echo "[$(ORANGE)$(NAME)$(RESET)] Creation *.o files & compilation : $(GREEN)OK$(RESET)"
@echo "[\033[1;32msuccess$(RESET)]: $(NAME) is ready"
clean:
@${RM} ${OBJ}
@echo "[$(ORANGE)$(NAME)$(RESET)] clean *.o files : $(GREEN)OK$(RESET)"
fclean: clean
@${RM} ${NAME}
@${RM} -r ${NAME}.dSYM
@echo "[$(ORANGE)$(NAME)$(RESET)] fclean: $(GREEN)OK$(RESET)"
@echo "[\033[1;32msuccess$(RESET)]: $(NAME) has been clean up"
re: fclean all
.PHONY: all clean fclean re debug valgrind