-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (46 loc) · 1.36 KB
/
Makefile
File metadata and controls
66 lines (46 loc) · 1.36 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
NAME = minishell
CC = clang
CFLAGS = -Wall -Wextra -Werror -I includes/ -I libft/includes/
LIBFT = -L libft -lft
HEADER = minishell.h
BUILTINS = cd echo env exit export pwd unset
ENV = env get_env sort_env shlvl
EXEC = bin builtin exec
MAIN = minishell redir signal
PARSING = line tokens expansions
TOOLS = fd free token type expansions parsing
SRC = $(addsuffix .c, $(addprefix srcs/builtins/, $(BUILTINS))) \
$(addsuffix .c, $(addprefix srcs/env/, $(ENV))) \
$(addsuffix .c, $(addprefix srcs/exec/, $(EXEC))) \
$(addsuffix .c, $(addprefix srcs/main/, $(MAIN))) \
$(addsuffix .c, $(addprefix srcs/parsing/, $(PARSING))) \
$(addsuffix .c, $(addprefix srcs/tools/, $(TOOLS))) \
OBJ = $(SRC:c=o)
all: $(NAME)
$(NAME): $(OBJ)
@echo "\n"
@make -C libft/
@echo "\033[0;32mCompiling minishell..."
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBFT)
@echo "\n\033[0mDone !"
%.o: %.c
@printf "\033[0;33mGenerating minishell objects... %-33.33s\r" $@
@${CC} ${CFLAGS} -c $< -o $@
clean:
@echo "\033[0;31mCleaning libft..."
@make clean -C libft/
@echo "\nRemoving binaries..."
@rm -f $(OBJ)
@echo "\033[0m"
fclean:
@echo "\033[0;31mCleaning libft..."
@make fclean -C libft/
@echo "\nDeleting objects..."
@rm -f $(OBJ)
@echo "\nDeleting executable..."
@rm -f $(NAME)
@echo "\033[0m"
re: fclean all
test: all
./minishell
.PHONY: clean fclean re test norm