-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (57 loc) · 2.16 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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: djoyke <djoyke@student.codam.nl> +#+ #
# +#+ #
# Created: 2023/05/20 15:38:33 by djoyke #+# #+# #
# Updated: 2023/05/22 20:00:19 by dreijans ######## odam.nl #
# #
# **************************************************************************** #
NAME = fractol
LIBFT = ./LIBFT/libft.a
MLX42 = ./MLX42/build/libmlx42.a
CC = gcc
CFLAGS = -Wall -Werror -Wextra -Ofast -O3
LIBMLX = ./MLX42
HEADERS = -I ./include -I $(LIBMLX)/include
ifeq ($(shell uname -m),arm64)
INCL = -framework Cocoa -framework OpenGL -framework IOKit -L "`brew --prefix glfw`/lib/" -lglfw
else ifeq ($(shell uname -m),x86_64)
INCL = -framework Cocoa -framework OpenGL -framework IOKit -lglfw3
endif
LIBS = $(LIBMLX)/build/libmlx42.a -ldl -pthread -lm $(INCL)
SRC = \
main.c \
navigate.c \
checks.c \
julia.c \
mandelbrot.c \
utils.c \
OBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRC:.c=.o)))
OBJDIR = obj
all: libmlx $(NAME)
$(NAME): $(LIBFT) $(OBJ) $(MLX42)
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(MLX42) -o $(NAME) $(LIBS) $(HEADERS)
$(MLX42):
@git submodule update --init --recursive
@cmake $(LIBMLX) -B $(LIBMLX)/build && make -C $(LIBMLX)/build -j4
$(LIBFT):
@git submodule update --init --recursive
@$(MAKE) -C ./LIBFT
$(OBJDIR)/%.o: %.c
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $^ $(HEADERS)
$(OBJDIR)/%.o:
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $^
clean:
@$(MAKE) clean -C ./LIBFT
@rm -rf $(OBJDIR)
@rm -rf $(LIBMLX)/build
fclean: clean
@$(MAKE) fclean -C ./LIBFT
@rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re libmlx