-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (53 loc) · 2.41 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hyeongki <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/10/03 19:45:18 by hyeongki #+# #+# #
# Updated: 2022/10/27 15:23:29 by hyeongki ### ########.fr #
# #
# **************************************************************************** #
CC := cc
CFLAGS := -Wall -Wextra -Werror
SRCS_PATH := ./source/
SRCS_NAME := main.c ft_echo.c ft_pwd.c ft_cd.c ft_export.c ft_unset.c ft_env.c ft_exit.c built_in.c env_01.c env_02.c env_03.c error.c util.c signal.c execute.c parser.c scanner.c scanner_utils.c token_utils.c syntax.c expander.c expand_env.c split_field.c expand_path.c remove_quote.c redir_01.c redir_02.c redir_03.c execute_pipe.c execute_utils_01.c tree_utils_01.c tree_utils_02.c execute_utils_02.c process.c parse_cmd.c parse_list.c parse_pipeline.c syntax_check_lr.c syntax_check_node.c expand_path_utils.c expand_env_utils.c
SRCS := $(addprefix $(SRCS_PATH), $(SRCS_NAME))
OBJS := $(SRCS:.c=.o)
RM := rm -f
AR := ar rcs
NAME := minishell
READLINE_LIB := -lreadline -L$(shell brew --prefix readline)/lib
READLINE_INC := -I$(shell brew --prefix readline)/include
READLINE_PATH := ./readline
LIBFT_PATH := ./libft/
LIBFT := libft.a
LIBFT_FLAG := $(LIBFT_PATH)$(LIBFT)
# Colors
GREEN := \x1b[32m
RED := \x1b[31m
RESET := \x1b[0m
%.o : %.c
@$(CC) $(CFLAGS) -c $< $(READLINE_INC) -o $@
@echo "$(GREEN).$(RESET)\c"
.PHONY: all
all : $(NAME)
$(NAME) : $(OBJS)
@make -C $(LIBFT_PATH) bonus
@$(CC) $(CFLAGS) $^ $(READLINE_LIB) $(LIBFT_FLAG) -o $@
@echo "$@: $(GREEN)$@ was created$(RESET)"
.PHONY: clean
clean :
@make clean -C $(LIBFT_PATH)
@$(RM) $(OBJS)
@echo "$(NAME): $(RED)object files were deleted$(RESET)"
.PHONY: fclean
fclean : clean
@$(RM) $(LIBFT_PATH)$(LIBFT)
@$(RM) $(NAME)
@echo "$(NAME): $(RED)$(NAME) was deleted$(RESET)"
.PHONY: re
re :
$(MAKE) -j6 fclean
$(MAKE) -j6 all