-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
88 lines (74 loc) · 1.74 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
NAME = minishell
PATH_SRC = ./sources/
PATH_SRCS = ./sources/builtins/
PATH_SORCS = ./sources/parser/
PATH_OBJ = ./objects/
SRC = prompt.c \
main.c \
signal.c \
env_utils.c \
executor.c \
pathing.c \
clear.c \
recreate_envp.c \
join.c \
env.c \
export.c \
export_utils.c \
unset.c \
echo.c \
pwd.c \
cd.c \
utils.c \
exit.c \
init.c \
error.c \
ft_atoi_long.c \
expand_variables.c \
tokenize.c \
count_tokens.c \
count_tokens_utils.c \
allocate_tokens.c \
allocate_tokens_utils.c \
fill_tokens.c \
fill_tokens_utils.c \
syntax.c \
syntax_comp.c \
command.c \
command_init.c \
is_builtin.c \
split_cmds.c \
heredoc.c \
open_file.c \
is_token.c \
select_inout.c
OBJ = ${SRC:%.c=$(PATH_OBJ)%.o}
INCLUDE = -I ./includes/
LIBFT = ./libft/libft.a
FLAGS = -Wall -Wextra -Werror -g3
LINKERS = -lrt -lm -lreadline
all: $(NAME)
$(NAME): $(LIBFT) $(OBJ)
@cc $(FLAGS) $(OBJ) $(LIBFT) $(LINKERS) -o $(NAME)
$(LIBFT):
@make all --no-print-directory -C ./libft/
$(PATH_OBJ)%.o: $(PATH_SRC)%.c
@mkdir -p $(PATH_OBJ)
cc $(FLAGS) $(INCLUDE) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Objects creation done!\033[0m"
$(PATH_OBJ)%.o: $(PATH_SRCS)%.c
cc $(FLAGS) $(INCLUDE) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Objects creation done!\033[0m"
$(PATH_OBJ)%.o: $(PATH_SORCS)%.c
cc $(FLAGS) $(INCLUDE) -c $< -o $@
@echo "\033[1;92m[SUCCESS] Objects creation done!\033[0m"
clean:
@make clean --no-print-directory -C ./libft/
@rm -rf $(PATH_OBJ)
@echo "\33[1;93m[SUCCESS] Objects removal done!\33[0m"
fclean: clean
@rm -f $(NAME)
@make fclean --no-print-directory -C ./libft/
@echo "\033[1;93m[SUCCESS] Removal done!\33[0m"
re: fclean all
.PHONY: all clean fclean re