-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
120 lines (106 loc) · 4.42 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
NAME := minishell
CC := cc
FLAGS := -I inc -O2 -g
HEADERS := inc/minishell.h inc/libft.h
ifeq ($(USER), aarbaoui)
LDFLAGS="-L/Volumes/Untitled/opt/readline/lib"
CPPFLAGS="-I/Volumes/Untitled/opt/readline/include"
else ifeq ($(USER), lsabik)
LDFLAGS="-L/Users/lsabik/.brew/opt/readline/lib"
CPPFLAGS="-I/Users/lsabik/.brew/opt/readline/include"
endif
INCLUDESS = ${CPPFLAGS}
LIBRARIESS = ${LDFLAGS} -lreadline
SRCS := minishell.c \
src/libft/ft_atoi.c \
src/libft/ft_bzero.c \
src/libft/ft_calloc.c \
src/libft/ft_isalnum.c \
src/libft/ft_isalpha.c \
src/libft/ft_isascii.c \
src/libft/ft_isdigit.c \
src/libft/ft_isprint.c \
src/libft/ft_itoa.c \
src/libft/ft_strcmp.c \
src/libft/ft_memchr.c \
src/libft/ft_isspace.c \
src/libft/ft_memcmp.c \
src/libft/ft_memcpy.c \
src/libft/ft_memmove.c \
src/libft/ft_strndup.c \
src/libft/ft_memset.c \
src/libft/ft_putchar_fd.c \
src/libft/ft_putendl_fd.c \
src/libft/ft_putnbr_fd.c \
src/libft/ft_putstr_fd.c \
src/libft/ft_split.c \
src/libft/ft_strchr.c \
src/libft/ft_strdup.c \
src/libft/ft_striteri.c \
src/libft/ft_strjoin.c \
src/libft/ft_strlcat.c \
src/libft/ft_strlcpy.c \
src/libft/ft_strlen.c \
src/libft/ft_strmapi.c \
src/libft/ft_strncmp.c \
src/libft/ft_strnstr.c \
src/libft/ft_strrchr.c \
src/libft/ft_strtrim.c \
src/libft/ft_substr.c \
src/libft/ft_tolower.c \
src/libft/ft_toupper.c \
src/libft/ft_realloc.c \
src/parsing/init.c \
src/builtin/cd.c \
src/builtin/echo.c \
src/parsing/lexer.c \
src/parsing/signals.c \
src/utils/token_utils.c \
src/utils/free_all.c \
src/syntax_analyser/syntax.c \
src/exec/init.c \
src/builtin/exit.c \
src/syntax_analyser/syntax_utils.c \
src/expander/expander.c \
src/expander/expander_utis.c \
src/utils/env_utils.c \
src/builtin/export.c \
src/builtin/env.c \
src/builtin/unset.c \
src/utils/exec_utils.c \
src/parsing/parsing.c \
src/utils/parsing_utils.c \
src/exec/execution.c \
src/exec/execution_utils.c \
src/exec/exec_herdoc.c \
src/utils/token_utils2.c \
src/utils/builtin_utils.c \
src/builtin/pwd.c \
src/parsing/parsing_utilis.c \
src/builtin/export_utilis.c \
src/builtin/export_utilis2.c \
src/expander/expander_utilis2.c \
OBJS := $(SRCS:.c=.o)
%.o : %.c ${HEADERS}
${CC} ${FLAGS} ${INCLUDESS} -c $< -o ${<:.c=.o}
CLR_RMV := \033[0m
RED := \033[1;31m
GREEN := \033[1;32m
YELLOW := \033[1;33m
BLUE := \033[1;34m
CYAN := \033[1;36m
RM := rm -f
${NAME}: ${OBJS}
@echo "$(GREEN)Compilation ${CLR_RMV}of ${YELLOW}$(NAME) ${CLR_RMV}..."
${CC} ${FLAGS} ${LIBRARIESS} -o ${NAME} ${OBJS} -lreadline
@echo "$(GREEN)$(NAME) created[0m ✔️"
all: ${NAME}
bonus: all
clean:
@ ${RM} *.o */*.o */*/*.o
@ echo "$(RED)Deleting $(CYAN)$(NAME) $(CLR_RMV)objs ✔️"
fclean: clean
@ ${RM} ${NAME}
@ echo "$(RED)Deleting $(CYAN)$(NAME) $(CLR_RMV)binary ✔️"
re: fclean all
.PHONY: all clean fclean re