-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·90 lines (69 loc) · 2.67 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: abouhaga <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/19 12:13:55 by abouhaga #+# #+# #
# Updated: 2022/11/01 22:05:47 by abouhaga ### ########.fr #
# #
# **************************************************************************** #
#Color:
RED = \033[0;31m
DEFAULT = \033[0;39m
PINK = \033[1;35m
BLUE = \033[1;34m
#vars
CC = gcc
CFLAGS = -Wall -Wextra -Werror
NAME = minishell
LIBFT = libft/libft.a
OBJ_DIR = obj
BIN_DIR = bin
BTIN_DIR = builtin_src
NAME = $(BIN_DIR)/$(BIN)
BIN = minishell
SRC_DIR = code
RDLINE = -lreadline -lncurses
RDLINE_FLAG = -L ~/.brew/opt/readline/lib
RDLINE_PATH = -I ~/.brew/opt/readline/include
#cmd
PRINTF = printf
FT_FPRINTF = ft_fprintf/libftfprintf.a
#src&&obj
SRC = ft_shell.c \
ft_tokenize.c \
ft_outfiles.c ft_lexer.c ft_lexer_utils.c ft_parser.c ft_parser_utils.c\
ft_last_io.c ft_infiles.c ft_heredoc.c ft_get_path.c ft_fill_args.c \
ft_expand.c ft_errors.c ft_free.c\
exe_data.c err_handling.c builtin_src/builtin_utils.c \
builtin_src/cd_exe.c builtin_src/echo_exe.c builtin_src/env_exe.c \
builtin_src/export_exe.c builtin_src/exit_exe.c builtin_src/pwd_exe.c \
builtin_src/unset_exe.c exe_utils.c ft_exec.c exe_option.c
OBJS = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
all : $(NAME)
$(NAME) : $(BIN_DIR) $(LIBFT) $(OBJS)
@$(CC) $(CFLAGS) $(OBJS) $(LIBFT) $(FT_FPRINTF) $(RDLINE) $(RDLINE_FLAG) $(RDLINE_PATH) -I inc -o $(NAME)
@$(PRINTF) "\r%100s\r$(BLUE)$(NAME) is up to date!$(DEFAULT)\n"
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.c
@$(CC) $(CFLAGS) $(RDLINE_PATH) -I inc -c $< -o $@
@$(PRINTF) "\rCompiling $(BLUE)$<$(DEFAULT)..."
$(LIBFT):
@make -C libft
@make -C ft_fprintf
$(BIN_DIR) :
@mkdir -p $(OBJ_DIR)
@mkdir -p $(BIN_DIR)
@mkdir -p $(OBJ_DIR)/$(BTIN_DIR)
clean :
@make clean -C libft
@make clean -C ft_fprintf
fclean : clean
@rm -rf libft/libft.a
@rm -rf ft_fprintf/libftfprintf.a
@rm -rf $(BIN_DIR)
@rm -rf $(OBJ_DIR)
@$(PRINTF) "$(RED) $(NAME) removed successfully. $(DEFAULT)\n"
re : fclean all
.PHONY : all clean fclean