-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (62 loc) · 2.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
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: djoyke <[email protected]> +#+ #
# +#+ #
# Created: 2023/05/20 15:38:33 by djoyke #+# #+# #
# Updated: 2024/05/02 18:30:49 by dliu ######## odam.nl #
# #
# **************************************************************************** #
NAME = cub3D
CC = cc
CFLAGS = -Wall -Werror -Wextra -Ofast -O3 #-g -fsanitize=address
LIBFTDIR = LIBFT
LIBFT = $(LIBFTDIR)/libft.a
MLXDIR = MLX42
MLX42 = $(MLXDIR)/build/libmlx42.a
HEADERS = -I include -I $(MLXDIR)/include -I $(LIBFTDIR)/include
INCL = -ldl -lglfw -pthread -lm
VPATH = ./src ./src/utils ./src/parse .src/maths ./src/game ./src/render ./src/bonus
LIBS = $(MLX42) $(LIBFT) $(INCL)
SRC = main.c \
parse.c _parse_info.c _parse_grid.c _verify_grid.c \
start.c render.c raycast.c move.c \
draw_utils.c vector_utils.c math_utils.c
OBJ = $(addprefix $(OBJDIR)/, $(SRC:.c=.o))
OBJDIR = obj
BONUS = cub3d_bonus
SRC_B = main.c \
parse.c _parse_info.c _parse_grid.c _verify_grid.c \
bonus_start.c bonus_move.c bonus_minimap.c\
render.c raycast.c \
draw_utils.c vector_utils.c math_utils.c
OBJDIR_B = obj_bonus
OBJ_B = $(addprefix $(OBJDIR_B)/, $(SRC_B:.c=.o))
all: $(NAME)
bonus: $(LIBFT) $(MLX42) $(OBJ_B)
$(CC) $(CFLAGS) $(OBJ_B) $(LIBS) $(HEADERS_B) -o $(BONUS)
$(NAME): $(LIBFT) $(MLX42) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(LIBS) $(HEADERS) -o $(NAME)
$(MLX42):
@cmake $(MLXDIR) -B $(MLXDIR)/build && make -C $(MLXDIR)/build -j4
$(LIBFT):
@make -s -C $(LIBFTDIR)
$(OBJ): $(OBJDIR)/%.o : %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $^ $(HEADERS)
$(OBJ_B): $(OBJDIR_B)/%.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $^ $(HEADERS)
clean:
@make -s clean -C $(LIBFTDIR)
@rm -rf $(OBJDIR)
@rm -rf $(OBJDIR_B)
@rm -rf $(MLXDIR)/build
fclean: clean
@make -s fclean -C $(LIBFTDIR)
@rm -f $(NAME)
@rm -f $(BONUS)
re: fclean all
.PHONY: all bonus clean fclean re