-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (56 loc) · 2.13 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: anacaro3 <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/09/12 20:24:48 by gacalaza #+# #+# #
# Updated: 2023/09/24 14:19:51 by anacaro3 ### ########.fr #
# #
# **************************************************************************** #
# ==== Name of the program =====
NAME = minishell
# ======= Sources and objs ========
SRCS = minishell.c prompt.c ./builtins/echo.c ./builtins/builtins_list.c ./builtins/builtins_utils.c
OBJS = $(SRCS_MAN:.c=.o)
# ====== Folders and Paths ========
LIBFT_DIR = ./libft/
INCL_DIR = ./includes/
MANDATORY = ./src/
LIBFT = $(addprefix $(LIBFT_DIR), libft.a)
HEADERM = $(addprefix $(INCL_DIR), minishell.h)
HEADERB = $(addprefix $(INCL_DIR), minishell_bonus.h)
SRCS_MAN = $(addprefix $(MANDATORY), $(SRCS))
# ====== Flags ========
FLAGS = -Wall -Wextra -Werror -g3
LIBS = -lreadline
VALGRIND = valgrind \
--leak-check=full \
--show-leak-kinds=all \
--quiet \
--suppressions=readline.supp \
--keep-debuginfo=yes \
--trace-children=yes
# =================== Rules ==========================
# # Compiling Mandatory or Bonus Objs
%.o: %.c
$(CC) $(FLAGS) -I $(INCL_DIR) -c $< -o $@
all: comp_libft $(NAME)
$(OBJS): $(HEADERM)
$(NAME): $(OBJS)
cc $(FLAGS) $^ $(LIBFT) $(LIBS) -o $@
comp_libft:
@make -C $(LIBFT_DIR) --no-print-directory
run: all
./$(NAME)
valgrind: all
$(VALGRIND) ./$(NAME)
re: fclean all
rebonus: fclean bonus
clean:
@rm -rf $(OBJS)
@make -C $(LIBFT_DIR) clean
fclean: clean
@rm -rf $(NAME)
@make -C $(LIBFT_DIR) fclean