-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (88 loc) · 2.64 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: haeem <haeem@student.42seoul.kr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/04/11 14:22:09 by haeem #+# #+# #
# Updated: 2023/12/14 17:56:18 by haeem ### ########seoul.kr #
# #
# **************************************************************************** #
CC = cc
CFLAGS = -Wall -Wextra -Werror -mavx2 -o2
SRCDIR = $(CURDIR)
NAME = miniRT
LIBFTDIR = $(SRCDIR)/libft
LIBFT = ./libft/libft.a
LIBFTHEADER = ./libft/libft.h
MLX_NAME = mlx
MLX_DIR = ./mlx
SOURCES = $(addprefix $(CURDIR)/srcs/,\
Control/ControlBlock.c\
Control/hooks.c\
Control/Image.c\
Control/Scene.c\
Control/Scene2.c\
Control/Scene3.c\
Graphics/Matrix.c\
Graphics/Light.c\
Graphics/Object.c\
Graphics/Ray.c\
Graphics/Sphere.c\
Graphics/Cylinder.c\
Graphics/Cylinder_intersection.c\
Graphics/Cylinder_calculation.c\
Graphics/Circle.c\
Graphics/Triangle.c\
Graphics/Plane.c\
Graphics/Phong.c\
Graphics/Vector.c\
Graphics/Vector2.c\
Graphics/Vector3.c\
Parse/Parse.c\
Parse/Parse_common.c\
Parse/Parse_object.c\
Parse/Parse_object2.c\
Parse/Parse_util.c\
main.c\
)
# BONUSES = $(addprefix $(CURDIR)/srcs_bonus/,\
# )
OBJECTS = $(SOURCES:.c=.o)
# BONUSOBJECTS = $(BONUSES:.c=.o)
ALLOBJECTS = $(SOURCES:.c=.o) $(BONUSES:.c=.o)
HEADER = -I./srcs/Control\
-I./srcs/Graphics\
-I./srcs/Parse\
-I./libft/includes\
-I./libft/get_next_line\
# BONUSHEADER = $(CURDIR)/include_bonus
# ifdef WITH_BONUS
# OBJ = $(BONUSOBJECTS)
# HDR = $(BONUSHEADER)
# else
OBJ = $(OBJECTS)
HDR = $(HEADER)
# endif
all: $(NAME)
# bonus:
# @make WITH_BONUS=1 all
%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@ $(HDR) -I $(MLX_DIR) -I $(LIBFTDIR)
$(NAME): $(OBJ)
@$(MAKE) -C $(LIBFTDIR) all
@$(MAKE) -C $(MLX_DIR) all
@$(CC) $(CFLAGS) -L$(LIBFTDIR) $(LIBFT) -L$(MLX_DIR) -l$(MLX_NAME) -framework OpenGL -framework AppKit $^ -o $@
@cp $(MLX_DIR)/libmlx.dylib $(SRCDIR)
clean:
@rm -f $(ALLOBJECTS)
@make -C $(LIBFTDIR) clean
@make -C $(MLX_DIR) clean
fclean: clean
@rm -f $(NAME)
@make -C $(LIBFTDIR) fclean
@make -C $(MLX_DIR) clean
@rm -f libmlx.dylib
re: fclean all
.PHONY: re clean fclean all bonus miniRT