-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (72 loc) · 2.62 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: mrichard <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/12/05 10:49:40 by riolivei #+# #+# #
# Updated: 2023/08/09 16:06:10 by mrichard ### ########.fr #
# #
# **************************************************************************** #
CC = cc
NAME = minishell
CFLAGS = -Wall -Wextra -Werror -g -I./includes #-fsanitize=address
RM = rm -rf
LIBFT = ./libft/libft.a
VPATH = src src/parser src/utils src/parser/token src/parser/commands src/parser/env_list\
src/bins src/builtins src/builtins/echo src/builtins/export src/parser/env src/pipe\
src/redir
UTILS = utils utils2 utils3
TOKEN = create_token_list def_token_types token_utils
COMMANDS = create_commands_list create_commands_list_utils
PARSER = parser parser_utils parser_utils2 parser_utils3
ENV = create_env_list
BINS = check_bins check_bins_utils signal_handler signal_handler2
BUILTINS = check_builtins env cd unset exit
ECHO = echo
EXPORT = export
PIPE = pipe
REDIR = redir
MAIN = main free_structs
SRCS = $(addsuffix .c, $(UTILS))\
$(addsuffix .c, $(TOKEN))\
$(addsuffix .c, $(COMMANDS))\
$(addsuffix .c, $(PARSER))\
$(addsuffix .c, $(ENV))\
$(addsuffix .c, $(BINS))\
$(addsuffix .c, $(BUILTINS))\
$(addsuffix .c, $(ECHO))\
$(addsuffix .c, $(EXPORT))\
$(addsuffix .c, $(PIPE))\
$(addsuffix .c, $(REDIR))\
$(addsuffix .c, $(MAIN))\
OBJ_DIR = obj
OBJS = $(SRCS:%.c=$(OBJ_DIR)/%.o)
all: $(NAME)
clear
@printf "\n"
@echo $(G)" _ _ _ _ _ "$(X)
@echo $(G)" _____|_|___|_|___| |_ ___| | |"$(X)
@echo $(G)"| | | | |_ -| | -_| | |"$(X)
@echo $(G)"|_|_|_|_|_|_|_|___|_|_|___|_|_|"$(X)
@printf "\n\n"
$(NAME): $(OBJ_DIR) $(OBJS)
$(MAKE) --no-print-directory -C ./libft
$(CC) $(CFLAGS) $(OBJS) -lreadline -o $(NAME) $(LIBFT)
$(OBJ_DIR):
mkdir -p obj
$(OBJ_DIR)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(LINK)
clean:
$(MAKE) clean -C ./libft
$(RM) $(OBJ_DIR)
$(RM) $(OBJS)
fclean: clean
$(MAKE) fclean -C ./libft
$(RM) $(NAME)
re: fclean all
run: re
./minishell
PHONY: all clean fclean re run
.SILENT: