-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (80 loc) · 2.6 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jrocha-v <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/05/25 10:36:01 by jrocha-v #+# #+# #
# Updated: 2024/06/06 18:30:49 by jrocha-v ### ########.fr #
# #
# **************************************************************************** #
NAME = cub3d
SRCS_DIR = src
OBJS_DIR = objs
INCLUDES = includes
LIBFT = ./libs/libft/libft.a
LIBFT_DIR = ./libs/libft
LIBMLX = ./libs/minilibx-linux/libmlx.a
LIBMLX_DIR = ./libs/minilibx-linux
CC = cc
CFLAGS = -Wall -Wextra -Werror
MLX_FLAGS = -lmlx_Linux -lXext -lX11 -lm -lbsd
MK_FLAG = --no-print-directory
RM = rm -rf
SRCS = parser/free_mem.c \
parser/map_checkers_1.c \
parser/map_checkers_2.c \
parser/map_creators.c \
parser/map_parameters_checker.c \
parser/parser.c \
parser/player_utils.c \
parser/printers.c \
parser/rgb_getter.c \
parser/struct_init.c \
parser/textures_geter.c \
main.c \
init.c \
events.c \
player.c \
player_move.c \
minimap.c \
raycast.c \
raycast_dda.c \
render.c \
draw_utils.c \
utils.c \
error.c
# Substitute .c with .o
OBJS = $(SRCS:%.c=$(OBJS_DIR)/%.o)
#default target
all: $(NAME)
$(NAME): $(OBJS) $(LIBFT) $(LIBMLX)
$(CC) $(CFLAGS) $(OBJS) -L$(LIBMLX_DIR) $(MLX_FLAGS) $(LIBFT) -o $(NAME)
echo "Finished!"
#create .o files
$(OBJS_DIR)/%.o: $(SRCS_DIR)/%.c
mkdir -p $(@D)
$(CC) -I $(INCLUDES) $(CFLAGS) -c $< -o $@
$(LIBFT):
echo "Compiling necessary libs..."
$(MAKE) $(MK_FLAG) -C $(LIBFT_DIR)
$(LIBMLX):
echo "Compiling necessary libs..."
$(MAKE) $(MK_FLAG) -C $(LIBMLX_DIR)
#remove .o files
clean:
$(RM) $(OBJS_DIR)
$(MAKE) clean -C $(LIBFT_DIR)
$(MAKE) clean -C $(LIBMLX_DIR)
fclean: clean
$(RM) $(NAME) $(LIBFT) $(LIBMLX)
#reset - remove and recompile
re: fclean
$(MAKE) all
download:
@ wget https://cdn.intra.42.fr/document/document/22624/minilibx-linux.tgz
@ tar -xzf minilibx-linux.tgz -C libs
@ rm minilibx-linux.tgz
.PHONY: all clean fclean re
.SILENT: