-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (39 loc) · 925 Bytes
/
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
NAME = minishell
SRC = src
BIN = bin
INC = inc
LIB = lib
BUILT = builtin
SOURCE = $(wildcard $(SRC)/*.c)
OBJECT = $(patsubst %, $(BIN)/%, $(notdir $(SOURCE:.c=.o)))
CC = gcc
FLAGS = -Wall -Wextra -Werror
CPP_FLAGS = -I$(INC) -Ilib/libft
FTPRINTF = lib/libft/libft.a
RED = \033[1;31m
GREEN = \033[1;32m
BLUE = \033[1;34m
YELLOW = \033[1;33m
NC = \033[1;0m
all: $(NAME)
$(NAME):$(OBJECT) $(FTPRINTF)
@echo "$(RED)Linking...$(NC)"
@$(CC) $(OBJECT) $(FTPRINTF) -o $(NAME)
@echo "$(GREEN)Finished...$(NC)"
$(FTPRINTF):
@echo "$(BLUE)Getting Libraries...$(NC)"
@make -C $(LIB)/libft
$(BIN)/%.o : $(SRC)/%.c
@$(CC) $(FLAGS) $(CFLAGS) $(CPP_FLAGS) -c $< -o $@
clean:
@echo "$(RED)Cleaning up...$(NC)"
@rm -rf $(OBJECT)
@make -C $(LIB)/libft clean
fclean:clean
@rm -rf $(NAME)
@make -C $(LIB)/libft fclean
re : fclean all
.PHONY: all clean fclean re help
help :
@echo "src: $(SOURCE)"
@echo "obj: $(OBJECT)"