-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (57 loc) · 2.58 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: zhlim <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/07/09 15:22:50 by zhlim #+# #+# #
# Updated: 2023/07/24 16:45:01 by zhlim ### ########.fr #
# #
# **************************************************************************** #
SRC = so_long.c validate_map.c initialize_mlx.c error_handling.c save_as_grid.c lines_check.c path_check.c key_hook.c destroy_images.c
SRCGNL = $(addprefix libft/get_next_line/, $(addsuffix .c, get_next_line get_next_line_utils))
SRCB = $(addprefix bonus/, $(addsuffix _bonus.c, so_long validate_map initialize_mlx error_handling save_as_grid lines_check \
path_check key_hook render load_sprite load_images generate_enemy load_dead move_enemy destroy_images put_images))
OBJ = $(patsubst %.c,%.o,$(SRC))
OBJGNL = $(patsubst %.c,%.o,$(SRCGNL))
OBJB = $(patsubst %.c,%.o,$(SRCB))
CC = gcc
CFLAGS = -Wall -Werror -Wextra
# -g3 -fsanitize=address
RM = rm -f
INCLUDES = -Ift_printf/include/ -Ilibft/get_next_line/ -Ilibft/ -I.
# -Imlx
NAME = so_long
NAMEB = so_long_bonus
LIBFT = libft/libft.a
LIBFTFLAGS = -Llibft/ -lft
LIBPRINTF = libft/ft_printf/libftprintf.a
LIBPRINTFFLAGS = -Llibft/ft_printf -lftprintf
LIBMLXFLAGS = -lmlx -framework OpenGL -framework AppKit
# -Lmlx
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
all: $(NAME)
bonus: $(NAMEB)
$(NAME): $(OBJ) $(OBJGNL)
$(CC) $(CFLAGS) $^ $(LIBFTFLAGS) $(LIBPRINTFFLAGS) $(LIBMLXFLAGS) -o $@
$(NAMEB): $(OBJB) $(OBJGNL)
$(CC) $(CFLAGS) $^ $(LIBFTFLAGS) $(LIBPRINTFFLAGS) $(LIBMLXFLAGS) -o $@
$(OBJ): $(LIBPRINTF) $(LIBFT)
$(OBJB): $(LIBPRINTF) $(LIBFT)
$(LIBFT):
make -C libft/
$(LIBPRINTF):
make -C libft/ft_printf/
clean:
$(RM) $(OBJ) $(OBJGNL) $(OBJB)
make clean -C libft/
make clean -C libft/ft_printf/
fclean: clean
$(RM) $(NAME) $(NAMEB)
make fclean -C libft/
make fclean -C libft/ft_printf/
re: fclean all
rebonus: fclean bonus
.PHONY: all clean fclean rebonus