-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (50 loc) · 1.21 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
NAME = so_long
CC = gcc
FLAGS = -Wall -Wextra -Werror
MLX = mlx/Makefile.gen
LFT = libft/libft.a
INC = -I ./inc -I ./libft -I ./mlx
LIB = -L ./libft -lft -L ./mlx -lmlx -lXext -lX11 -lm -lbsd
OBJ = $(patsubst src%, obj%, $(SRC:.c=.o))
SRC = src/die.c \
src/draw.c \
src/event.c \
src/game_destroy.c \
src/game_init.c \
src/map_height.c \
src/map_init.c \
src/map_isvalid.c \
src/map_parsing.c \
src/map_read.c \
src/map_width.c \
src/mlx_utils.c \
src/move_player.c \
src/root_destroy.c \
src/root_init.c \
src/so_long.c \
src/update.c
all: $(MLX) $(LFT) obj $(NAME)
$(NAME): $(OBJ)
$(CC) $(FLAGS) -fsanitize=address -o $@ $^ $(LIB)
$(MLX):
@echo " [ .. ] | Compiling minilibx.."
@make -s -C mlx
@echo " [ OK ] | Minilibx ready!"
$(LFT):
@echo " [ .. ] | Compiling libft.."
@make -s -C libft
@echo " [ OK ] | Libft ready!"
obj:
@mkdir -p obj
obj/%.o: src/%.c
$(CC) $(FLAGS) $(INC) -o $@ -c $<
clean:
@make -s $@ -C libft
@rm -rf $(OBJ) obj
@echo "object files removed."
fclean: clean
@make -s $@ -C libft
@rm -rf $(NAME)
@echo "binary file removed."
re: fclean all
.PHONY: all clean fclean re