-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
116 lines (91 loc) · 2.95 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
112
113
114
115
116
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: juramos <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/09/15 16:43:25 by juramos #+# #+# #
# Updated: 2024/09/19 13:53:01 by juramos ### ########.fr #
# #
# **************************************************************************** #
# Name
NAME = cub3d
# Compiler
CC = gcc
CFLAGS = -Wall -Werror -Wextra -g3 #-fsanitize=address
# Sources
SRC_DIR = src/
SRC_FILES = main init_player utils parse raycasting render \
clean_init game_loop movement key_hooks textures \
raycasting_utils render_utils parse_checks \
parse_checks_2 parse_getters parse_arr_helpers \
parse_tools
SRC = $(addprefix $(SRC_DIR), $(addsuffix .c, $(SRC_FILES)))
# Objects
OBJ_DIR = obj/
OBJ_DIRS = $(sort $(dir $(OBJ)))
OBJ = $(addprefix $(OBJ_DIR), $(addsuffix .o, $(SRC_FILES)))
# libft
LIBFT_PATH = libft/
LIBFT_NAME = libft.a
LIBFT = $(LIBFT_PATH)$(LIBFT_NAME)
# Mlx
MLX_PATH = minilibx-linux/
MLX_NAME = libmlx.a
MLX = $(MLX_PATH)$(MLX_NAME)
# build path
# B_PATH = build/
# Includes
INC_MS = -I includes/ \
-I ./minilibx-linux
# Colors
DEF_COLOR = \033[0;39m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
# Config
OBJF = .cache_exists
MAKEFLAGS += --no-print-directory
.SILENT:
###
all: $(MLX) $(LIBFT) $(NAME)
$(OBJ_DIR)%.o: $(SRC_DIR)%.c | $(OBJF)
@echo "$(WHITE)Compiling ${notdir $<} in $(SRC_DIR)"
@$(CC) $(CFLAGS) $(INC_MS) $(INC) -c $< -o $@
$(OBJF):
@mkdir -p $(OBJ_DIR)
@mkdir -p $(OBJ_DIRS)
$(NAME): $(OBJ)
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LIBFT) $(MLX) $(INC) -lXext -lX11 -lm
@echo "$(GREEN)cub3d compiled!$(DEF_COLOR)"
# $(B_PATH):
# @mkdir $(B_PATH)
libft:
@make -sC $(LIBFT_PATH)
$(LIBFT):
@echo "Making libft..."
@make -sC $(LIBFT_PATH)
$(MLX):
@echo "Making mlx..."
@make -sC $(MLX_PATH)
clean:
@rm -rf $(OBJ_DIR)
@rm -rf $(B_PATH)
@make clean -sC $(LIBFT_PATH)
@make clean -sC $(MLX_PATH)
@echo "$(BLUE)cub3d object files cleaned!$(DEF_COLOR)"
fclean: clean
@rm -f $(NAME)
@make fclean -sC $(LIBFT_PATH)
@echo "$(CYAN)cub3d executable files cleaned!$(DEF_COLOR)"
re: fclean all
@echo "$(GREEN)Cleaned and rebuilt everything for cub3d!$(DEF_COLOR)"
norm:
@norminette $(SRC) | grep -v Norme -B1 || true
.PHONY: all clean fclean re norm libft