-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·81 lines (48 loc) · 1.53 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
NAME = cub3D
LINUXNAME = cub3DL
CC = gcc
ERR_FLAGS = -Wall -Wextra -Werror
LIB_FLAGS = -rcs
DEBUG_FLAGS = -g -fsanitize=address
CUB3DLIB = libcub3d.a
LINUXFLAGS = -lbsd -lmlx -lXext -lX11 -lm
MACFLAGS = -Llibs/macopengl/ -lmlx -framework OpenGL -framework AppKit -lm
DEP_FLAGS = -I. -Ilibs/libft/libft
LIBFT = libs/libft/libft.a
SRC0 = $(wildcard validate_stg/*.c)
DST0 = $(SRC0:.c=.o)
SRC1 = $(wildcard render_game/*.c)
DST1 = $(SRC1:.c=.o)
SRC2 = $(wildcard game_helpers/*.c)
DST2 = $(SRC2:.c=.o)
all : libft mac
macr : mac
./cub3D maps/map.cub
mac : libft mlx $(NAME)
linuxr : linuxr
./cub3D maps/map.cub
linux : libft $(LINUXNAME)
mlx :
cd libs/macopengl && $(MAKE)
$(NAME) : $(CUB3DLIB)
$(CC) $(ERR_FLAGS) $(DEBUG_FLAGS) cub3d.c $(CUB3DLIB) $(LIBFT) $(MACFLAGS) $(DEP_FLAGS) -o $(NAME)
$(LINUXNAME): $(CUB3DLIB)
$(CC) $(ERR_FLAGS) $(DEBUG_FLAGS) cub3d.c $(CUB3DLIB) $(LIBFT) $(LINUXFLAGS) $(DEP_FLAGS) -o $(NAME)
$(CUB3DLIB) : $(DST0) $(DST1) $(DST2)
ar $(LIB_FLAGS) $@ $^
libft:
cd libs/libft && $(MAKE)
validate_stg/%.o : validate_stg/%.c cub3d.h
$(CC) $(ERR_FLAGS) $(DEBUG_FLAGS) -c $(DEP_FLAGS) $< -o $@
render_game/%.o : render_game/%.c cub3d.h
$(CC) $(ERR_FLAGS) $(DEBUG_FLAGS) -c $(DEP_FLAGS) $< -o $@
game_helpers/%.o : game_helpers/%.c cub3d.h
$(CC) $(ERR_FLAGS) $(DEBUG_FLAGS) -c $(DEP_FLAGS) $< -o $@
clean :
rm -f $(DST0) $(DST1) $(DST2)
fclean : clean
rm -rf $(NAME) $(CUB3DLIB) $(MACNAME) *.dSYM
cd libs/libft && make fclean
cd libs/macopengl && make clean
re : fclean all
.PHONY : all clean fclean re