-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (74 loc) · 1.9 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
# NAMES
NAME = push_swap
NAME_BONUS = checker
# LIBFT
LIBFT = libft/libft.a
# SOURCE FILES
SRC_DIR = src/
SRC_BONUS_DIR = bonus/
SRC_FILES = main.c \
list_utils_1.c \
list_utils_2.c \
list_utils_3.c \
utils_1.c \
utils_2.c \
parsing.c \
moves.c \
choose_move.c \
push_two_to_b.c \
push_till_three.c \
sort_three.c \
push_to_a.c \
rotate_till_is_sort.c
BONUS_FILES = checker.c \
parsing_checker.c \
list_utils_checker.c \
utils_checker.c \
moves_checker.c \
choose_move_checker.c
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
SRC_BONUS = $(addprefix $(SRC_BONUS_DIR), $(BONUS_FILES))
# OBJECT FILES
OBJ_FILES = $(SRC:.c=.o)
OBJ_BONUS_FILES = $(SRC_BONUS:.c=.o)
# COMPILER OPTIONS
CC = gcc
FLAGS = -Wall -Werror -Wextra
INCLUDE = -I includes
RM = rm -f
# COLORS
RED = \033[91;1m
GREEN = \033[92;1m
YELLOW = \033[93;1m
BLUE = \033[94;1m
PINK = \033[95;1m
CLEAR = \033[0m
# MAKEFILE RULES
all: $(NAME)
$(NAME): $(OBJ_FILES)
@make -sC libft
@echo "$(PINK)Compiling the PUSH_SWAP program.$(CLEAR)"
$(CC) $(FLAGS) $(OBJ_FILES) $(INCLUDE) $(LIBFT) -o $(NAME)
@echo "$(GREEN)[OK]\n$(CLEAR)$(GREEN)Success!$(CLEAR)\n"
bonus: $(NAME) $(NAME_BONUS)
$(NAME_BONUS): $(OBJ_BONUS_FILES)
@make -sC libft
@echo "$(PINK)Compiling the CHECKER program.$(CLEAR)"
$(CC) $(FLAGS) $(OBJ_BONUS_FILES) $(INCLUDE) $(LIBFT) -o $(NAME_BONUS)
@echo "$(GREEN)[OK]\n$(CLEAR)$(GREEN)Success!$(CLEAR)\n"
%.o: %.c
$(CC) $(FLAGS) -c -o $@ $<
clean:
@echo "$(PINK)Removing compiled files.$(CLEAR)"
@make clean -sC libft
$(RM) $(OBJ_FILES)
$(RM) $(OBJ_BONUS_FILES)
@echo "$(GREEN)Object files removed correctly\n$(CLEAR)"
fclean: clean
@make fclean -sC libft
@echo "$(PINK)Removing exec. files.$(CLEAR)"
$(RM) $(NAME)
$(RM) $(NAME_BONUS)
@echo "$(GREEN)Exec. files removed correctly\nSuccess!$(CLEAR)"
re: fclean all
.PHONY: all bonus clean fclean re