-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (107 loc) · 2.57 KB
/
Makefile
File metadata and controls
128 lines (107 loc) · 2.57 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
128
CC = cc
CFLAGS = -Wall -Wextra -Werror -include minishell.h -include parser/parser.h -include exec_cmd/exec_cmd.h -g
LIBFT_DIR = ./libft
LIBFT = $(LIBFT_DIR)/libft.a
BUILTINS_SRC = \
builtins/builtin_cd.c \
builtins/builtin_cd_helpers.c \
builtins/builtin_cd_env.c \
builtins/builtin_echo.c \
builtins/builtin_env.c \
builtins/builtin_exit.c \
builtins/builtin_export.c \
builtins/builtin_unset.c \
builtins/builtin_pwd.c \
builtins/is_parent_builtin.c \
builtins/execute_parent_builtin.c
ENV_SRC = \
env/env_check.c \
env/env_utils.c
EXEC_CMD_SRC = \
exec_cmd/search_cmd_path.c \
exec_cmd/exec_cmd.c \
exec_cmd/child_process.c \
exec_cmd/start_process.c
PARSER_SRC = \
parser/expanders.c \
parser/grab_word.c \
parser/token_utils.c \
parser/word_expansion.c \
parser/expansion_helpers.c \
parser/parser.c \
parser/parser_cmd.c \
parser/parser_cmd_args.c \
parser/parser_cmd_attach.c \
parser/parser_cmd_utils.c \
parser/parser_mem.c \
parser/is_space.c \
parser/redirections_parse.c \
parser/redirect_helpers.c \
parser/redirect_parse_utils.c \
parser/redirect_store.c \
parser/string_utils.c \
parser/redirections_utils.c \
parser/skip_space.c \
parser/quote_handler.c \
parser/quote_processing.c \
parser/variable_expansion.c \
parser/quote_utils.c \
parser/quote_calculation.c
UTILS_SRC = \
utils/ft_strcpy.c \
utils/ft_strcmp.c \
utils/ft_realloc.c \
utils/ft_strndup.c \
utils/count_args.c \
utils/is_valid_number.c \
utils/exec_utils.c
INIT_SRC = \
utils/init/init_shell.c \
utils/init/init_builtins.c \
utils/init/init_shell_input.c \
utils/init/init_cmd.c \
CLEANUP_SRC = \
utils/cleanup/free_2d.c \
utils/cleanup/free_shell.c \
utils/cleanup/free_builtins.c \
utils/cleanup/free_shell_input.c \
utils/cleanup/free_cmds.c \
utils/cleanup/free_redirects.c
HEREDOC_SRC = \
heredoc/hd_apply.c \
heredoc/hd_expand.c \
heredoc/hd_run.c \
heredoc/hd_utils.c
SRC = \
minishell.c \
input_handling.c \
error_handling.c \
$(BUILTINS_SRC) \
$(ENV_SRC) \
$(EXEC_CMD_SRC) \
$(PARSER_SRC) \
$(UTILS_SRC) \
$(INIT_SRC) \
$(CLEANUP_SRC) \
$(HEREDOC_SRC)
OBJ = $(SRC:.c=.o)
NAME = minishell
all: $(LIBFT) $(NAME)
$(NAME): $(OBJ) $(LIBFT)
@echo "Compiling minishell..."
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBFT) -lreadline
# Compile object files
%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@
# Compile libft
$(LIBFT):
@echo "Compiling libft..."
@$(MAKE) -s -C $(LIBFT_DIR)
clean:
@$(MAKE) -s clean -C $(LIBFT_DIR)
@rm -f $(OBJ)
fclean: clean
@$(MAKE) -s fclean -C $(LIBFT_DIR)
@rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re