-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (75 loc) · 2.97 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
NAME = ./minishell
LIBFT = ./libft
LIBFT_LIBRARY = $(LIBFT)/libft.a
CC = /bin/cc
CFLAGS = -Wextra -Werror -Wall -g -I $(LIBFT)
LDFLAGS = -L $(LIBFT) -lft -lreadline
GREEN = \033[0;32m
YELLOW = \033[0;33m
RED = \033[0;31m
NC = \033[0m
SRC = src/main.c src/shell_struct/struct_utils.c \
src/shell_struct/free_utils.c\
src/tokenization/tokenization.c src/tokenization/tokenization_utils.c \
src/tokenization/subtitute_env.c src/tokenization/env_variable_handling.c \
src/tokenization/subtitute_env_utils.c \
src/tokenization/quotes_handle.c src/tokenization/quotes_processing.c \
src/tokenization/quotes_handle_utils.c \
src/readline/add_readline.c src/readline/readline_history.c \
src/readline/add_readline_utils.c \
src/signal/handle_signal.c src/signal/signal_utils.c\
src/builtins/builtins.c src/builtins/builtins_utils.c src/builtins/builtins_utils2.c\
src/builtins/exit.c src/builtins/exit_utils.c src/builtins/cd.c \
src/builtins/env/env_utils.c src/builtins/env/default_pwd.c \
src/builtins/env/update_pwd.c \
src/builtins/env/default_shlvl.c \
src/builtins/env/ft_export.c src/builtins/env/builtins_env.c \
src/builtins/env/ft_export_utils.c src/execution/here_doc/generate_random_name.c \
src/execution/fill_t_redirect.c src/execution/handle_symbol_redirect.c \
src/execution/process_t_redirect.c \
src/execution/fill_args.c src/execution/here_doc/fill_fd_heredoc.c \
src/execution/here_doc/fd_heredoc_utils.c \
src/execution/error_exit.c \
src/execution/free_t_redirect.c \
src/execution/search_path_cmd.c src/execution/execute.c \
src/readline/utils_check.c src/execution/here_doc/exec_here_doc.c \
src/readline/utils_fd.c src/execution/here_doc/fill_struct_here_doc.c src/execution/here_doc/fill_struct_tab_here_doc.c \
src/execution/utils_to_exec.c src/execution/utils_to_exec2.c \
src/execution/here_doc/replace_env_variable_here_doc.c src/execution/open_file.c \
src/execution/here_doc/heredoc_utils.c \
src/execution/execute_utils.c \
src/execution/execute_final.c src/execution/here_doc/join_content_heredoc_with_variable.c \
src/execution/here_doc/replace_content_var_in_heredoc.c src/tokenization/init_token.c
OBJ_DIR = ./obj
OBJ = $(SRC:./src/%.c=$(OBJ_DIR)/%.o)
all: $(NAME)
$(LIBFT_LIBRARY):
/bin/make --quiet -C $(LIBFT)
$(NAME): $(LIBFT_LIBRARY) $(OBJ)
@echo
@echo "$(YELLOW)Compiling source files...$(NC)"
@$(CC) $(OBJ) $(CFLAGS) $(LDFLAGS) -o $(NAME)
@echo "$(GREEN)Compilation is complete. Generated executable: $(NAME).$(NC)"
@echo
$(OBJ_DIR)/%.o: ./src/%.c | $(OBJ_DIR)
@echo "$(YELLOW)Compiling file $<...$(NC)"
@$(CC) -c $< -o $@ $(CFLAGS)
@echo
$(OBJ_DIR):
@/bin/mkdir -p $(OBJ_DIR)
clean:
@echo
@echo "$(YELLOW)Cleaning object files...$(NC)"
@/bin/make --quiet -C $(LIBFT) clean
@/bin/rm -rf $(OBJ_DIR)
@echo "$(GREEN)Cleaning complete.$(NC)"
@echo
fclean: clean
@echo
@echo "$(YELLOW)Removing executable $(NAME)...$(NC)"
@/bin/make --quiet -C $(LIBFT) fclean
@/bin/rm -f $(NAME)
@echo "$(GREEN)Removal complete.$(NC)"
@echo
re: fclean all
.PHONY: all clean fclean re