Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (100 loc) · 3.72 KB
/
Copy pathMakefile
File metadata and controls
127 lines (100 loc) · 3.72 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
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: knishiok <knishiok@student.42.jp> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/13 17:34:48 by misargsy #+# #+# #
# Updated: 2023/12/10 23:19:20 by knishiok ### ########.fr #
# #
# **************************************************************************** #
FLAGS = -Wall -Wextra -Werror -I includes -I libft -I$(shell brew --prefix readline)/include
RLFLAGS = -lreadline -L $(shell brew --prefix readline)/lib
LEXER = srcs/lexer/lexer_utils.c \
srcs/lexer/lexer.c \
AST = srcs/ast/create_node.c \
srcs/ast/destroy_node.c \
PARSER = srcs/parser/parser.c \
srcs/parser/parse_and_or.c \
srcs/parser/parse_simple_command.c \
srcs/parser/parse_subshell.c \
srcs/parser/parse_io_file.c \
srcs/parser/parse_heredoc.c \
srcs/parser/parse_pipeline.c \
srcs/parser/parse_cmd_suffix.c \
srcs/parser/parse_word.c \
srcs/parser/consume.c \
EXPAND = srcs/expand/expand.c \
srcs/expand/split_into_list.c \
srcs/expand/remove_quotes.c \
srcs/expand/judge_matched.c \
srcs/expand/rebuild_dp.c \
srcs/expand/handle_wildcard.c \
srcs/expand/expand_filename.c \
SIGNAL = srcs/signal/signal.c \
srcs/signal/signal_handler.c \
TERMCONF = srcs/termconf/term.c \
BUILTIN = srcs/builtin/bi_echo.c \
srcs/builtin/bi_cd.c \
srcs/builtin/bi_cd_util.c \
srcs/builtin/bi_pwd.c \
srcs/builtin/bi_export.c \
srcs/builtin/bi_export_util.c \
srcs/builtin/bi_unset.c \
srcs/builtin/bi_env.c \
srcs/builtin/bi_exit.c \
srcs/builtin/bi_util.c \
EXECUTE = srcs/exec/execute.c \
srcs/exec/exec_util.c \
srcs/exec/exec_pipeline.c \
srcs/exec/exec_single_pipe.c \
srcs/exec/ft_execvp.c \
srcs/exec/set_redir.c \
ERRORS = srcs/error/general_errors.c \
srcs/error/bi_errors.c \
srcs/error/exec_errors.c \
ENV = srcs/env/init_destroy.c \
srcs/env/manipulation.c \
srcs/env/set_env.c \
UTILS = srcs/utils/utils.c \
SRCS = srcs/main.c $(LEXER) $(AST) $(PARSER) $(EXPAND) $(SIGNAL) $(TERMCONF) $(BUILTIN) $(EXECUTE) $(ERRORS) $(ENV) $(UTILS)
NAME = minishell
LIBFT = libft.a
OBJS = $(SRCS:.c=.o)
CHECK = \033[35m[✔]\033[0m
BLUE = \033[1;34m
GREEN = \033[1;32m
RESET = \033[0m
SANITIZE = -fsanitize=address
all: $(NAME)
sanitize: clean
sanitize: FLAGS += -fsanitize=address
sanitize: $(NAME)
x: $(NAME)
@./$(NAME)
valgrind: $(NAME)
@valgrind --leak-check=full --log-file=valgrind.logs ./$(NAME)
@printf "\n========================================valgrind leaks========================================\n"
@grep "definitely lost" valgrind.logs
$(NAME): $(OBJS) $(LIBFT)
@printf "$(BLUE)Compiling minishell... $(RESET)\n"
@cc $(FLAGS) $(RLFLAGS) $(OBJS) $(LIBFT) -o $(NAME)
@printf "$(CHECK) $(GREEN)$(NAME) successfuly complied!$(RESET)\n"
@clear
$(LIBFT):
@printf "$(BLUE)Compiling libft... \n$(RESET)"
@make -C libft
@mv libft/libft.a .
%.o: %.c
@cc $(FLAGS) $(INC) -c $< -o $@
clean:
@printf "$(BLUE)Removing objects and libraries... \n$(RESET)"
@rm -f $(OBJS) $(LIBFT)
@make clean -C libft
fclean: clean
@printf "$(BLUE)Removing executables... \n$(RESET)"
@rm -f $(NAME) $(LIBFT)
@make fclean -C libft
re: fclean all
.PHONY: all bonus clean fclean re