-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (70 loc) · 2.27 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
NAME = fdf
CC = gcc
FLAGS = -Wall -Werror -Wextra
LIBRARIES = -lmlx -lm -lft -L$(LIBFT_DIRECTORY) -L$(MINILIBX_DIRECTORY) -framework OpenGL -framework AppKit
INCLUDES = -I$(HEADERS_DIRECTORY) -I$(LIBFT_HEADERS) -I$(MINILIBX_HEADERS)
LIBFT = $(LIBFT_DIRECTORY)libft.a
LIBFT_DIRECTORY = ./libft/
LIBFT_HEADERS = $(LIBFT_DIRECTORY)includes/
MINILIBX = $(MINILIBX_DIRECTORY)libmlx.a
MINILIBX_DIRECTORY = ./mlx/
MINILIBX_HEADERS = $(MINILIBX_DIRECTORY)
HEADERS_LIST = fdf.h \
color.h \
interface.h
HEADERS_DIRECTORY = ./inc/
HEADERS = $(addprefix $(HEADERS_DIRECTORY), $(HEADERS_LIST))
SOURCES_DIRECTORY = ./src/
SOURCES_LIST = main.c \
menu.c \
map.c \
fdf.c \
camera.c \
print.c \
projection.c \
color.c \
interface.c \
controls.c \
control_operations.c
SOURCES = $(addprefix $(SOURCES_DIRECTORY), $(SOURCES_LIST))
OBJECTS_DIRECTORY = obj/
OBJECTS_LIST = $(patsubst %.c, %.o, $(SOURCES_LIST))
OBJECTS = $(addprefix $(OBJECTS_DIRECTORY), $(OBJECTS_LIST))
# COLORS
GREEN = \033[0;32m
RED = \033[0;31m
RESET = \033[0m
.PHONY: all clean fclean re
all: $(NAME)
$(NAME): $(LIBFT) $(MINILIBX) $(OBJECTS_DIRECTORY) $(OBJECTS)
@$(CC) $(FLAGS) $(LIBRARIES) $(INCLUDES) $(OBJECTS) -o $(NAME)
@echo "\n$(NAME): $(GREEN)object files were created$(RESET)"
@echo "$(NAME): $(GREEN)$(NAME) was created$(RESET)"
$(OBJECTS_DIRECTORY):
@mkdir -p $(OBJECTS_DIRECTORY)
@echo "$(NAME): $(GREEN)$(OBJECTS_DIRECTORY) was created$(RESET)"
$(OBJECTS_DIRECTORY)%.o : $(SOURCES_DIRECTORY)%.c $(HEADERS)
@$(CC) $(FLAGS) -c $(INCLUDES) $< -o $@
@echo "$(GREEN).$(RESET)\c"
$(LIBFT):
@echo "$(NAME): $(GREEN)Creating $(LIBFT)...$(RESET)"
@$(MAKE) -sC $(LIBFT_DIRECTORY)
$(MINILIBX):
@echo "$(NAME): $(GREEN)Creating $(MINILIBX)...$(RESET)"
@$(MAKE) -sC $(MINILIBX_DIRECTORY)
clean:
@$(MAKE) -sC $(LIBFT_DIRECTORY) clean
@$(MAKE) -sC $(MINILIBX_DIRECTORY) clean
@rm -rf $(OBJECTS_DIRECTORY)
@echo "$(NAME): $(RED)$(OBJECTS_DIRECTORY) was deleted$(RESET)"
@echo "$(NAME): $(RED)object files were deleted$(RESET)"
fclean: clean
@rm -f $(MINILIBX)
@echo "$(NAME): $(RED)$(MINILIBX) was deleted$(RESET)"
@rm -f $(LIBFT)
@echo "$(NAME): $(RED)$(LIBFT) was deleted$(RESET)"
@rm -f $(NAME)
@echo "$(NAME): $(RED)$(NAME) was deleted$(RESET)"
re:
@$(MAKE) fclean
@$(MAKE) all