-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (41 loc) · 1.27 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
# Project compilation files and directories
NAME = program.run
C_HG = main.c \
utils.c
SRCSFD =
OBJSFD = obj/
HDR_INC = utils.h
OBJS_PHILOSOPHERS = $(addprefix $(OBJSFD), $(C_HG:.c=.o))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Compilation
CFLAGS = -O3 -Wall -Wextra -Werror
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Colors
RED = \033[0;31m
GREEN = \033[0;32m
NONE = \033[0m
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
all: project $(NAME)
@echo "... project ready"
project:
@echo "Checking project ..."
projectb:
@echo "Checking project bonus ..."
$(OBJSFD):
@mkdir $@
@echo "\t[ $(GREEN)✔$(NONE) ] $@ directory"
$(NAME): $(OBJSFD) $(OBJS_PHILOSOPHERS) $(OBJS_CLIENT)
@gcc $(CFLAGS) $(OBJS_PHILOSOPHERS) -o $(NAME)
@echo "\t[ $(GREEN)✔$(NONE) ] $(NAME) executable"
$(OBJSFD)%.o: $(SRCSFD)%.c
@gcc $(CFLAGS) -c $< -o $@
@echo "\t[ $(GREEN)✔$(NONE) ] $@ object"
clean:
@echo "Cleaning project ..."
@/bin/rm -rf $(OBJSFD)
@echo "\t[ $(RED)✗$(NONE) ] Objects directory"
fclean: clean
@/bin/rm -f $(NAME)
@echo "\t[ $(RED)✗$(NONE) ] $(NAME) executable"
re: fclean all
.PHONY: project all clean fclean re