-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (68 loc) · 2.26 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: abouchau <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/02/05 16:42:52 by abouchau #+# #+# #
# Updated: 2020/10/05 13:17:02 by chpl ### ########.fr #
# #
# **************************************************************************** #
NAME = cub3d
LIBFT = libft
OS = $(shell uname)
DIR_S = srcs
INCLUDES = -I includes/ -I libft/ -I $(MLX_DIR) -I get_next_line/
CC = clang
CFLAGS = -O3 -Wall -Wextra -Werror
LIBS = -L libft/ -lft ${MLX_LNK} -lm
GNLBUFF = -D BUFFER_SIZE=100
SOURCES = srcs/move_cam.c \
srcs/parse_map.c \
srcs/parse_camera.c \
srcs/ray_casting.c \
srcs/sprites.c \
srcs/hooks.c \
srcs/dda.c \
srcs/draw.c \
srcs/parse_color.c \
srcs/parse_main.c \
srcs/parse_utils.c \
srcs/flood_fill.c \
srcs/screenshot.c \
srcs/exit.c \
srcs/error.c \
srcs/cub3d.c
OBJS = ${SOURCES:.c=.o}
ifeq ($(OS), Linux)
MLX_DIR = linux/minilibx-linux/
MLX_LNK = -L ${MLX_DIR} -lmlx -lXext -lX11 -lbsd
SOURCES += linux/get_next_line.c
else
MLX_DIR = osx/minilibx_opengl
MLX_LNK = -L ${MLX_DIR} -lmlx -framework OpenGL -framework AppKit
SOURCES += osx/get_next_line.c
endif
.c.o:
${CC} ${CFLAGS} ${GNLBUFF} -c $< -o ${<:.c=.o} ${INCLUDES}
all : $(NAME)
${NAME}: ${OBJS} ft mlx
${CC} ${CFLAGS} ${INCLUDES} ${OBJS} ${LIBS} -o ${NAME}
mlx:
@make -C $(MLX_DIR)
ft:
@make -C libft
$(DIR_O)/%.o: $(DIR_S)/%.c $(HEADER)/*.h
@mkdir -p objs
@$(CC) $(CFLAGS) -I $(HEADER) -o $@ -c $<
clean :
@rm -f $(OBJS)
@make clean -C $(LIBFT)
@make clean -C $(MLX_DIR)
fclean: clean
@rm -f $(NAME)
@make fclean -C $(LIBFT)
@make clean -C $(MLX_DIR)
re: fclean all
.PHONY: clean fclean all re mlx ft