-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
executable file
·130 lines (103 loc) · 3.32 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hthomas <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/15 20:30:49 by hthomas #+# #+# #
# Updated: 2021/05/03 11:42:36 by hthomas ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
CC = gcc
CFLAGS += -Wall -Werror -Wextra
LDFLAGS += #-g3 -fsanitize=address
#-----------------Main-----------------#
SRCS += srcs/main.c
#---------------Commands---------------#
SRCS += srcs/commands/ft_cd.c \
srcs/commands/ft_cd2.c \
srcs/commands/ft_echo.c \
srcs/commands/ft_env.c \
srcs/commands/ft_exit.c \
srcs/commands/ft_export.c \
srcs/commands/ft_export2.c \
srcs/commands/ft_pwd.c \
srcs/commands/ft_unset.c
#----------------Parse-----------------#
SRCS += srcs/parse/parse.c \
srcs/parse/parse_quotes.c \
srcs/parse/parse_utils.c
#----------------List------------------#
SRCS += srcs/lists/list_cmd1.c \
srcs/lists/list_cmd2.c \
srcs/lists/list_line1.c \
srcs/lists/list_line2.c
#----------------Utils-----------------#
SRCS += srcs/utils/utils.c \
srcs/utils/utils2.c \
srcs/utils/utils3.c
#----------------Others----------------#
SRCS += srcs/other/exec_line.c \
srcs/other/exec_line2.c \
srcs/other/redirection.c \
srcs/other/print.c \
srcs/other/pipe.c \
srcs/other/search_command.c \
srcs/other/var_env.c \
srcs/other/set_env.c
OBJS = $(SRCS:.c=.o)
INCL = includes/
HEADER = $(INCL)minishell.h
LIBFT = libft.a
LIBFTDIR = libft/
LIBFTLINK = -L $(LIBFTDIR) -lft
###########################ALL
all: $(NAME)
$(NAME): complib echoCL $(OBJS) echoOK echoCS
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBFTLINK) -o $@ $(OBJS)
###########################LIBS
complib:
$(MAKE) -C libft/
###########################OBJECTS
%.o: %.c $(HEADER)
$(CC) $(CFLAGS) $(LDFLAGS) -I $(INCL) -c $< -o $@
printf "$(GREEN)██"
###########################CLEAN
clean: echoCLEAN
$(MAKE) -C $(LIBFTDIR) clean
rm -f $(OBJS)
fclean: clean echoFCLEAN
$(MAKE) -C $(LIBFTDIR) fclean
rm -f $(OBJS)
rm -f $(NAME) a.out
re: fclean all
.PHONY: all re clean fclean
.SILENT:
###########################COLOR
#----------------reset----------------#
NC = \033[0m
#-----------Regular Colors------------#
BLACK = \033[0;30m
RED = \033[0;31m
GREEN = \033[32m
YELLOW = \033[33;33m
BLUE = \033[0;34m
PURPLE = \033[1;35m
CYAN = \033[1;36m
WHITE = \033[0;37m
###########################ECHO
echoCL:
echo "$(YELLOW)===> Compiling $(RED)Minishell$(NC)\n"
echoOK:
echo "$(GREEN) OK$(NC)\n"
echoCS :
echo "$(GREEN)===> Compilation Success$(NC)\n"
echoCLEAN :
echo "\n$(PURPLE)===> Cleanning OBJS$(NC)"
echoFCLEAN :
echo "$(PURPLE)===> Cleanning Exec & Lib$(NC)\n"
###########################TEST
run: $(NAME)
./$<