-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
111 lines (94 loc) · 3.49 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
109
110
111
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: yhwang <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/23 16:05:09 by yhwang #+# #+# #
# Updated: 2023/12/22 15:25:10 by yhwang ### ########.fr #
# #
# **************************************************************************** #
RESET := $(shell tput -Txterm sgr0)
YELLOW := $(shell tput -Txterm setaf 3)
NAME = miniRT
CC = cc
CFLAGS = -Wall -Wextra -Werror
RM = rm -f
LIBFT_DIR = ./parse/libft
LIBFT_NAME = libft.a
LIBFT = $(addprefix $(LIBFT_DIR)/, $(LIBFT_NAME))
MLX_DIR = ./execute/mlx_linux
MLX_FLAGS = -lX11 -lXext -lm
MLX = $(addprefix $(MLX_DIR)/, libmlx.a)
PARSE_DIR = ./parse/srcs/
EXECUTE_DIR = ./execute/srcs/
PARSE_INCS_DIR = ./parse/incs/
EXECUTE_INCS_DIR = ./execute/incs/
FILES = ./main \
$(PARSE_DIR)parse_main \
$(PARSE_DIR)parse_init \
$(PARSE_DIR)parse_map \
$(PARSE_DIR)parse_check_id \
$(PARSE_DIR)parse_ambient \
$(PARSE_DIR)parse_camera \
$(PARSE_DIR)parse_light \
$(PARSE_DIR)parse_sphere \
$(PARSE_DIR)parse_plane \
$(PARSE_DIR)parse_cylinder \
$(PARSE_DIR)utils_lib \
$(PARSE_DIR)utils_range \
$(PARSE_DIR)utils\
$(EXECUTE_DIR)alloc_mem \
$(EXECUTE_DIR)free_mem \
$(EXECUTE_DIR)set_cam_vec \
$(EXECUTE_DIR)start_draw \
$(EXECUTE_DIR)key_hooks \
$(EXECUTE_DIR)cam_light_hooks \
$(EXECUTE_DIR)move_rotate_hooks \
$(EXECUTE_DIR)cam_light_apply_hooks \
$(EXECUTE_DIR)obj_apply_hooks \
$(EXECUTE_DIR)obj_hooks \
$(EXECUTE_DIR)exit_prog \
$(EXECUTE_DIR)init_prog \
$(EXECUTE_DIR)init_scene \
$(EXECUTE_DIR)init_vars \
$(EXECUTE_DIR)vec3_1 \
$(EXECUTE_DIR)vec3_2 \
$(EXECUTE_DIR)matrix \
$(EXECUTE_DIR)viewport \
$(EXECUTE_DIR)ray \
$(EXECUTE_DIR)ray_sp_pl \
$(EXECUTE_DIR)ray_cy_body \
$(EXECUTE_DIR)ray_cy_circle \
$(EXECUTE_DIR)light \
$(EXECUTE_DIR)rgb
SRCS = $(addsuffix .c, $(FILES))
OBJS = $(addsuffix .o, $(FILES))
%.o: %.c $(PARSE_INCS_DIR) $(EXECUTE_INCS_DIR)
@$(CC) $(CFLAGS) -c $< -o $@ -I$(PARSE_INCS_DIR) -I$(EXECUTE_INCS_DIR)
all: $(LIBFT_NAME) $(NAME)
$(LIBFT_NAME):
@make -C $(LIBFT_DIR)
@echo "$(YELLOW)🐥 libft compiled! 🐥$(RESET)"
$(NAME): $(MLX) $(OBJS) $(LIBFT)
$(CC) $(CFLAGS) $^ -o $@ -I$(PARSE_INCS_DIR) -I$(EXECUTE_INCS_DIR) -L$(MLX_DIR) -lmlx $(MLX_FLAGS)
@echo "$(YELLOW)🐥 miniRT compiled! 🐥$(RESET)"
$(MLX):
chmod 775 $(MLX_DIR)/configure
@make -C $(MLX_DIR)
@echo "$(YELLOW)🐥 mlx compiled! 🐥$(RESET)"
clean:
@make clean -C $(LIBFT_DIR)
@echo "$(YELLOW)🐥 deleted object files for libft 🐥$(RESET)"
@make clean -C $(MLX_DIR)
@echo "$(YELLOW)🐥 deleted object files for mlx 🐥$(RESET)"
@$(RM) $(OBJS)
@echo "$(YELLOW)🐥 deleted object files for miniRT 🐥$(RESET)"
fclean: clean
make fclean -C $(LIBFT_DIR)
@echo "$(YELLOW)🐥 deleted libft executable 🐥$(RESET)"
$(RM) $(NAME)
@echo "$(YELLOW)🐥 deleted miniRT executable 🐥$(RESET)"
re: fclean all
.PHONY: all, clean, fclean, re