-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 1.95 KB
/
Makefile
File metadata and controls
88 lines (68 loc) · 1.95 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
NAME = minishell
SOURCES_LIST = main.c \
signals.c \
preparse/preparse.c \
preparse/preparse1.c \
lexer/init_lexer.c \
lexer/lexer.c \
lexer/lexer1.c \
lexer/lexer2.c \
lexer/lexer_utils.c \
redir/pipes.c \
redir/pipes1.c \
redir/here_doc.c \
executor/var_handling.c \
executor/start_executing.c \
executor/builtins.c \
executor/execution.c \
executor/exec_utils.c \
executor/exec_utils2.c \
executor/ft_cd.c \
executor/ft_echo.c \
executor/ft_export.c \
executor/ft_unset.c \
executor/make_redirection.c \
executor/path_handler.c \
prompt.c \
CC = gcc
CFLAGS = -Werror -Wall -Wextra -g -I $(READLINE_INC)
LIBRARIES = -lft -lreadline\
-L$(LIBFT_DIRECTORY) \
#-fsanitize=address -fno-omit-frame-pointer
INCLUDES = -I$(LIBFT_HEADERS) -I$(HEADERS_DIR)
HEADERS_LIST = \
minishell.h\
lexer.h\
executor.h\
preparser.h\
prompt.h\
signal.h\
HEADERS_DIR = ./includes/
HEADERS = $(addprefix $(HEADERS_DIR), $(HEADERS_LIST))
LIBFT = $(LIBFT_DIRECTORY)libft.a
LIBFT_DIRECTORY = ./libft/
LIBFT_HEADERS = $(LIBFT_DIRECTORY)includes/
#READLINE_INC = /opt/homebrew/Cellar/readline/8.1.2/include
#READLINE_LIB = /opt/homebrew/Cellar/readline/8.1.2/lib
#READLINE_INC = /usr/local/opt/readline/include
#READLINE_LIB = /usr/local/opt/readline/lib
READLINE_INC = ~/.brew/opt/readline/include
READLINE_LIB = ~/.brew/opt/readline/lib
OBJECTS = $(patsubst %.c, %.o, $(SOURCES_LIST))
.PHONY: all clean fclean re install
all : $(NAME)
$(NAME): $(LIBFT) $(OBJECTS)
@$(CC) $(CFLAGS) $(LIBRARIES) $(INCLUDES) -I $(READLINE_INC) -L $(READLINE_LIB) $(OBJECTS) -o $(NAME)
%.o : %.c $(HEADERS) $(LIBFT) Makefile
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
$(LIBFT):
@$(MAKE) -sC $(LIBFT_DIRECTORY)
clean:
@$(MAKE) clean -sC $(LIBFT_DIRECTORY)
@rm -f $(OBJECTS)
fclean: clean
@rm -f $(NAME)
@rm -f $(LIBFT)
install:
sudo apt-get install libreadline-dev
re: fclean all