forked from sinryuji/cub3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (100 loc) · 3.07 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: kanghyki <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/12/01 15:23:01 by kanghyki #+# #+# #
# Updated: 2022/12/14 13:05:52 by kanghyki ### ########.fr #
# #
# **************************************************************************** #
#---------------[ COLOR ]-----------------
COMPILE_COLOR = "\033[1;34m"
BUILD_COLOR = "\033[1;32m"
MODE_COLOR = "\033[1;35m"
DEL_COLOR = "\033[1;31m"
END = "\033[0;0m"
CLEAR = "\x1b[1A\x1b[M"
#---------------[ LIBCC ]-----------------
LIB_DIR = lib
#---------------[ LIBFT ]-----------------
LIBFT_DIR = $(LIB_DIR)/libft
LIBFT = $(LIBFT_DIR)/libft.a
LIBFT_INC = $(LIBFT_DIR)/inc
#---------------[ mlx ]-------------------
MLX_DIR = $(LIB_DIR)/mlx
MLX = $(MLX_DIR)/libmlx.a
MLX_INC = $(MLX_DIR)/inc
#---------------[ CUB3D ]-----------------
NAME = cub3D
SRC_INC = inc
SRC_DIR = src
SRC = main.c\
raycast_01.c\
raycast_02.c\
key_hook.c\
key_move.c\
key_rotate.c\
key_door.c\
mouse_hook.c\
minimap.c\
hud.c\
texture.c\
error.c\
util_01.c\
util_02.c\
parse_01.c\
parse_02.c\
parse_03.c\
parse_04.c\
set_dir.c\
validation_surround_map.c\
shoot_pistol.c
OBJ_DIR = obj
OBJ = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
#----------------[ CMD ]------------------
CC = gcc
CPPFLAGS = -I $(SRC_INC)\
-I $(LIBFT_DIR)
ifndef DEBUG
CFLAGS = -Wall -Wextra -Werror
else
CFLAGS = -g -Wall -Wextra -Werror
endif
LDLIBS = -l ft -L $(LIBFT_DIR)\
-l mlx -L $(MLX_DIR) -framework OpenGL -framework AppKit
RM = rm -rf
vpath %.c $(SRC_DIR)
all: $(NAME)
$(OBJ_DIR)/%.o: %.c
@echo $(COMPILE_COLOR) "💾 [$<] Compiling..." $(END)
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@echo $(COMPILE_COLOR) "✨ [$@] was created" $(END)
$(NAME): $(MLX) $(LIBFT) $(OBJ_DIR) $(OBJ)
@echo $(BUILD_COLOR) "🔨 [$@] Building..." $(END)
@$(CC) $(LDLIBS) $(CFLAGS) $(OBJ) -o $(NAME)
@echo $(BUILD_COLOR) "🎉 [$@] was created" $(END)
$(LIBFT):
@make -C $(LIBFT_DIR)
$(OBJ_DIR):
@mkdir $(OBJ_DIR)
$(MLX):
@make -C $(MLX_DIR)
clean:
@make clean -C $(MLX_DIR)
@make clean -C $(LIBFT_DIR)
@$(RM) $(OBJ) $(OBJ_DIR)
@echo $(DEL_COLOR) "🧹 [Object files] were removed" $(END)
fclean: clean
@make fclean -C $(LIBFT_DIR)
@$(RM) $(NAME)
@echo $(DEL_COLOR) "🧹 [$(NAME)] were removed" $(END)
re:
@make fclean
@make all
debug: fclean
@make DEBUG=1 all
fsani: fclean
@make FSANI=1 all
.PHONY: all clean fclean re debug