-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
70 lines (55 loc) · 1.89 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
NAME = minishell
CC = cc
CFLAGS += -Wall -Wextra -Werror
RM = rm -rf
UTILS = $(addprefix utils/, ft_atoi ft_itoa ft_split ft_calloc ft_realloc get_line string string_utils)
LEXER = $(addprefix lexer/, list lexer lexer_utils)
PARSER = $(addprefix parser/, parser ast redir_utils parse_core parse_utils)
ENV = $(addprefix env/, env_list env_utils env_search)
BUILINS = $(addprefix builtins/, $(ENV) ft_export ft_unset ft_pwd ft_echo echo_utils ft_cd ft_exit ft_env export_utils_0 export_utils_1)
EXEC = $(addprefix exec/, execute redir pipe find execute_cmd)
FILES = $(addprefix srcs/, minishell main_utils signals error clean_up syntax $(UTILS) $(LEXER) $(PARSER) $(BUILINS) $(EXEC))
SRC = $(FILES:=.c)
OBJ = $(FILES:=.o)
HEADER = $(addprefix includes/, minishell.h env.h)
INCLUDES = -I includes
LDFLAGS += -lreadline
#Colors:
GREEN = \e[92;5;118m
YELLOW = \e[93;5;226m
GRAY = \e[33;2;37m
RESET = \e[0m
CURSIVE = \e[33;3m
#Debug
ifeq ($(DEBUG), 1)
OPTS = -g
endif
.PHONY: all clean fclean re norm
all: $(NAME)
$(NAME): $(OBJ) $(HEADER)
@printf "$(CURSIVE)$(GRAY) - Compiling $(NAME)... $(RESET)\n"
@ $(CC) $(OBJ) $(INCLUDES) $(LDFLAGS) $(OPTS) -o $(NAME)
@printf "$(GREEN) - Executable ready.\n$(RESET)"
%.o: %.c $(HEADER)
@printf "$(CURSIVE)$(GRAY) - Making object file $(notdir $@) from source file $(notdir $<) ... $(RESET)\n"
@ $(CC) $(CFLAGS) $(INCLUDES) $(OPTS) -c $< -o $@
norm:
@printf "$(CURSIVE)$(GRAY)"
@norminette
@printf "$(RESET)"
clean:
@ $(RM) $(OBJ)
@printf "$(CURSIVE)$(GRAY) - Removing object files ... $(RESET)\n"
@printf "$(YELLOW) - Object files removed.$(RESET)\n"
fclean: clean
@ $(RM) $(NAME)
@printf "$(CURSIVE)$(GRAY) - Removing $(NAME)... $(RESET)\n"
@printf "$(YELLOW) - Executable removed.$(RESET)\n"
push:
@make fclean
@git add *
@git commit -am "OK."
@git push
lldb:
@make fclean && make DEBUG=1 && lldb minishell
re: fclean all