-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (76 loc) · 1.96 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
LIBFT_PATH = libft
LIBFT = $(LIBFT_PATH)/libft.a
SOURCES = minishell.c \
main.c \
ms_builtin_echo.c \
ms_builtin_pwd.c \
ms_builtin_export.c \
ms_builtin_unset.c \
ms_builtin_env.c \
ms_builtin_cd.c \
ms_builtin_exit.c \
ms_execute.c \
ms_execute_system.c \
ms_execute_builtin.c \
ms_execute_dup_utils.c \
ms_execute_dup.c \
ms_init_list.c \
ms_init_data.c \
ms_init_patterns.c \
ms_init_flags.c \
ms_reinit.c \
ms_parse.c \
ms_parse_patterns.c \
ms_parse_presplit.c \
ms_parse_flags.c \
ms_prompt.c \
ms_prompt_validate.c \
ms_prompt_validate_files.c \
ms_prompt_buf.c \
ms_prompt_colors.c \
ms_prompt_utils.c \
ms_prompt_token.c \
ms_signals.c \
ms_translate.c \
ms_translate_trim.c \
ms_translate_star.c \
ms_translate_home.c \
ms_utils.c \
ms_utils_env.c \
ms_utils_print.c \
ms_error.c \
SOURCES_DIR = src
OBJ_DIR = obj
HEADER = minishell.h
OBJECTS = $(SOURCES:%.c=$(OBJ_DIR)/%.o)
NAME = minishell
CC = gcc
RM = rm -rf
CFLAGS = -Wall -Wextra -Werror -g3
INCLUDES = -I./libft -I./
LDFLAGS = -lreadline
VPATH = src src/builtins src/execute src/init src/parse \
src/prompt src/signals src/translate src/utils \
$(OBJ_DIR)/%.o: %.c $(HEADER)
$(CC) $(CFLAGS) -c $< -o $@ $(INCLUDES)
all: $(NAME)
$(NAME): $(LIBFT) $(OBJ_DIR) $(OBJECTS) $(HEADER)
$(CC) $(CFLAGS) $(OBJECTS) $(LIBFT) $(LDFLAGS) -o $(NAME)
$(LIBFT):
$(MAKE) -C $(LIBFT_PATH)
$(OBJ_DIR):
mkdir -p obj
test:
echo $(VPATH)
run: all
./$(NAME)
runv: all
valgrind --leak-check=full -s --trace-children=yes --error-exitcode=1 --track-origins=yes ./$(NAME)
clean:
$(MAKE) -C $(LIBFT_PATH) clean
$(RM) $(OBJ_DIR)
fclean: clean
$(MAKE) -C $(LIBFT_PATH) fclean
$(RM) $(NAME) $(NAME_BONUS)
re: fclean all
.PHONY: all clean fclean re libft bonus