-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (53 loc) · 2.27 KB
/
Makefile
File metadata and controls
70 lines (53 loc) · 2.27 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
CC = cc -g
FLAGS = -Wall -Wextra -Werror
EXE_F = execute_cmd/
PARSE_F = parse/
TOK_F = tokens/
EVAL_F = evaluate/
ENV_F = env/
OBJ_F = obj/
LIBFT = libft.a
NAME = minishell
LIBS = -lreadline # we should add this libarary to link with ex file(minishell)
VALGRIND=1 valgrind --suppressions=readline.supp --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file="leaks.txt" ./minishell
SRC = main.c main_exe.c parse_main.c tokenize.c tokenize_2.c parse_cmd_line.c parse_compound.c\
parse_pipe_cmd.c token_utils.c fill_tokens.c simple_cmd.c\
parse_redirection.c create_node.c evals_1.c evals_2.c evals_3.c command.c executable.c utils.c\
exe_pipe.c exe_simple_cmd.c exe_simple_cmd_2.c init_env.c update_env.c\
build_envp.c add_modify_env.c del_env.c exe_ast.c exe_built_in.c\
ft_echo.c exe_redirections.c exe_redirections_2.c exe_redirections_3.c exe_here_doc.c exe_here_doc_2.c\
exe_redir_in.c her_doc_token.c utils_fill_tokens.c parse_doc.c parse_doc2.c exe_subshell.c parse_subshell.c \
utils2.c utils3.c parse_utils.c exe_built_in_2.c exe_built_in_3.c free_funcs.c fill_tokens_utils.c convert_env_tokens.c\
utils_env_tokens.c helper_here_doc_token.c open_new_promt.c n_pmt_utils.c
OBJ = $(SRC:.c=.o)
OBJ_P = $(addprefix $(OBJ_F), $(OBJ))
all : $(NAME)
$(NAME) : $(OBJ_P) # create executeing file by its object dependencies
$(CC) $(FLAGS) -o $(NAME) $(OBJ_P) $(LIBS) $(LIBFT)
@echo "created successfully!"
$(OBJ_F)%.o:$(EXE_F)%.c | $(OBJ_F) #create object bit its dependencies
$(CC) $(FLAGS) -c $< -o $@ -I.
@echo "compiling: $<"
$(OBJ_F)%.o:$(TOK_F)%.c | $(OBJ_F) #create object bit its dependencies
$(CC) $(FLAGS) -c $< -o $@ -I.
@echo "compiling: $<"
$(OBJ_F)%.o:$(EVAL_F)%.c | $(OBJ_F) #create object bit its dependencies
$(CC) $(FLAGS) -c $< -o $@ -I.
@echo "compiling: $<"
$(OBJ_F)%.o:$(PARSE_F)%.c | $(OBJ_F) #create object bit its dependencies
$(CC) $(FLAGS) -c $< -o $@ -I.
@echo "compiling: $<"
$(OBJ_F)%.o:$(ENV_F)%.c | $(OBJ_F) #create object bit its dependencies
$(CC) $(FLAGS) -c $< -o $@ -I.
@echo "compiling: $<"
$(OBJ_F):
@mkdir -p $(OBJ_F)
leaks: $(NAME)
@$(VALGRIND) ./$(NAME)
clean:
rm -f $(OBJ_P)
fclean: clean
rm -f $(NAME)
@echo "removed objs files successfuly"
re : fclean all
.PHONY: all clean fclean re