-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (78 loc) · 2.03 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
NAME = miniRT
CC = gcc -g
FLAGS = -Wall -Wextra -Werror
RM = rm -rf
ifdef DEBUG
FLAGS += -g
endif
SRC_DIR = src/
OBJ_DIR = obj/
_SRC = main.c\
vec3/div.c\
vec3/mult.c\
vec3/reflection.c\
vec3/sub.c\
vec3/sum.c\
vec3/utils.c\
engine/rays.c\
engine/camera_geometry.c\
engine/colors.c\
engine/light_model.c\
engine/maths.c\
engine/hooks.c\
parser/colors.c\
parser/coordinates.c\
parser/o_ambient_lights.c\
parser/o_camera.c\
parser/o_cylinder.c\
parser/o_sphere.c\
parser/o_plane.c\
parser/o_light.c\
parser/parser_errors.c\
parser/parser_utils.c\
parser/parser_frees.c\
parser/parser_scene.c\
objects/o_cylinder.c\
objects/o_sphere.c\
objects/o_plane.c
SRC_FOLDERS = obj/parser\
obj/engine\
obj/objects\
obj/vec3
SRC = ${addprefix ${SRC_DIR}, ${_SRC}}
OBJ = ${patsubst ${SRC_DIR}%.c, ${OBJ_DIR}%.o, ${SRC}}
LIBS = ${LIBFT_DIR}/libft.a ${MLX_DIR}/libmlx42.a -ldl -lglfw -pthread -lm
LIBFT_DIR = libft
MLX_DIR = MLX42
INCLUDES = -I ./include -I ./${LIBFT_DIR}/include -I ./${MLX_DIR}/include/MLX42
SYS = $(shell uname -s)
ifeq ($(SYS), Darwin)
# INCLUDES += -I /opt/vagrant/embedded/include
# LIBS += -L/opt/vagrant/embedded/lib
LIBS += -L"/Users/$(USER)/.brew/opt/glfw/lib/"
endif
${NAME}: ${OBJ}
@echo "Compiling $(NAME)..."
@echo "Compiling dependencies..."
@$(MAKE) -s all -C $(LIBFT_DIR)
@$(MAKE) -s all -C $(MLX_DIR)
@$(CC) $(INCLUDES) $(OBJ) -o $(NAME) $(LIBS)
@echo "$(NAME) compiled!"
${OBJ_DIR}%.o: ${SRC_DIR}%.c
@git submodule update --init
@mkdir -p ${OBJ_DIR}
@mkdir -p ${SRC_FOLDERS}
@${CC} ${FLAGS} ${INCLUDES} -c $^ -o $@
all: ${NAME} ${LIBFT} ${MLX}
clean:
@echo "Removing files..."
@echo "Removing dependencies..."
@$(MAKE) -s clean -C $(LIBFT_DIR)
@$(MAKE) -s clean -C $(MLX_DIR)
@${RM} ${OBJ}
fclean: clean
@${RM} ${NAME}
@$(MAKE) -s fclean -C $(LIBFT_DIR)
@$(MAKE) -s fclean -C $(MLX_DIR)
re: fclean all
.PHONY: all clean fclean re bonus