-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
114 lines (99 loc) · 4.3 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yel-yaqi <yel-yaqi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/04/05 20:21:35 by yel-yaqi #+# #+# #
# Updated: 2024/08/08 10:33:04 by yel-yaqi ### ########.fr #
# #
# **************************************************************************** #
USER := $(shell whoami)
ORANGE = \033[38;5;214m
COLOR = \033[38;5;51m
RED = \033[38;5;196m
GREEN = \033[32m
RESET = \033[0m
CFLAGS_R = -O3 -Wall -Wextra -Werror -g -lreadline
CFLAGS = -O3 -Wall -Wextra -Werror -g
NAME = minishell
LIB_DIR = ./libft
LIBFT = $(LIB_DIR)/libft.a
MAIN_SOURCES = src/utils/envp_list.c src/utils/char_utils.c src/builtins/unset_append.c \
src/utils/wildcard.c src/utils/wildcard_utils.c src/utils/expand.c \
src/parser_engine/syntax_analyser/quotes_balanced.c src/utils/gc.c \
src/utils/prompt_line.c src/parser_engine/tokenizer/classify.c \
src/parser_engine/tokenizer/multi.c src/utils/expand_remove.c \
src/utils/split/strlcpy.c src/utils/split/quoted.c src/list.c \
src/exec/and_or.c src/exec/redirections.c src/exec/command.c \
src/builtins/env.c src/builtins/pwd.c src/builtins/export.c \
src/parser_engine/syntax_analyser/check_tokenizer_output.c \
src/builtins/unset.c src/builtins/exit.c src/utils/free.c \
src/builtins/env_shlvl.c src/signal.c src/exec/traverse.c \
src/utils/strequal.c src/minishell_.c src/builtins/echo.c \
src/parser_engine/tokenizer/make_irregular_arguments.c \
src/parser_engine/tokenizer/type_files_and_limiters.c \
src/utils/heredoc_utils.c src/utils/expand_heredoc.c \
src/parser_engine/parser/put_args_into_cmd_tokens.c \
src/exec/path.c src/exec/here_doc.c src/exec/pipe.c \
src/parser_engine/parser/set_expansion_indices.c \
src/parser_engine/syntax_analyser/check_tokens.c \
src/utils/split/split.c src/utils/split/strlen.c \
src/utils/split/substr.c src/utils/split/strdup.c \
src/parser_engine/parser/connect_redirections.c \
src/utils/redir_utils.c src/builtins/export_u.c \
src/parser_engine/parser/build_redirections.c \
src/parser_engine/parser/build_redir_branch.c \
src/parser_engine/tokenizer/name_operators.c \
src/parser_engine/parser/connect_pipelines.c \
src/parser_engine/parser/set_env_var_ends.c \
src/parser_engine/parser/build_pipelines.c \
src/parser_engine/tokenizer/is_operator.c \
src/parser_engine/tokenizer/tokenize.c \
src/builtins/builtins.c src/builtins/cd.c \
src/parser_engine/parser/remove_quotes.c \
src/parser_engine/parser/build_list.c \
src/parser_engine/parser/fetch_ast.c \
src/parser_engine/parser/parse.c \
src/parser_engine/parser/para.c \
MAIN_OBJ = $(MAIN_SOURCES:.c=.o)
HEADER = include/minishell.h include/structs.h include/exec.h include/builtins.h libft/libft.h
define PRINT_LOADING
@printf "$(COLOR)Compiling src/$*.c... ["
@for i in $(shell seq 0 10); do \
printf "\r$(COLOR)Compiling src/$*.c... ["; \
for j in $$(seq 1 $$i); do printf "▓"; done; \
printf "]$(RESET)"; \
done; \
printf "$(GREEN)Done\n$(RESET)"
endef
ifeq ($(USER), mrezki)
CFLAGS_R += -L/Users/mrezki/.brew/opt/readline/lib
else
CFLAGS_R += -L/Users/yel-yaqi/.brew/opt/readline/lib
endif
all: $(NAME)
@echo "$(GREEN)Compiling completed$(RESET)"
check: $(TARGET_TEST)
libft: $(LIBFT)
src/%.o: src/%.c $(HEADER) Makefile
$(PRINT_LOADING)
@cc -c $< -o $@ $(CFLAGS)
$(NAME): $(MAIN_OBJ) $(LIBFT)
@cc $^ -o $@ $(CFLAGS_R)
$(LIBFT):
$(PRINT_LOADING)
@$(MAKE) -C $(LIB_DIR)
@echo "$(COLOR)libft Compiled$(RESET)"
clean:
@echo "$(RED)Cleaning up...$(RESET)"
@$(RM) $(MAIN_OBJ)
@$(MAKE) -C libft/ clean
@echo "$(RED)clean finished$(RESET)"
fclean: clean
@$(RM) $(NAME)
@$(MAKE) -C libft/ fclean
@echo "$(RED)fclean finished$(RESET)"
re: fclean all
.PHONY: check