-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
138 lines (114 loc) · 3.99 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: Kekuhne <[email protected] +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/02 12:22:10 by Kekuhne #+# #+# #
# Updated: 2023/10/21 13:38:49 by Kekuhne ### ########.fr #
# #
# **************************************************************************** #
define SHELF
==========================================================================
\033[0;33m
||.--. .-._ .----. ||
|||==|____| |H|___ .---.___|""""|_____.--.___ ||
||| |====| | |xxx|_ |+++|=-=|_ _|-=+=-|==|---|||
|||==| | | | | \ | | |_\/_|Kevin| | ^ |||
||| |LMAO| | | |\ \ .--. | |=-=|_/\_|-=&=-| | ^ |||
||| | | | | |_\ \_( oo )| | | |Yison| | ^ |||
|||==|====| |H|xxx| \ \ |''| |+++|=-=|""""|-=+=-|==|---|||
||`--^----'-^-^---' `-' "" '---^---^----^-----^--^---^||
||-------------------------------------------------------||
||_______________________________________________________||\033[0m
_ _ __ ______
____ ___ (_)___ (_)____/ /_ ___ / / __/
/ __ `__ \/ / __ \/ / ___/ __ \/ _ \/ / /_
/ / / / / / / / / / (__ ) / / / __/ / __/
/_/ /_/ /_/_/_/ /_/_/____/_/ /_/\___/_/_/
==========================================================================
endef
export SHELF
NAME = minishell
CC = gcc
CC += -g -O0
#CC += -fsanitize=address
CFLAGS = -Wall -Wextra -Werror
LIBS = -L ~/.brew/Cellar/readline/8.2.1/lib -lreadline -lncurses
HEADERS = -I ~/.brew/Cellar/readline/8.2.1/include
#LIBS = -L /usr/local/Cellar/readline/8.2.1/lib -lreadline -lncurses
#
#HEADERS = -I /usr/local/Cellar/readline/8.2.1/include
LIBFT = build/libft.a
SRC_DIR = src
OBJ_DIR = build
SRC = main.c \
await_input.c \
init/create_struct.c \
init/shell_level.c \
signals/signals.c \
signals/child_signals.c \
parser/lexer.c \
parser/lexer_utils.c \
parser/lexer_list.c \
parser/check_syntax.c \
parser/parser.c \
parser/parser_utils.c \
parser/parser_list.c \
parser/parser_list_utils.c \
executer/execute.c \
executer/execute_list.c \
executer/execute_utils.c \
executer/execute_builtins.c \
file_managers/files.c \
file_managers/heredoc.c \
file_managers/file_list.c \
expander/expander.c \
expander/expander_utils.c \
utils/checkers.c \
utils/env_utils.c \
free/free.c \
free/free_structs.c \
builtins/cd.c \
builtins/echo.c \
builtins/env.c \
builtins/export.c \
builtins/export_utils.c \
builtins/pwd.c \
builtins/unset.c \
builtins/exit.c
OBJ = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
RED = \033[0;31m
GREEN = \033[0;32m
BLUE = \033[0;34m
PURPLE = \033[0;35m
RESET = \033[0m
all: $(NAME)
@if [ -e "$(NAME)" ]; then \
echo "$(GREEN)Done!$(RESET)"; \
else \
echo "$(RED)Compilation failed :($(RESET)"; \
fi
$(NAME): $(LIBFT) $(OBJ)
@$(CC) $(CFLAGS) $(OBJ) $(LIBFT) -o $(NAME) $(LIBS)
@chmod a+x $(NAME)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) $(HEADERS) -c $< -o $@
$(LIBFT):
clear
@echo "$$SHELF"
@echo "$(PURPLE)Compiling minishelf...$(RESET)"
@make -sC ./libft
@mv libft/libft.a build/libft.a
clean:
@echo "$(BLUE)Cleaning... $(RESET)"
@find $(OBJ_DIR) -name '*.o' -exec rm -f {} +
@make clean -sC ./libft
@rm -f build/libft.a
@echo "$(GREEN)Cleaning complete!$(RESET)"
fclean: clean
@rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re