-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (108 loc) · 3.74 KB
/
Copy pathMakefile
File metadata and controls
130 lines (108 loc) · 3.74 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
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: acaetano <acaetano@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/09/25 14:12:22 by acaetano #+# #+# #
# Updated: 2025/01/31 18:47:02 by elsikira ### ########.fr #
# #
# **************************************************************************** #
# **************************************************************************** #
# DEPENDENCIES #
# **************************************************************************** #
DPRINTF = $(LIBS_PATH)/ft_dprintf.a
LIBFT = $(LIBS_PATH)/libft.a
LIBS_PATH = ./build
HEADER_LIBFT = ./dependencies/libft/include/
HEADER_DPRINTF = ./dependencies/ft_dprintf/include/
# **************************************************************************** #
# CORE #
# **************************************************************************** #
NAME = minishell
ODIR = ./objects
SRC_PATH = ./sources
HEADER_PATH = ./includes
HEADERS = $(HEADER_PATH)/minishell.h \
$(HEADER_PATH)/typedef.h
CC = cc
CFLAGS = -Wall -Werror -Wextra
INC_FLAGS = -I $(HEADER_LIBFT) -I $(HEADER_DPRINTF) -I $(HEADER_PATH)
SOURCES = main.c \
builtin_utils.c \
execution.c \
signals.c \
signals_utils.c \
get_pwd.c \
ft_getenv.c \
tokenizer.c \
tokenizer_utils.c \
ft_free.c \
ft_free_2.c \
create_cmd.c \
create_cmd_utils.c \
create_redir.c \
missing_quotes.c \
missing_tokens.c \
epur_arg.c \
epur_arg_utils.c \
check_syntax.c \
check_syntax_utils.c \
expand_input.c \
expand_heredoc.c \
expand_utils.c \
expand_utils_2.c \
ft_heredoc.c \
ft_heredoc_utils.c \
environnement.c \
environnement_utils.c \
environnement_utils_2.c \
ft_echo.c \
ft_exit.c \
ft_exit_utils.c \
ft_env.c \
ft_pwd.c \
ft_cd.c \
ft_cd_utils.c \
ft_unset.c \
ft_export.c \
ft_export_actions.c \
ft_export_utils.c \
debug_utils.c \
debug_utils_2.c \
free_exit.c \
handle_redir.c \
path_exec_utils.c \
path_exec_error.c \
execution_utils.c \
handle_pipe_redirs.c \
OBJ = $(addprefix $(ODIR)/, $(SOURCES:.c=.o))
all: $(DPRINTF) $(LIBFT) $(ODIR) $(OBJ) $(NAME) $(HEADERS)
$(DPRINTF):
make -C ./dependencies/ft_dprintf
$(LIBFT):
make -C ./dependencies/libft
$(ODIR):
mkdir -p $(ODIR)
$(ODIR)/%.o: $(SRC_PATH)/%.c
mkdir -p $(@D)
$(CC) $(CFLAGS) $(INC_FLAGS) -c $< -o $@
$(NAME): $(ODIR) $(OBJ) $(HEADERS)
$(CC) $(CFLAGS) $(OBJ) -L $(LIBS_PATH) -l:ft_dprintf.a -lft -lreadline -o $(NAME)
clean:
rm -rf heredoc/*
rm -rf $(ODIR)
rm -rf $(LIBS_PATH)
make clean -C ./dependencies/libft
make clean -C ./dependencies/ft_dprintf
fclean: clean
rm -rf $(NAME)
make fclean -C ./dependencies/libft
make fclean -C ./dependencies/ft_dprintf
run: all
clear && valgrind --track-fds=yes --suppressions=val_suppress.txt --leak-check=full --show-leak-kinds=all ./minishell
## CAREFUL CHANGE THE RULE BACK TO NORMAL BEFORE PUSH ##
re: fclean all
clear
.PHONY: all re clean fclean