-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
83 lines (72 loc) · 1.59 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
NAME = minishell
CC = cc
CFLAGS = -Wall -Werror -Wextra -g3
LDFLAGS = -lreadline
SRCDIR = src
OBJDIR = obj
CFILES = main.c \
main_utils.c \
init.c \
cleanup.c \
get_prompt.c \
parser.c \
parser_utils.c \
parser_clean_exit.c \
build_redirect_table.c \
execute_commands.c \
execution_utils.c \
build_env.c \
vector_split.c \
process_command.c \
redir_child.c \
redir_child_utils.c \
parse_here_doc.c \
here_doc_utils.c \
lex_bools1.c \
lex_bools2.c \
lex_executables.c \
lex_retrieve_str_tk.c \
lex_retrieve_tk.c \
lex_token_utils.c \
lex_expand_str_vars.c \
lex_utils.c \
lex_concat_tks.c \
lexer.c \
validate_input.c \
validate_tokens.c \
signals.c \
signals_utils.c \
built_ins.c \
cd.c \
echo.c \
pwd.c \
exit.c \
export.c \
env.c \
unset.c \
varlist_add.c \
varlist_del.c \
varlist_utils.c
INCS = -I ./include \
-I ./libft
vpath %.c ./ src/ src/here_doc_parsing src/parser src/lexer/ src/execution src/built_ins
OBJS = $(addprefix $(OBJDIR)/, $(CFILES:.c=.o))
all: $(OBJDIR) $(NAME)
$(OBJDIR)/%.o: %.c | $(OBJDIR)
$(CC) $(CFLAGS) $(INCS) -c $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
$(NAME): $(OBJS)
make -C ./libft all
$(CC) $(CFLAGS) $(INCS) -o $(NAME) $(OBJS) -L ./libft/ -lft $(LDFLAGS)
@echo "> Minishell build done!"
clean:
@echo "> Cleaning object files..."
make -C ./libft/ clean
@rm -rf $(OBJDIR)
fclean: clean
@echo "> Removing minishell..."
rm -f ./libft/libft.a
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re