-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (51 loc) · 1.88 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
OBJS_DIR = bin
SRCS_DIR = srcs
INCL_DIR = includes
LIBFT_DIR = libft
MLX_DIR = mlx
CC = gcc
CFLAGS = -Wall -Werror -Wextra
INCLUDES = -I$(INCL_DIR) -I$(LIBFT_DIR) -I$(MLX_DIR)
LIBS = -L$(LIBFT_DIR) -lft -L$(MLX_DIR) -lmlx -lz -framework OpenGL -framework AppKit
LIBFT = $(LIBFT_DIR)/libft.a
MLX = $(MLX_DIR)/libmlx.a
HEAD_NAME = miniRT.h
HEADERS := $(patsubst %.h, $(INCL_DIR)/%.h, $(HEAD_NAME))
SRCS_NAME = miniRT.c conf.c camera.c vector.c vector_op.c vector_mv_op.c \
intersect_pl-sp.c intersect_cy-co.c compute.c img.c utils.c \
color.c thread.c thread_routines.c matrix.c matrix_op.c matrix_det.c \
transform.c uv.c texture.c bump.c viewport.c \
mat.c loader.c parse_texture.c parse_obj.c parse_tag.c parse_type.c parse_utils.c\
parse_light.c token.c helper.c error.c
SRCS := $(patsubst %.c, $(SRCS_DIR)/%.c, $(SRCS_NAME))
OBJS := $(patsubst $(SRCS_DIR)/%.c, $(OBJS_DIR)/%.o, $(SRCS))
NAME = miniRT
#-------------------------------------------------------------------------------------------------#
all: update $(NAME)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $(LIBS) -o $(NAME) $(OBJS)
update:
@make -sC $(LIBFT_DIR)
@make -sC $(MLX_DIR)
#-------------------------------------------------------------------------------------------------#
$(OBJS_DIR)/%.o: $(SRCS_DIR)/%.c $(HEADERS) | bin
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $< -c
bin:
mkdir -p $@
#-------------------------------------------------------------------------------------------------#
norm:
@norminette $(LIBFT_DIR)
@norminette $(INCL_DIR)
@norminette $(SRCS_DIR)
leaks:
leaks --atExit -- ./$(NAME)
re: fclean all
clean:
@make -sC $(LIBFT_DIR) clean
@echo "cleaned libft"
$(RM) $(OBJS)
fclean: clean
@make -sC $(LIBFT_DIR) fclean
@echo "fcleaned libft"
$(RM) $(NAME)
.PHONY: all clean fclean re update leaks