-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
113 lines (94 loc) · 3.43 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vbrazhni <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/07/05 13:39:23 by vbrazhni #+# #+# #
# Updated: 2019/07/20 17:59:18 by vbrazhni ### ########.fr #
# #
# **************************************************************************** #
NAME = fractol
CC = gcc
FLAGS = -Wall -Werror -Wextra -O3
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 = ./minilibx_macos/
MINILIBX_HEADERS = $(MINILIBX_DIRECTORY)
HEADERS_LIST = \
fractol.h\
color.h\
key_macos.h\
error_message.h
HEADERS_DIRECTORY = ./includes/
HEADERS = $(addprefix $(HEADERS_DIRECTORY), $(HEADERS_LIST))
SOURCES_DIRECTORY = ./sources/
SOURCES_LIST = \
fractol.c\
init.c\
draw.c\
fractal_mandelbrot.c\
fractal_julia.c\
fractal_burning_ship.c\
fractal_mandelbar.c\
fractal_celtic_mandelbrot.c\
fractal_celtic_mandelbar.c\
fractal_celtic_perpendicular.c\
fractal_perpendicular_mandelbrot.c\
fractal_perpendicular_burning_ship.c\
fractal_perpendicular_buffalo.c\
color.c\
controls_keyboard.c\
controls_mouse.c\
controls_utils.c\
print.c\
utils.c
SOURCES = $(addprefix $(SOURCES_DIRECTORY), $(SOURCES_LIST))
OBJECTS_DIRECTORY = objects/
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