-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (35 loc) · 929 Bytes
/
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
NAME = fdf
CC = gcc
CFLAGS = -Wall -Wextra -Werror
LIBFT = libs/libft/libft.a
LIB_DEPS = $(shell ls libft/*.c$)
MLX1 = libs/minilibx/libmlx.a
MLX2 = libs/minilibx_macos/libmlx.a
TO_LINK = ft mlx m
LINK = -Llibs/libft -Llibs/minilibx $(foreach LIB,$(TO_LINK), -l$(LIB))
HEADERS = $(wildcard includes/*.h$)
SRCS = $(shell ls srcs/*.c$)
OBJS = $(notdir $(SRCS:.c=.o))
all: $(NAME)
$(NAME): $(OBJS) $(MLX1) $(MLX2)
$(CC) .objs/*.o $(LINK) -framework OpenGL -framework AppKit -o $@
$(LIBFT): $(LIBFT_DEPS)
make -C libs/libft
$(MLX1):
make -C libs/minilibx
$(MLX2):
make -C libs/minilibx_macos
$(OBJS): $(SRCS) $(HEADERS) $(LIBFT)
$(CC) $(CFLAGS) -Iincludes -c $(shell find . -name $(notdir $(@:.o=.c))) -o .objs/$@
.PHONY : clean fclean re print
print :
@echo $(OBJS)
clean :
rm -f libs/libft/*\.o$
rm -f .objs/*\.o$
fclean : clean
rm -f $(LIBFT)
rm -f $(NAME)
rm -f $(MLX1)
rm -f $(MLX2)
re : fclean all