-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (73 loc) · 2.16 KB
/
Makefile
File metadata and controls
87 lines (73 loc) · 2.16 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
NAME := minishell
LIBFT := libft.a
BREW := $(shell brew --prefix)
INCS := -I $(BREW)/opt/readline/include -I libft -I srcs -I srcs/tokenizer -I srcs/env_var -I srcs/syntax_checker -I srcs/tree_constructor -I srcs/prompt -I srcs/executor -I srcs/builtin -I srcs/signals
LINK := -L $(BREW)/opt/readline/lib -lreadline
FLAGS := -Wall -Werror -Wextra $(LINK) $(INCS) -Ofast
DEBUG := -Wno-error -g -fsanitize=address,undefined -O0
SRCS := $(addprefix srcs/,\
prompt/prompt.c \
tokenizer/states/command.c \
tokenizer/states/default.c \
tokenizer/states/env_var.c \
tokenizer/states/raw_string.c \
tokenizer/states/string.c \
tokenizer/linked_list/getter.c \
tokenizer/linked_list/setter.c \
tokenizer/tokenizer.c \
env_var/env_var.c \
env_var/path.c \
env_var/linked_list/setter.c \
env_var/linked_list/getter.c \
tokenizer/post_process/evaluate_env_vars.c \
tokenizer/post_process/concat_strings.c \
tokenizer/post_process/delete_spaces.c \
tokenizer/post_process/heredoc.c \
syntax_checker/syntax_checker.c \
tree_constructor/tree_constructor.c \
executor/executor.c \
executor/redirection.c \
executor/argv_envp.c \
executor/path.c \
builtin/builtin.c \
builtin/utils.c \
builtin/echo_cd_pwd.c \
builtin/unset_env_exit.c \
builtin/export.c \
signals/signals.c \
)
TESTS_SRCS := $(addprefix tests/,\
munit/munit.c \
test.c \
test_tokenizer.c \
)
.PHONY: all bonus clean fclean re
all: $(LIBFT) $(NAME)
$(LIBFT):
@make -C libft
@mv libft/$(LIBFT) .
$(NAME):
@echo "Compiling $(NAME)..."
@cc $(FLAGS) $(LIBFT) $(SRCS) srcs/minishell.c -o $(NAME)
clean:
fclean: clean
@rm -f $(NAME)
re: fclean all
debug: fclean
@echo "Compiling debug..."
@cc $(FLAGS) $(DEBUG) $(LIBFT) $(SRCS) srcs/minishell.c -o $(NAME)
@./$(NAME)
debug-leaks:
@echo "Compiling debug using leaks..."
@cc $(FLAGS) $(DEBUG) -fno-sanitize=all $(LIBFT) $(SRCS) srcs/minishell.c -o $(NAME)
@./$(NAME)
test: re
@echo "Compiling tests..."
@cc $(FLAGS) $(DEBUG) $(LIBFT) $(SRCS) $(TESTS_SRCS) -o test
@./test
@rm -f test
test-leaks:
@echo "Compiling tests using leaks..."
@cc $(FLAGS) $(DEBUG) -fno-sanitize=all $(LIBFT) $(SRCS) $(TESTS_SRCS) -o test
@leaks -q --atExit -- ./test
@rm -f test