-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
74 lines (51 loc) · 1.34 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
NAME = cub3D
S = src/
O = obj/
I = inc/
LIBFT_I = libft/includes
CC = cc
CFLAGS = -Wall -Werror -Wextra
INCLUDES = -I$I -I$(LIBFT_I) -Iinclude -I./MLX42/include
LIBRARIES = -L./libft -lft -lglfw -L"/Users/$(USER)/.brew/opt/glfw/lib/" -L./build/ -lmlx42
MAC_LIB = -L./libft -lft -lglfw -L "/opt/homebrew/Cellar/glfw/3.3.8/lib" -L./build/ -lmlx42
FSANITIZE =
AR = ar
ARFLAGS = rcs
SRC = \
$S/main.c $S/utils.c $S/map.c $S/param_utils.c $S/checker_functions.c $S/rendering.c $S/color_texture_functions.c $S/controller.c $S/orientation.c $S/ray.c $S/textures.c
OBJ = $(SRC:$S%=$O%.o)
RM = /bin/rm -f
RMDIR = /bin/rm -rf
LIBFT_DIR = ./libft
LIBFT = $(LIBFT_DIR)/libft.a
LIBFT_FLAGS =
.PHONY: all clean fclean re
all: $(NAME)
$O:
@mkdir $@
$(OBJ): | $O
$(OBJ): $O%.o: $S%
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(NAME): $(LIBFT) $(OBJ)
cmake -B build MLX42
cmake --build build -j4
$(CC) $(OBJ) $(LIBRARIES) $(FSANITIZE) -o $(NAME)
$(LIBFT):
make FLAGS=$(LIBFT_FLAGS) -C $(LIBFT_DIR)
cleanobjdir: $O
$(RMDIR) $O
clean: cleanobjdir
fclean: clean
make fclean -C libft
$(RM) $(NAME)
re:
@make fclean
@make all
run_test: $(LIBFT)
make CUB3D="$(SRC)" -C test
debug: CFLAGS := $(filter-out -O3,$(CFLAGS))
debug: CFLAGS += -g
debug: LIBFT_FLAGS += -g
debug: $(NAME)
what: FSANITIZE += -fsanitize=address -g
what: $(NAME)