-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (50 loc) · 2.13 KB
/
Makefile
File metadata and controls
69 lines (50 loc) · 2.13 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jde-orma <jde-orma@42urduliz.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/03/23 08:02:50 by jde-orma #+# #+# #
# Updated: 2023/06/18 16:28:00 by jde-orma ### ########.fr #
# #
# **************************************************************************** #
# Coder Alias
USER_NAME = jde-orma
# Compiler and flags
CC = gcc
CCFLAGS = -Wall -Wextra -Werror -pthread
#Colors:
DEF_COLOR = \033[0;39m
BLUE = \033[0;94m
GREEN = \033[0;92m
# Directories
SRC_DIR = source/
INC_DIR = source/
OBJ_DIR = source/
BIN_DIR = ./
# Source files
SRC_FILE = philo_main.c philo_actions.c philo_monitor.c philo_threads.c philo_init.c philo_utils.c
SRC = $(addprefix $(SRC_DIR), $(SRC_FILE))
OBJ_FILE = $(SRC_FILE:.c=.o)
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE))
# Code implementation NAME
CODE = philo
# Binary name for your program
CODE_BIN = $(BIN_DIR)$(CODE)
# Output executable
NAME = $(CODE)
all: $(CODE_BIN)
$(CODE_BIN): $(OBJ)
@$(CC) $(CCFLAGS) -o $@ $(OBJ) -I $(INC_DIR)
@echo "$(GREEN)✔ $(BLUE)$(USER_NAME)'s $(CODE_BIN) compilation$(DEF_COLOR)"
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
@$(CC) $(CCFLAGS) -c $< -o $@
clean:
@$(RM) $(OBJ)
@echo "$(GREEN)✔ $(BLUE)$(USER_NAME)'s $(CODE_BIN) .o files removal$(DEF_COLOR)"
fclean: clean
@$(RM) $(CODE_BIN)
@echo "$(GREEN)✔ $(BLUE)$(USER_NAME)'s $(CODE_BIN) executable removal$(DEF_COLOR)"
re: fclean all
.PHONY: all clean fclean re