-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (63 loc) · 1.57 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
NAME = miniRT
HEAD = includes
SRCDIR = srcs/
LIB = lib/
FILES = minirt.c \
parsing.c \
parse_info.c \
parse_elements.c \
parse_compound_elements.c \
multithreading.c \
camera.c \
sphere_intersection.c \
plane_intersection.c \
cylinder_intersection.c \
compound_intersections.c \
concerning_light.c \
sample_pixel.c \
supersampling.c \
bmp_exporter.c \
color_operations.c \
procedural_textures.c \
rainbow.c \
error_handling.c \
parsing_utils.c \
parsing_utils2.c \
utils.c \
utils2.c \
SRCS = $(addprefix $(SRCDIR), $(FILES))
OBJS = ${SRCS:.c=.o}
CC = gcc -g
RM = rm -f
CFLAGS = -Wall -Wextra -Werror -I $(HEAD) -D NUM_THREADS=$(NUM_THREADS)
FLAGS = -L $(LIB)libft -lft -L $(LIB)libvector -lvct
MACOS_MACRO = -D MACOS
LINUX_MACRO = -D LINUX
MACOS_FLAGS = -L $(LIB)minilibx_opengl_20191021 -lmlx -framework OpenGL -framework AppKit
LINUX_FLAGS = -L $(LIB)minilibx-linux -lmlx -lm -lX11 -lXext -lpthread
UNAME := $(shell uname)
ifeq ($(UNAME),Darwin)
NUM_THREADS = $(shell sysctl -n hw.ncpu)
CFLAGS += $(MACOS_MACRO)
FLAGS += $(MACOS_FLAGS)
endif
ifeq ($(UNAME),Linux)
NUM_THREADS = $(shell nproc --all)
CFLAGS += $(LINUX_MACRO)
FLAGS += $(LINUX_FLAGS)
endif
${NAME}: ${OBJS}
make -C $(LIB)libft
make -C $(LIB)libvector
${CC} ${CFLAGS} $(OBJS) $(FLAGS) -o ${NAME}
all: ${NAME}
clean:
make clean -C $(LIB)libft
make clean -C $(LIB)libvector
${RM} ${OBJS}
fclean: clean
make fclean -C $(LIB)libft
make fclean -C $(LIB)libvector
${RM} ${NAME}
re: fclean all
PHONY: all clean fclean re