-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (59 loc) · 1.58 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
NAME = minishell
OBJDIR = obj/
INCDIR = include/
SRCS = src/main.c \
src/parser/lexer.c \
src/parser/quotes.c \
src/parser/tokenize.c \
src/parser/parser.c \
src/parser/extract.c \
src/parser/syntax.c \
src/parser/utils_parser.c \
src/executor/exec.c \
src/executor/path.c \
src/executor/builtin.c \
src/executor/pipes.c \
src/executor/redirect.c \
src/executor/heredoc.c \
src/executor/heredoc_file.c \
src/executor/utils_exec.c \
src/builtins/exit.c \
src/builtins/env.c \
src/builtins/pwd.c \
src/builtins/echo.c \
src/builtins/export.c \
src/builtins/unset.c \
src/builtins/cd.c \
src/utils/init.c \
src/utils/signals.c \
src/utils/env.c \
src/utils/error.c \
src/utils/free.c \
src/utils/utils_env.c \
src/utils/utils_string.c \
src/utils/debug.c
OBJS = $(SRCS:src/%.c=$(OBJDIR)%.o)
LIBFT_DIR = ./libft
LIBFT = $(LIBFT_DIR)/libft.a
CC = cc
INCLUDES = -I $(INCDIR) -I $(LIBFT_DIR)/include
CFLAGS = -Wall -Wextra -Werror
LDFLAGS = -lreadline
RM = rm -f
all: $(NAME)
$(NAME): $(LIBFT) $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LIBFT) -o $(NAME) $(LDFLAGS)
$(OBJDIR)%.o: src/%.c $(INCDIR)/minishell.h
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(LIBFT):
@$(MAKE) -C $(LIBFT_DIR)
clean:
rm -rf $(OBJDIR)
@$(MAKE) -C $(LIBFT_DIR) clean
fclean:
$(RM) $(NAME)
rm -rf $(OBJDIR)
@$(MAKE) -C $(LIBFT_DIR) fclean
re: fclean all
.PHONY: all clean fclean re