-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (68 loc) · 2.33 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ldufour <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/10/19 11:01:10 by ldufour #+# #+# #
# Updated: 2023/11/17 07:55:26 by ldufour ### ########.fr #
# #
# **************************************************************************** #
NAME = so_long
CFLAGS := -Wall -Wextra -Werror -Wunreachable-code -Ofast
LIBMLX := ./lib/MLX42
HEADERS := -I ./include -I $(LIBMLX)/include
LIBS := $(LIBMLX)/build/libmlx42.a -ldl -lglfw -pthread -L"/Users/$(USER)/.brew/opt/glfw/lib/"
SRCS := src/errors.c \
src/flood_fill.c \
src/images.c \
src/main.c \
src/map_display.c \
src/map_parsing.c \
src/maps.c \
src/textures.c
MAPS := maps/.bigmap.ber \
maps/empty.ber \
maps/invalid_char.ber \
maps/invalid_char2.ber \
maps/invalid_name..ber \
maps/invalid_path.ber \
maps/invalid_path2.ber \
maps/invalid_path3.ber \
maps/invalid_wall.ber \
maps/invalid_wall2.ber \
maps/invalid_wall_rectangle.ber \
maps/invalid_wall_rectangle2.ber \
maps/valid.ber \
maps/valid2.ber
OBJS = ${SRCS:.c=.o}
LIBFT = libft/libft.a
VALGRIND = valgrind
all: libmlx $(NAME)
libmlx:
@cmake $(LIBMLX) -B $(LIBMLX)/build && make -C $(LIBMLX)/build -j4
%.o: %.c
@$(CC) $(CFLAGS) -o $@ -c $< $(HEADERS)
$(NAME): $(OBJS)
cd libft && make
$(CC) $(OBJS) $(LIBFT) $(LIBS) $(HEADERS) -o $(NAME)
clean:
@cd libft && make clean
@rm -rf $(OBJS)
@rm -rf $(LIBMLX)/build
fclean: clean
@cd libft && make fclean
rm -f $(NAME)
test: all
@for file in $(MAPS); do \
echo "Testing $$file"; \
./$(NAME) $$file; \
done
vg: all
@for file in $(MAPS); do \
echo "Testing $$file"; \
$(VALGRIND) ./$(NAME) $$file; \
done
re: fclean all
.PHONY: all, clean, fclean, re, libmlx