Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
131 lines (112 loc) · 3.73 KB
/
Copy pathMakefile
File metadata and controls
131 lines (112 loc) · 3.73 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: abeihaqi <abeihaqi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/07/04 11:54:50 by rouarrak #+# #+# #
# Updated: 2023/12/11 03:06:31 by abeihaqi ### ########.fr #
# #
# **************************************************************************** #
CC = cc
CFLAGS += -Wall -Werror -Wextra
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS += -D LINUX
LDFLAGS += -Lmlx_linux -lmlx_Linux -L/usr/lib -lXext -lX11 -lm -lz
INCLUDES += -I/usr/include -Imlx_linux
endif
ifeq ($(UNAME_S),Darwin)
CFLAGS += -I.
INCLUDES += -Lmlx -lmlx -framework OpenGL -framework AppKit
endif
HEADERS += ./includes/minirt.h \
./includes/color.h \
./includes/elements.h \
./includes/image.h \
./includes/ray.h \
./includes/vector.h \
./includes/parsing.h \
./includes/lighting.h \
./includes/matrix.h \
NAME = miniRT
BONUS = miniRT_bonus
LIBFT = libft.a
LIBFT_DIR = libft/
SRC = main.c \
srcs/put_pixel.c \
srcs/image.c \
srcs/window.c \
srcs/render.c \
srcs/vector/cross_product.c \
srcs/vector/normalize_vector.c \
srcs/vector/vector_subtraction.c \
srcs/vector/vector_division.c \
srcs/vector/vector_magnitude.c \
srcs/vector/dot_product.c \
srcs/vector/vector_addition.c \
srcs/vector/vector_scale.c \
parser/element_check.c \
parser/element_check_2.c \
parser/file_check.c \
parser/fill_cylinder.c \
parser/fill_cone.c \
parser/fill_plane.c \
parser/fill_sphere.c \
parser/fill_spotlight.c \
parser/filling.c \
parser/texture.c \
parser/checks_helper.c \
parser/parsing.c \
parser/utils_gnrl.c \
parser/utils_pars.c \
gnl/get_next_line.c \
gnl/get_next_line_utils.c \
srcs/color/color.c \
srcs/intesection/cone.c \
srcs/intesection/cylinder.c \
srcs/intesection/light.c \
srcs/intesection/plane.c \
srcs/intesection/sphere.c \
srcs/intesection/intersect.c \
srcs/lighting/ambient.c \
srcs/lighting/diffuse.c \
srcs/lighting/specular.c \
srcs/lighting/apply_light.c \
srcs/lighting/shadow.c \
srcs/matrix/dir.c \
srcs/matrix/rotation.c \
srcs/ray/ray.c \
srcs/math/clamp.c \
srcs/math/solve_quadratic.c \
srcs/math/max.c \
srcs/texture_map/cylinder.c \
srcs/texture_map/cone.c \
srcs/texture_map/plane.c \
srcs/texture_map/sphere.c \
srcs/texture_map/checkerboard.c \
srcs/texture_map/local_axis.c \
srcs/debug/print.c \
srcs/debug/print_obj.c \
OBJ = $(SRC:.c=.o)
%.o: %.c $(HEADERS)
echo $(UNAME_P)
$(CC) $(CFLAGS) -c $< -o $@
all: $(NAME) # $(BONUS)
$(NAME): $(OBJ) $(LIBFT) $(HEADERS)
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(INCLUDES) $(LDFLAGS) -o $(NAME)
$(LIBFT):
$(MAKE) bonus -C $(LIBFT_DIR)
mv $(LIBFT_DIR)$(LIBFT) .
bonus: $(BONUS)
$(BONUS): $(OBJ) $(LIBFT) $(HEADERS)
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(INCLUDES) $(LDFLAGS) -o $(BONUS)
clean:
rm -f $(OBJ)
$(MAKE) -C $(LIBFT_DIR) clean
fclean: clean
rm -f $(NAME)
rm -f $(BONUS)
rm -f $(LIBFT)
re: clean fclean all miniRT