-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (49 loc) · 1.43 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
NAME = miniRT
CC = cc
CFLAGS = -Wall -Werror -Wextra -g #-fsanitize=thread
SRC_DIR = src
INC_DIR = inc
OBJ_DIR = build
# COLORS #
GREEN = "\033[0;32m"
WHITE = "\033[0m"
# LIBFT #
LIBFT_DIR = libft
LIBFT = libft/libft.a
LIBFT_FLAGS = -L$(LIBFT_DIR) -lft
# MINILIBX #
MLX_DIR = minilibx-linux
MLX = minilibx-linux/libmlx.a
MLX_FLAGS = -L$(MLX_DIR) -lmlx -L/usr/lib -lXext -lX11 -lm -lz
INC_FLAGS = -I$(INC_DIR) -I$(MLX_DIR) -I$(LIBFT_DIR)/inc
SRC_FILES = main.c \
calculus/vector_math.c calculus/lights.c \
utils/validate.c utils/mlx_setup.c utils/utils.c \
parsing/data.c parsing/parser.c parsing/sphere.c parsing/plane.c parsing/cylinder.c \
viewport.c \
cleanup/cleanup1.c cleanup/cleanup2.c \
intersections/sp_intersection.c intersections/pl_intersection.c intersections/cy_intersection.c intersections/intersection.c\
debug.c
SRCS = $(addprefix $(SRC_DIR)/, $(SRC_FILES))
OBJS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
$(NAME) : $(MLX) $(LIBFT) $(OBJS)
@echo "Compiling $@"
@$(CC) $(OBJS) $(CFLAGS) $(MLX_FLAGS) $(LIBFT_FLAGS) $(INC_FLAGS) -o $@
@echo $(GREEN)"Done!"$(WHITE)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
@echo "Compiling $<"
@$(CC) $(CFLAGS) $(INC_FLAGS) -c $< -o $@
$(LIBFT):
@make -C $(LIBFT_DIR)
$(MLX):
@make -C $(MLX_DIR)
all: $(NAME)
clean:
@rm -rf $(OBJ_DIR)
@make -C $(LIBFT_DIR) clean
fclean: clean
@rm -f $(NAME)
@make -C $(LIBFT_DIR) fclean
re: fclean all
.PHONY: all clean fclean re