-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (57 loc) · 2.54 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: seroy <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/01/06 17:07:16 by seroy #+# #+# #
# Updated: 2023/03/15 14:16:14 by seroy ### ########.fr #
# #
# **************************************************************************** #
#Library Name ----------------------------
NAME = so_long
NAME_BONUS = so_long_bonus
#Dependencies -----------------------------
LIBFT = libft
#Command variables ------------------------
CC = gcc
CFLAGS = -Wall -Wextra -Werror -g
MK = mkdir -p
RM = rm -rf
USER = $(shell whoami)
MLX42 = -framework Cocoa -framework OpenGL -framework IOKit MLX42/build/libmlx42.a -lglfw -L"/Users/$(USER)/.brew/opt/glfw/lib"
#Sources directories
INCDIR = inc
SRCDIR = src
LIBFT_A = libft.a
LIBFTDIR = libft
LIBFT = $(addprefix $(LIBFTDIR)/, $(LIBFT_A))
SRC = parsing.c flood_fill.c utils.c main.c render_map.c player_move.c keyhook.c load_img.c initiate.c free.c idle_img.c enemy.c enemy_move.c game_over.c putstring.c error.c
SRCB = parsing_bonus.c flood_fill_bonus.c utils_bonus.c main_bonus.c render_map_bonus.c player_move_bonus.c keyhook_bonus.c load_img_bonus.c initiate_bonus.c free_bonus.c idle_img_bonus.c enemy_bonus.c enemy_move_bonus.c game_over_bonus.c putstring_bonus.c error_bonus.c
VPATH = ${SRCDIR}
#Object directories
OBJDIR = obj
OBJS = $(addprefix ${OBJDIR}/, ${SRC:%.c=%.o})
OBJSB = $(addprefix ${OBJDIR}/, ${SRCB:%.c=%.o})
all: $(NAME)
${OBJDIR}/%.o : %.c
${CC} ${FLAGS} -I${INCDIR} -Ilibft/inc -Imlx42 -c $< -o $@
$(NAME): $(OBJDIR) $(OBJS)
make -C $(LIBFTDIR)
$(CC) ${FLAGS} $(MLX42) $(OBJS) -L$(dir $(LIBFT)) -lft -o $(NAME)
$(OBJDIR):
$(MK) $(OBJDIR)
$(NAME_BONUS): $(OBJDIR) $(OBJSB)
make -C $(LIBFTDIR)
$(CC) ${FLAGS} $(MLX42) $(OBJSB) -L$(dir $(LIBFT)) -lft -o $(NAME_BONUS)
bonus: $(NAME_BONUS)
clean:
$(RM) $(OBJDIR)
make -C $(LIBFTDIR) clean
fclean: clean
$(RM) $(NAME) $(NAME_BONUS)
make -C $(LIBFTDIR) fclean
re: fclean all
.PHONY:
clean fclean re bonus all