-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
89 lines (70 loc) · 2.74 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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: ksmorozo <[email protected]> +#+ #
# +#+ #
# Created: 2021/02/24 11:23:42 by ksmorozo #+# #+# #
# Updated: 2021/07/22 16:27:34 by ksmorozo ######## odam.nl #
# #
# **************************************************************************** #
NAME = cub3D
SRC_FILE = main.c \
get_next_line/get_next_line.c \
CHECKER_DIR = checker/
CHECKER_SRC_FILE = check_map.c check_resolution.c \
check_rgb.c check_cub_file.c \
check_arguments.c \
check_texture.c check_map_utils.c \
ft_error.c
INIT_DIR = initialiser/
INIT_SRC_FILE = init_sprite_struct.c init_config_struct.c \
init_wall_struct.c init_ray_struct.c \
init_player_struct.c handle_textures.c
GRAPHICS_DIR = graphics/
GRAPHICS_SRC_FILE = draw_sprite.c \
draw_sprite_utils.c drawing_utils.c \
draw_minimap.c draw_floor_ceiling.c \
handle_image.c
PARSER_DIR = parser/
PARSER_SRC_FILE = parser.c parse_texture.c \
parse_ceiling_floor.c
GAME_ENGINE_DIR = game_engine/
GAME_ENGINE_SRC_FILE = update_player.c cast_rays.c \
cast_rays_utils.c event_handlers.c
FREEING_DIR = freeing/
FREEING_SRC_FILE = free_everything.c
MINILIBX_DIR = mlx/
MINILIBX = libmlx.dylib
LIBFT_DIR = libft/
LIBFT = libft.a
OBJ = $(SRC_FILE:.c=.o) \
$(addprefix $(CHECKER_DIR), $(CHECKER_SRC_FILE:.c=.o)) \
$(addprefix $(INIT_DIR), $(INIT_SRC_FILE:.c=.o)) \
$(addprefix $(GRAPHICS_DIR), $(GRAPHICS_SRC_FILE:.c=.o)) \
$(addprefix $(PARSER_DIR), $(PARSER_SRC_FILE:.c=.o)) \
$(addprefix $(GAME_ENGINE_DIR), $(GAME_ENGINE_SRC_FILE:.c=.o)) \
$(addprefix $(FREEING_DIR), $(FREEING_SRC_FILE:.c=.o))
HEADER = cub3d.h
CFLAGS = -g -Wall -Wextra -Werror
all: $(NAME)
$(NAME): $(OBJ)
@echo "\033[92mMaking MLX\033[0m"
@make -C $(MINILIBX_DIR)
@echo "\033[92mMaking Libft\033[0m"
@make -C $(LIBFT_DIR)
gcc $(CFLAGS) $(OBJ) $(LIBFT_DIR)$(LIBFT) -Lmlx -lmlx -framework OpenGL -framework AppKit -o $(NAME)
@echo "\033[92mCompiled\033[0m"
@cp -rf $(MINILIBX_DIR)$(MINILIBX) .
%.o: %.c $(HEADER)
gcc $(CFLAGS) -c $< -o $@
bonus: $(NAME)
clean:
rm -f $(OBJ) $(MINILIBX)
make clean -C $(MINILIBX_DIR)
make clean -C $(LIBFT_DIR)
fclean: clean
rm -f $(NAME) $(MINILIBX_DIR)$(MINILIBX)
rm -f $(LIBFT) $(LIBFT_DIR)$(LIBFT)
re: fclean all