-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (100 loc) · 3.57 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
117
118
119
120
121
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: anarebelo <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/02/21 23:13:52 by anarebelo #+# #+# #
# Updated: 2023/02/21 23:50:44 by anarebelo ### ########.fr #
# #
# **************************************************************************** #
# NAME
# **************************************************************************** #
NAME = so_long
NAME2 = so_long_bonus
# FILES
# **************************************************************************** #
SRCS = gnl/get_next_line.c\
gnl/get_next_line_utils.c\
map/matrix.c\
map/ft_strnjoin_2.c\
map/read_map.c\
imgs/imgs.c\
imgs/imgs_player.c\
hooks/key_hook.c\
hooks/exit_hook.c\
hooks/terminate_game.c\
hooks/keycode.c\
hooks/utils.c\
so_long.c\
initial_img.c
SRCS_BONUS = gnl/get_next_line_bonus.c\
gnl/get_next_line_utils_bonus.c\
map/matrix_bonus.c\
map/read_map_bonus.c\
map/ft_strnjoin_2_bonus.c\
imgs/imgs_bonus.c\
imgs/imgs_player_bonus.c\
imgs/imgs_enemy_bonus.c\
hooks/key_hook_bonus.c\
hooks/exit_hook_bonus.c\
hooks/utils_bonus.c\
hooks/keycode_bonus.c\
hooks/terminate_game_bonus.c\
sprites/move_enemy_bonus.c\
sprites/animate_enemy_bonus.c\
so_long_bonus.c\
initial_img_bonus.c
OBJS =${addprefix ${OBJS_DIR}, ${SRCS:.c=.o}}
OBJS_BONUS =${addprefix ${OBJS_DIR}, ${SRCS_BONUS:.c=.o}}
DEPS =${addprefix ${OBJS_DIR}, ${SRCS:.c=.d}}
DEPS_BONUS =${addprefix ${OBJS_DIR}, ${SRCS_BONUS:.c=.d}}
# DIRECTORY
# **************************************************************************** #
OBJS_DIR = objs/
SRCS_DIR = srcs/
SRCS_BONUS_DIR = srcs_bonus/
LIBFT_DIR = libft/
# LIBRARIES
# **************************************************************************** #
INCLUDE = -I includes -I ${LIBFT_DIR}inc -I mlx
LIBS_EXEC = $(LIBFT_DIR)libft.a
LIBS_EXEC += ./mlx/libmlx.a
LIB = -L./mlx/ -lmlx -framework OpenGL -framework AppKit -L./libft/ -lft
# COMPILATION
# **************************************************************************** #
LINK = gcc
CC = gcc -c
DEPFLAGS = -MMD -MP
CFLAGS = -Wall -Wextra -Werror
RM = rm -rf
# RULES
# **************************************************************************** #
all: update ${NAME}
$(OBJS_DIR)%.o: $(SRCS_DIR)%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDE) $< -o $@
$(OBJS_DIR)%.o: $(SRCS_BONUS_DIR)%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDE) $< -o $@
${NAME}: ${OBJS}
${LINK} ${CFLAGS} $(INCLUDE) ${OBJS} ${LIB} -o ${NAME}
update:
@$(MAKE) -C ./mlx
@$(MAKE) -C ./libft
bonus: update ${NAME2}
${NAME2}: ${OBJS_BONUS}
${LINK} ${CFLAGS} $(INCLUDE) ${OBJS_BONUS} ${LIB} -o ${NAME2}
clean:
@${RM} ${OBJS_DIR}
@$(MAKE) -C ./libft clean
@$(MAKE) -C ./mlx clean
fclean: clean
@${RM} ${NAME}
@${RM} ${NAME2}
@$(MAKE) -C ./libft fclean
re: fclean all
-include ${DEPS}
-include ${DEPS_BONUS}
.PHONY: all clean fclean re bonus