-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
114 lines (76 loc) · 1.96 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
105
106
107
108
109
110
111
112
113
114
NAME = so_long
NAME_B = so_long_bonus
HEADER = so_long.h
FLAGS = -Wall -Wextra -Werror
SRCS = counter.c\
ft_printf.c\
listener.c\
map_init.c\
put_pixel.c\
ft_itoa.c\
close_window.c\
init.c\
move.c\
tools.c\
draw.c\
SRCS_B = animation.c\
close_window.c\
counter.c\
draw.c\
ft_itoa.c\
ft_printf.c\
init.c\
listener.c\
load_images.c\
locate.c\
map_init.c\
move.c\
put_pixel.c\
tools.c\
CC = gcc
FD_S = srcs/
FD_O = objs/
FD_B = bonus/
FD_O_B = objs_b/
OBJS = ${SRCS:.c=.o}
OBJS_B = ${SRCS_B:.c=.o}
SRCS_WD = $(addprefix ${FD_S}, ${SRCS})
OBJS_WD = $(addprefix ${FD_O}, ${OBJS})
SRCS_B_WD = $(addprefix ${FD_B}, ${SRCS_B})
OBJS_B_WD = $(addprefix ${FD_O_B}, ${OBJS_B})
MLX_INCL = ./mlx/libmlx.a
MLX_MAKE = make -C $(dir $(MLX_INCL))
# $(NAME): $(OBJ)
# $(CC) $(OBJ) -Lmlx -lmlx -framework OpenGL -framework AppKit -o $(NAME)
COMPILER = ${CC} objectfiles -framework OpenGL -framework AppKit -I. $(MLX_INCL)
COMPILERS = ${CC} $(FLAGS) -Imlx
all: lib $(FD_O) $(FD_O_B) $(NAME)
$(MLX_INCL):
${MLX_MAKE} all
lib: $(MLX_INCL)
$(FD_O):
mkdir $(FD_O)
$(FD_O_B):
mkdir $(FD_O_B)
$(NAME): ${FD_O}main.o ${OBJS_WD} ${HEADER}
$(COMPILER:objectfiles=$(OBJS_WD) ${FD_O}main.o) -o $(NAME)
$(NAME_B): ${FD_O_B}main.o ${OBJS_B_WD} ${HEADER}
$(COMPILER:objectfiles=$(OBJS_B_WD) ${FD_O_B}main.o) -o $(NAME_B)
clean:
${MLX_MAKE} clean
rm -rf ${FD_O}main.o $(FD_O_B)main.o ${OBJS_WD} ${OBJS_B_WD}
fclean:
${MLX_MAKE} clean
rm -rf ${FD_O}main.o $(FD_O_B)main.0 ${OBJS_WD} ${OBJS_B_WD} ${NAME} ${NAME_B}
${FD_O}%.o: ${FD_S}%.c ${HEADER}
$(COMPILERS) -c $< -o $@
${FD_O}%.o: %.c ${HEADER}
$(COMPILERS) -c $< -o $@
${FD_O_B}%.o: ${FD_B}%.c ${HEADER}
$(COMPILERS) -c $< -o $@
${FD_O_B}%.o: %.c ${HEADER}
$(COMPILERS) -c $< -o $@
re: fclean all
bonus: lib $(FD_O_B) $(NAME_B)
.PHONY: all re clean fclean bonus
# $(CC) $(OBJ) -Lmlx_linux -lmlx_Linux -L/usr/lib -Imlx_linux -lXext -lX11 -lm -lz -o $(NAME)