-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (71 loc) · 3.97 KB
/
Copy pathMakefile
File metadata and controls
87 lines (71 loc) · 3.97 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gade-oli <gade-oli@student.42madrid.c +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/03/29 18:07:54 by gade-oli #+# #+# #
# Updated: 2025/05/28 01:06:47 by gade-oli ### ########.fr #
# #
# **************************************************************************** #
#colors----------------------------------------------------------
RED = \033[1;31m
GREEN = \033[1;32m
BLUE = \033[1;34m
RESET = \033[0;0m
MAGENTA = \033[35m
BOLD = \033[1m
PINK = \033[38;5;206m
#variables-------------------------------------------------------
NAME = minishell
CC = cc
CFLAGS = -Wall -Werror -Wextra -g
LDFLAGS = -lreadline
LIBFT_DIR = ./libft
SRC_DIR = ./src
SRCS = $(SRC_DIR)/main/main.c $(SRC_DIR)/main/utils.c ${SRC_DIR}/main/memory_handler.c ${SRC_DIR}/main/execution.c \
$(SRC_DIR)/main/prompt.c $(SRC_DIR)/main/signals.c \
$(SRC_DIR)/parsing/cmdpath.c $(SRC_DIR)/parsing/parser_aux.c $(SRC_DIR)/parsing/parser.c \
${SRC_DIR}/parsing/parser_quote_handler.c ${SRC_DIR}/parsing/command_parser.c \
$(SRC_DIR)/parsing/get_next_token.c $(SRC_DIR)/parsing/get_next_token_aux.c \
${SRC_DIR}/parsing/command_parser_aux.c ${SRC_DIR}/parsing/get_redir_type.c ${SRC_DIR}/parsing/command_parser_errors.c \
${SRC_DIR}/builtins/builtin_handler.c ${SRC_DIR}/builtins/ft_cd.c ${SRC_DIR}/builtins/ft_echo.c ${SRC_DIR}/builtins/ft_env.c \
${SRC_DIR}/builtins/ft_exit.c ${SRC_DIR}/builtins/ft_export.c ${SRC_DIR}/builtins/ft_unset.c ${SRC_DIR}/builtins/ft_pwd.c \
${SRC_DIR}/env/env.c ${SRC_DIR}/env/env_utils.c \
${SRC_DIR}/redirs_pipes/process_handling.c ${SRC_DIR}/redirs_pipes/redirections.c ${SRC_DIR}/redirs_pipes/pipe_handling.c \
${SRC_DIR}/redirs_pipes/process_handling_aux.c ${SRC_DIR}/redirs_pipes/process_handling_aux2.c \
${SRC_DIR}/redirs_pipes/heredoc/heredoc.c ${SRC_DIR}/redirs_pipes/heredoc/heredoc_expand.c ${SRC_DIR}/redirs_pipes/heredoc/raw_delim.c \
${SRC_DIR}/redirs_pipes/heredoc/heredoc_expand_aux.c ${SRC_DIR}/redirs_pipes/heredoc/heredoc_aux.c \
${SRC_DIR}/redirs_pipes/heredoc/raw_delim_aux.c \
${SRC_DIR}/safe_funcs/safe_chdir.c ${SRC_DIR}/safe_funcs/safe_dup2.c ${SRC_DIR}/safe_funcs/safe_fork.c ${SRC_DIR}/safe_funcs/safe_pipe.c
OBJS = $(SRCS:$(SRC_DIR)/%.c=bin/%.o)
#recipes----------------------------------------------------------
all: $(NAME)
bin/%.o: src/%.c
@mkdir -p $(@D)
@printf "${MAGENTA}Compiling ${CYAN}$<${RESET}\n"
@$(CC) $(CFLAGS) -I$(SRC_DIR) -I$(LIBFT_DIR) -c $< -o $@
$(NAME): $(OBJS)
@printf "${BLUE}Linking binaries...${RESET}\n"
@make -s -C $(LIBFT_DIR) --no-print-directory
@$(CC) $(OBJS) -o $(NAME) -L$(LIBFT_DIR) -lft $(LDFLAGS)
@printf "${BOLD}${GREEN}${NAME} ${PINK}compiled successfully!${RESET}\n\n"
@printf "%b" "\
$(BOLD)$(PINK) __ $(GREEN) _____ _ $(PINK)__ \n\
$(PINK) _ / /$(GREEN) / ____| | | $(PINK)\\\\ \\\\ \n\
$(PINK) (_) | | $(GREEN)| (___ | |__ $(PINK)| |\n\
$(PINK) | | $(GREEN)\\\\___ \\\\ | '_ \\\\ $(PINK)| |\n\
$(PINK) _ | | $(GREEN)____) | | | | | $(PINK)| |\n\
$(PINK) (_) | | $(GREEN)|_____/ |_| |_| $(PINK)| |\n\
$(PINK) \\\\_\\\\ /_/ $(RESET)\n\n"
clean:
@rm -rf bin
@make -s -C $(LIBFT_DIR) clean --no-print-directory
@printf "${RED}Cleaned object files!${RESET}\n"
fclean: clean
@rm -f $(NAME)
@make -s -C $(LIBFT_DIR) fclean --no-print-directory
@printf "${BOLD}${RED}${NAME} deleted!${RESET}\n"
re: fclean all
.PHONY: all clean fclean re