-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (133 loc) · 4.4 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
141
142
143
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lbopp <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/02/02 11:07:10 by lbopp #+# #+# #
# Updated: 2017/09/25 11:45:25 by lbopp ### ########.fr #
# #
# **************************************************************************** #
NAME = 21sh
CFLAGS = -Wall -Werror -Wextra -g
LIBFT = libft/
CLANG = gcc
LEXER_SRC = add_to_current_token.c\
create_new_token.c\
is_digit_token.c\
is_piece_of_bigop.c\
lexer.c\
management_of_op.c\
state_management.c\
treatment_newline.c\
treatment_of_quote.c\
treatment_of_word.c\
free_tok_lst.c
PARSER_SRC = list_to_array.c\
parser.c
EXPAND_SRC = main_expand.c
EXECUTION_SRC = execution.c
BUILTINS_SRC = ft_cd.c\
ft_echo.c\
ft_env.c\
ft_exit.c\
ft_setenv.c\
ft_unsetenv.c\
list_to_tab.c\
tab_to_list.c
LINE_EDITING_SRC = edit_line.c
HISTORY_SRC = history.c
SRC_NAME = main.c
SRC_TEST = src/lexer/lexer.c\
src/lexer/add_to_current_token.c\
src/lexer/create_new_token.c\
src/lexer/is_digit_token.c\
src/lexer/is_piece_of_bigop.c\
src/lexer/management_of_op.c\
src/lexer/state_management.c\
src/lexer/treatment_of_quote.c\
src/lexer/treatment_of_word.c\
src/lexer/treatment_newline.c\
src/parser/parser_AST.c\
lsh_test/launch_tests.c\
lsh_test/test_lexer1.c\
lsh_test/test_lexer2.c\
lsh_test/test_lexer3.c\
lsh_test/test_lexer4.c\
lsh_test/test_lexer5.c\
lsh_test/test_lexer6.c\
lsh_test/test_lexer7.c\
lsh_test/test_lexer8.c\
lsh_test/test_lexer9.c\
lsh_test/test_lexer10.c\
lsh_test/test_lexer11.c\
lsh_test/test_lexer12.c\
lsh_test/test_lexer13.c\
lsh_test/test_lexer14.c\
lsh_test/test_lexer15.c\
lsh_test/test_lexer16.c\
lsh_test/test_parser1.c\
lsh_test/test_parser2.c\
lsh_test/test_parser3.c\
lsh_test/test_parser4.c\
lsh_test/test_parser5.c\
lsh_test/test_parser6.c\
lsh_test/test_parser7.c\
lsh_test/test_parser8.c\
lsh_test/test_parser9.c\
lsh_test/test_parser10.c\
lsh_test/test_parser11.c\
lsh_test/test_parser12.c\
lsh_test/test_parser13.c\
lsh_test/test_parser14.c\
lsh_test/test_parser15.c\
lsh_test/test_parser16.c
SRC_PATH = src
LEXER_PATH = src/lexer
PARSER_PATH = src/parser
EXPAND_PATH = src/expand
EXECUTION_PATH = src/execution
BUILTINS_PATH = src/builtins
LINE_EDITING_PATH = src/line_editing
HISTORY_PATH = src/line_editing/history
SRC = $(addprefix $(SRC_PATH)/,$(SRC_NAME))
LEXER = $(addprefix $(LEXER_PATH)/,$(LEXER_SRC))
PARSER = $(addprefix $(PARSER_PATH)/,$(PARSER_SRC))
EXPAND = $(addprefix $(EXPAND_PATH)/,$(EXPAND_SRC))
EXECUTION = $(addprefix $(EXECUTION_PATH)/,$(EXECUTION_SRC))
BUILTINS = $(addprefix $(BUILTINS_PATH)/,$(BUILTINS_SRC))
LINE_EDITING = $(addprefix $(LINE_EDITING_PATH)/,$(LINE_EDITING_SRC))
HISTORY = $(addprefix $(HISTORY_PATH)/,$(HISTORY_SRC))
OBJ = $(SRC:.c=.o)\
$(LEXER:.c=.o)\
$(PARSER:.c=.o)\
$(EXPAND:.c=.o)\
$(EXECUTION:.c=.o)\
$(BUILTINS:.c=.o)\
$(LINE_EDITING:.c=.o)\
$(HISTORY:.c=.o)
OBJ_TEST = $(SRC_TEST:.c=.o)
RM = rm -f
.PHONY: all, clean, fclean, re
all: $(NAME)
$(NAME): $(OBJ)
@make -C libft
@echo "\033[32m=== Compilation of libft\t[DONE]\033[0m"
$(CLANG) $(CFLAGS) -o $(NAME) $(OBJ) -I includes -I libft/includes -lft -L libft -ltermcap
@echo "\033[32m=== Compilation\t[DONE]\033[0m"
%.o: %.c
@echo "\033[36m=Compilation of $^"
$(CLANG) $(CFLAGS) -c $^ -o $@ -I includes -I libft/includes
test:
@make -C libft
@echo "\033[32m=== Compilation of libft\t[DONE]\033[0m"
@$(CLANG) $(CFLAGS) -o test_lsh $(SRC_TEST) -I includes -I libft/includes -lft -L libft
@echo "\033[32m=== Compilation\t[DONE]\033[0m" && ./test_lsh
clean:
@make -C libft clean
@$(RM) $(OBJ)
fclean: clean
@make -C libft fclean
@$(RM) $(NAME)
re: fclean all