-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (71 loc) · 2.36 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hyunjuki <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/03/30 21:16:07 by hyunjuki #+# #+# #
# Updated: 2023/05/07 22:22:56 by hyunjuki ### ########.fr #
# #
# **************************************************************************** #
NAME = miniRT
CC = gcc
CFLAGS = -Wall -Wextra -Werror -g
LIB_PATH = ./lib
LIBFT_PATH = $(LIB_PATH)/libft
MLX_PATH = $(LIB_PATH)/mlx
SRCS_NAME = main.c \
init.c \
ft_atof.c \
key_hook.c \
color.c \
parser_main.c \
parser_ambient.c \
parser_camera.c \
parser_cylinder.c \
parser_light.c \
parser_plane.c \
parser_sphere.c \
ray.c \
trace.c \
trace2.c \
render.c \
phong.c \
vector_oper1.c \
vector_oper2.c \
shapelst_oper1.c
SRCS_PATH = ./srcs
SRCS = $(addprefix $(SRCS_PATH)/, $(SRCS_NAME))
OBJS_NAME = $(SRCS_NAME:.c=.o)
OBJS_PATH = ./objs
OBJS = $(addprefix $(OBJS_PATH)/, $(OBJS_NAME))
INCS = -I./include -I$(LIBFT_PATH) -I$(MLX_PATH)
all : $(NAME)
$(NAME) : $(OBJS)
@echo building LIBFT...
@$(MAKE) -C $(LIBFT_PATH)
@echo building MiniLibX...
@$(MAKE) --silent -C $(MLX_PATH)
@cp $(MLX_PATH)/libmlx.dylib ./libmlx.dylib
@echo Linking miniRT executable file
@$(CC) $(CFLAGS) $(OBJS) $(INCS) -L$(LIBFT_PATH) -lft -L$(MLX_PATH) -lmlx -framework OpenGL -framework AppKit -o $(NAME)
$(OBJS_PATH)/%.o : $(SRCS_PATH)/%.c
@echo building obj files : $<
@$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
clean :
@echo delete object files
@rm -f $(OBJS)
@$(MAKE) --silent -C $(LIBFT_PATH) clean
@$(MAKE) --silent -C $(MLX_PATH) clean
fclean : clean
@echo delete executable file
@rm -f $(NAME)
@rm -f libmlx.dylib
@$(MAKE) --silent -C $(LIBFT_PATH) fclean
re :
@$(MAKE) fclean
@$(MAKE) all
bonus :
@echo there is no bonus!
.PHONY : all clean fclean re bonus