-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (111 loc) · 3.1 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: wonyang <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/28 21:52:18 by wonyang #+# #+# #
# Updated: 2023/01/17 11:59:06 by wonyang ### ########seoul.kr #
# #
# **************************************************************************** #
# define compile options
NAME = minishell
LIBFT = libft
LIBFT_HEADER = libft.h
LIBFT_LIB = $(LIBFT)/libft.a
RDLINE_DIR = $(shell brew --prefix readline)
HEADERS = -I$(LIBFT) \
-Iincludes \
-I$(RDLINE_DIR)/include/
LIBS = -lft -L$(LIBFT) \
-L$(RDLINE_DIR)/lib/ -lreadline
CFLAGS = -Wall -Werror -Wextra
# builtin source files
BTN_DIR = builtin/
_BTN_SRCS = cd.c \
echo.c \
pwd.c \
env.c \
unset.c \
exit.c \
export.c \
print_export.c
BTN_SRCS = $(addprefix $(BTN_DIR), $(_BTN_SRCS))
# ds_tree source files
TREE_DIR = ds_tree/
_TREE_SRCS = add.c \
delete.c \
init.c \
search.c
TREE_SRCS = $(addprefix $(TREE_DIR), $(_TREE_SRCS))
# ds_envp source files
ENVP_DIR = ds_envp/
_ENVP_SRCS = cast_arr.c \
cast_list.c \
delete.c \
init.c \
search.c \
set.c
ENVP_SRCS = $(addprefix $(ENVP_DIR), $(_ENVP_SRCS))
# parsing part source files
PARSING_DIR = parsing/
_PARSING_SRCS = token.c \
arr.c \
check_syntax.c \
check_tnode.c \
check_type.c \
make_node.c \
make_tree.c \
subst.c \
subst_env.c \
subst_env_first.c \
subst_env_lst.c \
subst_env_second.c \
subst_wildcard.c \
del_quote.c \
wildcard.c
PARSING_SRCS = $(addprefix $(PARSING_DIR), $(_PARSING_SRCS))
# execute part source files
EXE_DIR = execute/
_EXE_SRCS = argv.c \
path.c \
redirection.c \
util.c \
heredoc.c \
heredoc_util.c \
execute.c \
child.c \
preprocess.c \
builtin.c
EXE_SRCS = $(addprefix $(EXE_DIR), $(_EXE_SRCS))
# main source files
SRCS = main.c \
terminal.c \
parse.c \
signal.c
OBJS = $(BTN_SRCS:%.c=%.o) \
$(TREE_SRCS:%.c=%.o) \
$(ENVP_SRCS:%.c=%.o) \
$(PARSING_SRCS:%.c=%.o) \
$(EXE_SRCS:%.c=%.o) \
$(SRCS:%.c=%.o)
# define compile commands
$(NAME) : $(OBJS) $(LIBFT_LIB)
cc $(CFLAGS) -o $(NAME) $(OBJS) $(LIBS)
all : $(NAME)
$(LIBFT_LIB):
make bonus -C $(LIBFT)/
%.o : %.c
cc $(CFLAGS) -c $^ $(HEADERS) -o $@
clean :
rm -f $(OBJS)
make clean -C $(LIBFT)
fclean :
make clean
rm -f $(NAME)
make fclean -C $(LIBFT)
re :
make fclean
make all
.PHONY : all clean fclean re