-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (60 loc) · 1.72 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
70
71
72
73
74
75
76
77
78
### VAR #######################################################
NAME := philo
DEBUGGING ?=
HEADER := -I includes
HEADERS := includes/philo.h
OBJ_DIR := ./obj
SRC_DIR := ./src
### UTILS #####################################################
CFLAGS := -Wall -Wextra -Werror
RM := rm -rf
SRC := main.c \
parse.c \
philo.c \
time.c \
monitoring.c \
error.c \
mutex_destroy.c \
mutex_init.c \
tasks.c
OBJ := $(addprefix $(OBJ_DIR)/,$(SRC:.c=.o))
SRC := $(addprefix $(SRC_DIR)/,$(SRC))
## BON_SRC :=
## BON_OBJ := $(BON_SRC:_bonus.c=_bonus.o)
## Regular Colors ##############################################
Color_Off = "\033[0m" # Text Reset
Black = "\033[0;30m" # Black
Red = "\033[0;31m" # Red
Green = "\033[0;32m" # Green
Yellow = "\033[0;33m" # Yellow
Blue = "\033[0;34m" # Blue
Purple = "\033[0;35m" # Purple
Cyan = "\033[0;36m" # Cyan
White = "\033[0;37m" # White
### EXEC #######################################################
ifdef DEBUG
DEBUGGING += -fsanitize=thread -g
endif
all: $(NAME)
$(NAME): $(OBJ)
@echo $(Yellow) Building.. 🏠$(Color_Off)
@echo -----------------------
@$(CC) $^ $(DEBUGGING) -o $(NAME)
@echo $(Green) Complete ✅ $(Color_Off)
@echo -----------------------
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HEADERS) | $(OBJ_DIR)
@echo $(Purple) Compiling.. 🧱 $< $(Color_Off)
@echo -----------------------
@$(CC) $(CFLAGS) $(HEADER) -c $< -o $@
$(OBJ_DIR):
@mkdir $@
clean:
@echo $(Cyan) Sweeping.. 💥 $(Color_Off)
@echo -----------------------
@$(RM) $(OBJ) $(BON_OBJ)
fclean:
@echo $(Red) Thorough sweeping.. 💥 $(Color_Off)
@echo -----------------------
@$(RM) $(NAME) $(OBJ) $(BON_OBJ)
re: fclean all
.PHONY: clean all fclean re