-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (48 loc) · 1.3 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
SRC_FILES = main.c \
0_memory_management/init.c \
0_memory_management/free.c \
1_parsing/check_content.c \
1_parsing/check_map.c \
1_parsing/parse_map.c \
1_parsing/parse_file.c \
1_parsing/utils.c \
2_game_dynamics/controls_1.c \
2_game_dynamics/controls_2.c \
2_game_dynamics/draw_game.c \
2_game_dynamics/draw_minimap.c \
2_game_dynamics/raycaster.c \
2_game_dynamics/utils.c \
OBJ_FILES = $(SRC_FILES:.c=.o)
NAME = cub3d
CUB3D_LIB = libcub3d.a
LIBFT_LIB = libft.a
MLX_LIB = libmlx.a
CC = gcc
INCLUDE = -lmlx -framework OpenGL -framework AppKit
CFLAGS = -Wall -Werror -Wextra
all: $(NAME)
$(NAME): $(OBJ_FILES)
@$(MAKE) -s -C libft
@cp libft/libft.a .
@$(MAKE) -s -C mlx
cp mlx/$(MLX_LIB) $(MLX_LIB)
@$(MAKE) -s -C get_next_line
cp get_next_line/libgnl.a $(CUB3D_LIB)
ar -rcs $(CUB3D_LIB) $^
$(CC) $(CFLAGS) main.c $(LIBFT_LIB) $(CUB3D_LIB) $(INCLUDE) -o $(NAME)
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
clean:
rm -rf $(OBJ_FILES)
$(MAKE) clean -C get_next_line
$(MAKE) clean -C libft
$(MAKE) clean -C mlx
fclean: clean
rm -rf $(NAME)
rm -rf $(CUB3D_LIB)
rm -rf $(MLX_LIB)
rm -rf $(LIBFT_LIB)
$(MAKE) fclean -C get_next_line
$(MAKE) fclean -C libft
re: fclean all
.PHONY: all clean fclean re