-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (47 loc) · 1.05 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
NAME = cub3D
HEADER = ./includes/
SRCS = cub3d.c\
parse.c\
map_parse.c\
get_configs.c\
map_validate.c\
init.c\
deal_key.c\
exit_cube.c\
cast_rays.c\
fill.c\
init_textures.c\
sprite.c\
utils.c\
bitmap.c
OBJSDIR = ./objs
SRCSDIR = ./srcs
HDRDIR = ./includes
MLXDIR = ./minilibx_opengl
LIBFTDIR = ./libft
LIBFT = $(LIBFTDIR)libft.a
MLX = $(MLXDIR)libmlx.a
CC = gcc
FLAGS = -Wall -Werror -Wextra -g
OBJS = $(addprefix $(OBJSDIR)/,$(SRCS:.c=.o))
all: libs $(NAME)
$(OBJSDIR)/%.o: $(SRCSDIR)/%.c $(HEADER)
@$(CC) $(FLAGS) -I $(HDRDIR) -I $(LIBFTDIR) -I $(MLXDIR) -c $< -o $@
libs:
@make bonus -C $(LIBFTDIR)
@make -C $(MLXDIR)
$(NAME): $(OBJSDIR) $(OBJS)
$(CC) -L$(MLXDIR) -lmlx -framework OpenGL -framework AppKit -lz -L$(LIBFTDIR) -lft $(OBJS) -o $(NAME)
$(OBJSDIR):
@mkdir -p $(OBJSDIR)
bonus: $(NAME)
clean:
rm -f $(OBJS)
rm -rf $(OBJSDIR)
make clean -C $(LIBFTDIR)
fclean: clean
rm -f $(NAME)
make fclean -C $(LIBFTDIR)
make clean -C $(MLXDIR)
re: fclean all
.PHONY: all bonus clean fclean re