-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (72 loc) · 2.52 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rphuyal <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/06/03 21:26:23 by rphuyal #+# #+# #
# Updated: 2023/07/04 01:55:46 by rphuyal ### ########.fr #
# #
# **************************************************************************** #
NAME = fractol
OS = $(shell uname)
CC = @gcc
FLAGS = -g -fsanitize=address
LFT = libft/libft.a
INC = -I./libft -I./mlx -I./mlx_mac
SRC = src/core/main.c \
src/core/initializations.c \
src/window/hooks.c \
src/window/painter.c \
src/window/zoom.c \
src/computes/helper.c \
src/computes/julia.c \
src/computes/mandelbrot.c \
src/computes/burningship.c
OBJ = $(patsubst src/%.c, obj/%.o, $(SRC))
ifeq ($(OS), Darwin)
MLX = mlx_mac/libmlx.a
INC_MLX = mlx_mac
LIB = -L./libft -lft -L./mlx_mac -lmlx -framework OpenGL -framework AppKit
else
MLX = mlx/libmlx.a
INC_MLX = mlx
LIB = -L./libft -lft -L./mlx -lmlx -lXext -lX11
endif
# COLORS
CBOLD = \033[0;1m
RED = \033[0;41m
GREEN = \033[0;42m
BLUE = \033[0;44m
YELLOW = \033[0;43m
RESET = \033[0m
all: $(LFT) $(MLX) obj $(NAME)
$(NAME): $(OBJ)
@echo "$(CBOLD)$(YELLOW) Compiling $(NAME) $(RESET)"
$(CC) $(FLAGS) -o $@ $^ $(LIB)
@echo "$(CBOLD)$(GREEN) $(NAME) ready! $(RESET)"
$(MLX):
@echo "$(CBOLD)$(YELLOW) Compiling Minilibx $(RESET)"
@make -sC $(INC_MLX) > /dev/null 2>&1
@echo "$(CBOLD)$(GREEN) Minilibx ready! $(RESET)\n ↪"
$(LFT):
@echo "$(CBOLD)$(YELLOW) Compiling Libft $(RESET)"
@make -sC ./libft
@echo "$(CBOLD)$(GREEN) Libft ready! $(RESET)\n ↪"
obj:
@mkdir -p obj
obj/%.o: src/%.c
@mkdir -p $(dir $@)
$(CC) $(FLAGS) $(INC) -c $< -o $@
clean:
@make -sC libft clean
@make -sC $(INC_MLX) clean > /dev/null
@rm -rf $(OBJ) obj
@echo "$(CBOLD)$(BLUE) Objects removed! $(RESET)"
fclean: clean
@make -sC libft fclean
@rm -rf $(NAME)
@echo "$(CBOLD)$(BLUE) Binaries removed! $(RESET)"
re: fclean all
.PHONY: all