-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
98 lines (83 loc) · 2.57 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
91
92
93
94
95
96
97
98
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: bsomers <[email protected]> +#+ #
# +#+ #
# Created: 2022/07/19 13:48:23 by jaberkro #+# #+# #
# Updated: 2022/08/23 11:14:21 by bsomers ######## odam.nl #
# #
# **************************************************************************** #
NAME = minishell
FLAGS = -Wall -Wextra -Werror
LDFLAGS = -L /Users/$(USER)/.brew/opt/readline/lib -lreadline
INC = -I ./libft -I ./include -I/Users/$(USER)/.brew/opt/readline/include
LIBFT_DIR = libft/
LIBFT = libft/libft.a
SRC_DIR = src
BUILD_DIR = obj
SRC = global/get_env.c \
global/init.c \
global/set_env.c \
global/unset_env.c \
executer/executer.c \
executer/fd_dup2.c \
protected.c \
main.c \
error.c \
path.c \
signals.c \
parse/parse.c \
parse/dollar.c \
parse/get_next_line.c \
parse/split_pipes.c \
parse/heredoc.c \
parse/heredoc_read.c \
parse/utils.c \
parse/utils_checks.c \
parse/clean_and_free.c \
parse/init_and_finish.c \
parse/quotes.c \
parse/write_parts.c \
parse/write_parts_utils.c \
parse/set_terminal.c \
builtin/builtin.c \
builtin/cd.c \
builtin/echo.c \
builtin/env.c \
builtin/exit.c \
builtin/export.c \
builtin/pwd.c \
builtin/unset.c
OBJ := $(addprefix $(BUILD_DIR)/, $(SRC:.c=.o))
SRC := $(addprefix $(SRC_DIR)/, $(SRC))
# COLORS
PINK = \x1b[35m
BLUE = \x1b[34m
YELLOW = \x1b[33m
GREEN = \x1b[32m
RED = \x1b[31m
CYAN = \x1b[36m
RESET = \x1b[0m
all: $(NAME)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
mkdir -p $(dir $@)
CC $(FLAGS) $(INC) -c $^ -o $@
$(NAME): $(LIBFT) $(OBJ)
cp $(LIBFT) ./$(NAME)
CC $(OBJ) $(LDFLAGS) $(LIBFT) $(INC) -o $(NAME)
@echo "DONE COMPILING $(PINK)MI$(RED)NI$(YELLOW)SH$(GREEN)EL$(CYAN)L!$(RESET)"
$(LIBFT):
$(MAKE) bonus -C $(LIBFT_DIR)
run: $(NAME)
@./$(NAME)
clean:
rm -rf $(BUILD_DIR)
$(MAKE) fclean -C $(LIBFT_DIR)
@echo "DONE CLEANING $(PINK)MI$(RED)NI$(YELLOW)SH$(GREEN)EL$(CYAN)L!$(RESET)"
fclean: clean
rm -f $(NAME)
@echo "DONE FANCY CLEANING $(PINK)MI$(RED)NI$(YELLOW)SH$(GREEN)EL$(CYAN)L!$(RESET)"
re: fclean all
.PHONY: all clean fclean re