-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
103 lines (85 loc) · 2.67 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lschrafs <[email protected]. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/06/25 11:16:12 by lschrafs #+# #+# #
# Updated: 2022/09/13 13:03:39 by lschrafs ### ########.fr #
# #
# **************************************************************************** #
NAME = cub3D
COMPILER = cc
CFLAGS = -Wall -Wextra -Werror
MYLIBS = libft/libft.a
LIBS = -lm
SRCS_PATH = ./src/
EXIT = exit/
HOOKS = hooks/
INIT = init/
MOVE = move/
RENDER = render/
UTILS = utils/
SRCS_NAMES = main \
$(EXIT)exit \
$(EXIT)free \
$(HOOKS)keyhooks \
$(HOOKS)mousehooks \
$(HOOKS)open_door \
$(HOOKS)others \
$(INIT)check_map_init_player \
$(INIT)init \
$(INIT)parse_map_file \
$(INIT)parse_map_properties \
$(INIT)parse_map_tiles \
$(INIT)parse_map_floor_ceiling \
$(INIT)parse_map_wall1 \
$(INIT)parse_map_wall2 \
$(INIT)player_init \
$(MOVE)move \
$(MOVE)translate \
$(RENDER)draw \
$(RENDER)raycast \
$(RENDER)render_minimap \
$(RENDER)render_pov \
$(RENDER)render_scene \
$(UTILS)hashtable1 \
$(UTILS)hashtable2 \
$(UTILS)math \
$(UTILS)utils_parse \
$(UTILS)utils_general1 \
$(UTILS)utils_general2 \
$(UTILS)utils_rendering \
OS = $(shell uname)
ifeq ($(OS), Linux)
LIBS += -lmlx -lX11 -lXext
SRCS_NAMES += $(EXIT)destroy_linux
endif
ifeq ($(OS), Darwin)
LIBS += mlx/libmlx.a -L./mlx/ -lmlx -framework OpenGL -framework AppKit
SRCS_NAMES += $(EXIT)destroy_mac
endif
OBJS_PATH = ./obj/
OBJS_NAMES = $(SRCS_NAMES:%=%.o)
OBJS = $(addprefix $(OBJS_PATH), $(OBJS_NAMES))
ALL_DIRS = $(EXIT) $(HOOKS) $(INIT) $(MOVE) $(RENDER) $(UTILS)
DIRS_PATHS = $(addprefix $(OBJS_PATH), $(ALL_DIRS))
all: $(NAME)
$(NAME): $(OBJS) $(MYLIBS)
$(COMPILER) $(CFLAGS) $(OBJS) $(MYLIBS) $(LIBS) -o $@
$(OBJS_PATH)%.o: $(SRCS_PATH)%.c
mkdir -p $(OBJS_PATH)
mkdir -p $(DIRS_PATHS)
$(COMPILER) $(CFLAGS) -c $< -o $@
$(MYLIBS): FORCE
make -C $(dir $@)
FORCE: ;
clean:
rm -rf $(OBJS_PATH)
@make -C libft clean
fclean: clean
rm -f $(NAME)
@make -C libft fclean
re: fclean all
bonus: all