-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (83 loc) · 2.74 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vhaefeli <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/11/21 11:31:44 by jleroux #+# #+# #
# Updated: 2022/12/21 14:46:42 by jleroux ### ########.fr #
# #
# **************************************************************************** #
NAME := cub3D
LIBS := m ft mlx
LIBS_TARGET := lib/libft/libft.a \
lib/minilibx_opengl_20191021/libmlx.a \
INCS := include \
lib/libft/include \
lib/minilibx_opengl_20191021/ \
SRC_DIR := src
SRCS := $(SRC_DIR)/main.c \
$(SRC_DIR)/parsing.c \
$(SRC_DIR)/textures.c \
$(SRC_DIR)/paths.c \
$(SRC_DIR)/map.c \
$(SRC_DIR)/map_check.c \
$(SRC_DIR)/camera.c \
$(SRC_DIR)/minimap.c \
$(SRC_DIR)/move.c \
$(SRC_DIR)/turn.c \
$(SRC_DIR)/render.c \
$(SRC_DIR)/draw3d.c \
$(SRC_DIR)/anim.c \
$(SRC_DIR)/raycasting1.c \
$(SRC_DIR)/raycasting2.c \
$(SRC_DIR)/hooks.c \
$(SRC_DIR)/vector2d.c \
$(SRC_DIR)/line.c \
$(SRC_DIR)/rgb.c \
$(SRC_DIR)/gnl.c \
$(SRC_DIR)/error.c \
CC := gcc
CFLAGS := -Wall -Wextra -Werror
CPPFLAGS := $(addprefix -I,$(INCS)) -MMD -MP -O2 #-fsanitize=address -g
LDFLAGS := $(addprefix -L,$(dir $(LIBS_TARGET)))
LDLIBS := $(addprefix -l,$(LIBS)) -framework OpenGL -framework Appkit
RM := rm -rf
MAKEFLAGS += --no-print-directory #--silent
all: $(NAME)
debug: run
ifeq ($(MAKECMDGOALS), debug)
CFLAGS += -g3 -DDEBUG
BUILD = debug
else
CFLAGS += -O3 -DNDEBUG
BUILD = release
endif
BUILD_DIR := .build/$(BUILD)
OBJS := $(SRCS:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
$(NAME): $(OBJS) $(LIBS_TARGET)
@$(CC) -o $(NAME) $(CPPFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
$(LIBS_TARGET):
@$(MAKE) -C $(@D)
$(BUILD_DIR):
@mkdir -p $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
-include $(DEPS)
clean:
@$(MAKE) -C lib/libft clean
@$(RM) $(BUILD_DIR)
fclean: clean
@$(MAKE) -C lib/libft fclean
@$(MAKE) -C lib/minilibx_opengl_20191021 clean
@$(RM) $(NAME)
re:
@$(MAKE) fclean
@$(MAKE) all
run: all
@-./$(NAME) maps/test.cub
noel: all
@-./$(NAME) maps/noel.cub
.PHONY: all clean fclean re debug release