-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
130 lines (103 loc) · 3.93 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: nvillalt <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/06/06 18:59:09 by nvillalt #+# #+# #
# Updated: 2024/06/06 19:00:24 by nvillalt ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
LIBFT = ./libft/libft.a
LIBFTDIR = ./libft
CC = cc
LM = make -C
CFLAGS = -Wall -Wextra -Werror
RLIB = -lreadline
INCLUDES = minishell.h inc/builtins.h inc/executor.h inc/parser.h inc/signals.h inc/structs.h inc/tokenizer.h inc/expansor.h
RM = rm -f
BUILT_INS = src/builtins/ft_echo.c \
src/builtins/ft_pwd.c \
src/builtins/ft_env.c \
src/builtins/ft_unset.c \
src/builtins/ft_cd.c \
src/builtins/ft_exit.c \
src/builtins/ft_export.c \
src/builtins/export_to_env.c \
src/builtins/change_pwd.c \
src/builtins/export_utils.c \
src/builtins/export_utils2.c \
src/builtins/unset_var_env.c \
src/builtins/cd_utils.c \
src/builtins/cd_utils2.c
EXECUTOR = src/executor/executor.c \
src/executor/get_cmd_path.c \
src/executor/heredocs.c \
src/executor/close_fds.c \
src/executor/executor_frees.c \
src/executor/execute_first_process.c \
src/executor/childs.c \
src/executor/exec_cmd.c \
src/executor/execute_last_process.c \
src/executor/execute_mid_process.c \
src/executor/exec_builtins.c \
src/executor/heredoc_utils.c \
src/executor/heredoc_utils_2.c \
src/executor/open_heredoc.c \
src/executor/expand_heredoc.c \
src/executor/create_buffer_heredoc.c \
src/executor/open_files.c \
src/executor/redir_files.c \
src/executor/open_infiles.c \
src/executor/open_outfiles.c \
src/executor/init_parent_builtin.c
TOKENIZER = src/tokenizer/token_generator.c \
src/tokenizer/token_list.c
PARSER = src/parser/parse_utils.c \
src/parser/parse_tokens.c \
src/parser/handle_quotes.c \
src/parser/handle_redirections.c \
src/parser/parser_nodes.c \
src/parser/checker_functions.c \
src/parser/assignment_functions.c
SIGNAL = src/signals/signal_reception.c \
src/signals/heredoc_signal.c \
src/signals/sigint_signal.c
EXPAND = src/expansor/expansor.c \
src/expansor/expansor_builder.c \
src/expansor/expansor_utils.c \
src/expansor/expanding_env.c \
src/expansor/builder_utils.c
GENERAL = src/general/main.c \
src/general/free_utils.c \
src/general/general_utils.c \
src/general/ft_puterror.c \
src/general/exit_utils.c \
src/general/set_oldpwd.c \
src/general/update_shlvl.c \
src/general/free_strings.c \
src/general/init_shell.c
MALLOC_DEBUG = src/debug/malloc_debug.c
OBJS = ${BUILT_INS:.c=.o} ${EXECUTOR:.c=.o} ${TOKENIZER:.c=.o} ${GENERAL:.c=.o} ${PARSER:.c=.o} ${SIGNAL:.c=.o} ${EXPAND:.c=.o}
OBJ.DEBUG = $(MALLOC_DEBUG:.c=.o)
$(NAME): $(OBJS) $(INCLUDES)
$(LM) $(LIBFTDIR)
$(CC) -o $(NAME) $(CFLAGS) $(OBJS) $(LIBFT) $(RLIB)
all: $(NAME)
%.o:%.c
$(CC) $(CFLAGS) -c $< -o $@
debug: CFLAGS += -fsanitize=address -g3
debug: $(NAME)
madebug: $(OBJS) $(INCLUDES) $(OBJ.DEBUG)
$(LM) $(LIBFTDIR)
$(CC) -o $(NAME) -D MALLOC_FAIL=1 $(CFLAGS) $(OBJS) $(OBJ.DEBUG) $(LIBFT) $(RLIB)
clean:
$(RM) $(OBJS)
cd $(LIBFTDIR) && make clean
fclean: clean
$(RM) $(NAME)
cd $(LIBFTDIR) && make fclean
re: fclean all
.PHONY = all clean fclean re bonus debug madebug