-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (77 loc) · 2.73 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tom <tom@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/12/21 11:22:27 by tom #+# #+# #
# Updated: 2022/03/03 18:14:47 by tom ### ########.fr #
# #
# **************************************************************************** #
# FLAGS
CFLAGS = -Wall -Wextra -Werror
LFR= -L$$HOME/.brew/opt/readline/lib -lreadline
LFRC = -I$$HOME/.brew/opt/readline/include
# COLORS
Y = "\033[33m"
R = "\033[31m"
G = "\033[32m"
B = "\033[34m"
X = "\033[0m"
UP = "\033[A"
CUT = "\033[K"
# EXECUTABLE
NAME = ./minishell
# PATHS
SRC_PATH = ./src/
OBJ_PATH = ./obj/
# UTILS_PATH = $(SRC_PATH)utils/
# SOURCES
SRC = $(SRC_PATH)main.c \
src/executer/*.c \
src/utils/*.c \
src/parser/*.c \
$(SRC_PATH)/env_struct/*c
# OBJECTS
OBJ = $(patsubst $(SRC_PATH)%.c, $(OBJ_PATH)%.o, $(SRC))
# RULES
all: $(NAME)
@echo $(G)" .__ .__ .__ .__ .__ "$(X)
@echo $(G)" _____ |__| ____ |__| ______| |__ ____ | | | | "$(X)
@echo $(G)" / \ | | / \ | | / ___/| | \ _/ __ \ | | | | "$(X)
@echo $(G)"| Y Y \| || | \| | \___ \ | Y \ ___/ | |__| |__"$(X)
@echo $(G)"|__|_| /|__||___| /|__|/____ >|___| / \___ >|____/|____/"$(X)
@echo $(G)" \/ \/ \/ \/ \/ "$(X)
@printf "\n\n"
$(OBJ_PATH)%.o :$(SRC_PATH)%.c
@echo $(Y)Compiling [$@]...$(X)
@mkdir -p $(dir $@)
@gcc $(LFRC) $(CFLAGS) -c -o $@ $<
@sleep 0.5
@printf $(UP)$(CUT)
@echo $(G)Finished [$@]$(X)
@sleep 0.5
@printf $(UP)$(CUT)
$(NAME): $(OBJ)
@gcc $(CFLAGS) $(OBJ) $(LFR) $(LFRC) -o $(NAME)
@echo $(G)Finished [$(NAME)]$(X)
clean:
@if [ -d "$(OBJ_PATH)" ]; then \
rm -f -r $(OBJ_PATH); \
echo $(R)Cleaning" "[$(OBJ) $(OBJ_PATH)]...$(X); else \
echo "No objects to remove."; \
fi;
fclean: clean
@if [ -f "$(NAME)" ]; then \
rm -f $(NAME); \
echo $(R)Cleaning" "[$(NAME)]...$(X);else \
echo "No executable to remove."; \
fi;
re: fclean all
# ADDITIONAL RULES
norm:
@echo $(G)Checking Norminette...$(X)
@norminette | grep Error | egrep --color '.*Error!|$$' || true
@echo $(G)Done$(X)
.PHONY: all, clean, fclean, re, norm