Open yootaki opened 2 years ago
1 NAME := minishell 2 CC := gcc 3 INCLUDE := -I./includes 4 LIBFT_DIR:= ./library/libft 5 LIBFT := ./library/libft/libft.a 6 CFLAGS := -Wall -Wextra -Werror -MMD -MP 7 8 VPATH := srcs:srcs/builtin_cmd/:srcs/execution/:srcs/expansion/:srcs/lexer/:srcs/parse/:srcs/utils/:library/get_next_line/ 9 10 BUILTIN_DIR := srcs/builtin_cmd/ 11 EXECUTION_DIR := srcs/execution/ 12 EXPANSION_DIR := srcs/expansion/ 13 LEXER_DIR := srcs/lexer/ 14 PARSER_DIR := srcs/parse/ 15 UTILS_DIR := srcs/utils/ 16 GNL_DIR := library/get_next_line/ 17 18 BUILTIN := cd.c echo.c env.c exit.c export.c export_utils.c pwd.c unset.c 19 EXECUTION := create_cmd_array.c exe_free_function.c execution_utils1.c execute_command.c execution_free.c execution.c get_path.c no_ built_cmd.c process_function.c search_cmd.c 20 EXPANSION := expansion.c delete_quote.c separate_str.c heardoc_and_redirect.c heardoc.c redirect.c expansion_utils1.c expansion_util s2.c pipe_next_cmd_check.c pipe_next_cmd_check_utils.c 21 LEXER := lexer.c is_function.c lexer_utils.c advance_space.c 22 PARSER := parse.c parse_utils.c parse_lst_function.c create_lst.c 23 UTILS := envlst_func.c get_envp.c signal_main.c signal_heardoc.c wrapper_1.c wrapper_2.c wrapper_3.c ft_atol.c malloc_and_strlcp y.c init.c free_func.c lst_func.c 24 GNL := get_next_line.c get_next_line_utils.c 25 26 #SRCS_DIR := srcs/ $(BUILTIN_DIR) $(EXECUTION_DIR) $(EXPANSION_DIR) $(LEXER_DIR) $(PARSER_DIR) $(UTILS_DIR) $(GNL_DIR) 27 SRCS_DIR := srcs 28 29 SRCS := main.c $(BILTIN) $(EXECUTION) $(EXPANSION) $(LEXER) $(PARSER) $(UTILS) $(GNL) 30 # $(addprefix $(BUILTIN_DIR), $(BUILTIN)) \ 31 $(addprefix $(EXECUTION_DIR), $(EXECUTION)) \ 32 $(addprefix $(EXPANSION_DIR), $(EXPANSION)) \ 33 $(addprefix $(LEXER_DIR), $(LEXER)) \ 34 $(addprefix $(PARSER_DIR), $(PARSER)) \ 35 $(addprefix $(UTILS_DIR), $(UTILS)) \ 36 $(addprefix $(GNL_DIR), $(GNL)) \ 37 38 OBJS_DIR:= ./objs 39 OBJS := $(addprefix $(OBJS_DIR)/, $(notdir $(SRCS:.c=.o))) 40 DEPS := $(OBJS:.o=.d) 41 42 43 $(NAME): $(OBJS) $(LIBFT) 44 $(CC) -o $@ -I $(shell brew --prefix readline)/include $(LIBFT) $^ 45 46 $(LIBFT): 47 @$(MAKE) bonus -C $(LIBFT_DIR) 48 49 $(OBJS_DIR)/%.o: $(SRCS_DIR)/%.c 50 mkdir -p $(OBJS_DIR) 51 $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< 52 53 all: $(NAME) 54 55 clean: 56 $(MAKE) -C $(LIBFT_DIR) clean 57 rm -rf objs 58 59 fclean: clean 60 $(MAKE) -C $(LIBFT_DIR) fclean 61 $(RM) $(NAME) 62 63 re: fclean all 64 65 debug: CFLAGS += -g3 -fsanitize=address 66 debug: re 67 68 check: 69 @cd testcase && bash check.sh 70 71 .PHONY: all clean fclean re debug