-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (61 loc) · 2.37 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tpeters <tpeters@student.42heilbronn.de +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/08/28 17:42:17 by tpeters #+# #+# #
# Updated: 2022/11/06 22:29:56 by tpeters ### ########.fr #
# #
# **************************************************************************** #
SRCS = fractol.c fractol_color_utils.c fractol_pixel_utils.c fractol_mandelbrot.c fractol_depth_array.c fractol_julia.c fractol_newton.c fractol_rect_optimization.c fractol_key.c fractol_mouse.c fractol_bounds.c fractol_stuff.c
OBJS = $(SRCS:.c=.o)
NAME = fractol
CFLAGS = -Wall -Wextra -Werror
LINK_FLAGS = -Llibft -lft
CC = cc
ifeq ($(OS),Windows_NT)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS += -I/usr/include
LINK_FLAGS += -Lmlx_linux -lmlx_Linux -L/usr/lib -lXext -lX11 -lm -lz -O3
endif
ifeq ($(UNAME_S),Darwin)
CFLAGS += -Imlx
LINK_FLAGS += -Lmlx -lmlx -framework OpenGL -framework AppKit
endif
endif
LIBFTLIB=/libft/libft.a
LIBMLXLIB=/mlx/libmlx.a
all: $(LIBFTLIB) $(LIBMLXLIB)
all: $(NAME)
debug: CFLAGS += -g
debug: all
LSANLIB = /LeakSanitizer/liblsan.a
lsan: CFLAGS += -ILeakSanitizer -Wno-gnu-include-next
lsan: LINK_FLAGS += -LLeakSanitizer -llsan -lc++
lsan: fclean $(LSANLIB)
lsan: all
$(LSANLIB):
@if [ ! -d "LeakSanitizer" ]; then git clone git@github.com:mhahnFr/LeakSanitizer.git; fi
$(MAKE) -C LeakSanitizer
$(LIBFTLIB):
@if [ ! -d "libft" ]; then git clone git@github.com:Ludmuterol/libft.git; fi
$(MAKE) -C libft
$(LIBMLXLIB):
$(MAKE) -C mlx CFLAGS+="-Wno-deprecated -DSTRINGPUTX11 -O2"
$(NAME): $(OBJS)
$(CC) $(OBJS) $(LINK_FLAGS) -o $(NAME)
norm:
norminette $(SRCS) fractol.h
clean:
rm -f $(OBJS)
fclean: clean
$(MAKE) -C libft fclean
$(MAKE) -C mlx clean
rm -f $(NAME)
re: fclean
$(MAKE)
.PHONY: lsan debug all norm clean fclean re