-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (38 loc) · 1.33 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
NAME = cub3d
SRC = main.c parser/arr.c parser/input_data.c parser/parser.c parser/get_identifier.c parser/get_map.c parser/validate_map.c \
parser/check_player.c parser/set_color.c parser/set_textures.c parser/utils.c raycaster/cub3d.c raycaster/raycast.c \
raycaster/math_utils.c raycaster/raycast_utils.c raycaster/drawing_rays.c
# CFLAGS = -Wall -Wextra -Werror
CFLAGS = -Wall -Wextra -Werror -fsanitize=address
SAN_LDFLAGS = -L../LeakSanitizer -llsan -lc++ -Wno-gnu-include-next -I ../LeakSanitize
OBJ_DIR = obj
OBJ = $(SRC:%.c=$(OBJ_DIR)/%.o)
LIBFT = ./lib/libft/libft.a
MLX42 = ./lib/MLX42/libmlx42.a
GL_FLAGS = -lglfw -L "$(shell brew --prefix glfw)/lib/"
PINK = \033[1;95m
GREEN = \033[1;92m
RESET := \033[0m
all: $(NAME)
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)
@mkdir -p $(OBJ_DIR)/parser
@mkdir -p $(OBJ_DIR)/raycaster
$(NAME): $(LIBFT) $(MLX42) $(OBJ_DIR) $(OBJ)
@cc $(CFLAGS) $(OBJ) $(LIBFT) $(MLX42) $(GL_FLAGS) $(SAN_LDFLAGS) -o $(NAME)
@printf "$(PINK)[Cub3d] Compiled successfuly!!! :D $(RESET)\n"
$(LIBFT):
@make -C ./lib/libft
$(MLX42):
@make -C ./lib/MLX42
$(OBJ_DIR)/%.o: %.c
@cc $(CFLAGS) -c $< -o $@
clean:
@printf "$(GREEN)Cleaning cub3d$(RESET)\n"
@/bin/rm -rf $(OBJ_DIR)
fclean: clean
@/bin/rm -f $(NAME) $(BONUS)
@make fclean -C lib/libft
@make fclean -C lib/MLX42
re: fclean all
.PHONY: all clean fclean re