-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (109 loc) · 3.34 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hthomas <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/11/27 13:45:08 by hthomas #+# #+# #
# Updated: 2022/02/08 11:09:24 by hthomas ### ########.fr #
# #
# **************************************************************************** #
NAME = miniRT
INCLDIR = includes/
SRCDIR = srcs/
LIB = lib/
SRCFILES= color.c \
error.c \
intersect_cylinders.c \
intersect_planes.c \
intersect_spheres.c \
intersect_squares.c \
intersect_triangles.c \
main.c \
make_img.c \
parse.c \
ray.c \
save_bmp.c \
set_elements.c \
set_elements2.c \
utils.c \
vector.c \
INCLFILES= basics.h \
elements.h minirt.h \
mlx.h \
parse.h \
scene.h \
SRCS = $(addprefix $(SRCDIR), $(SRCFILES))
OBJS = $(SRCS:.c=.o)
INCLS = $(addprefix $(INCLDIR), $(INCLFILES))
CC = gcc -g
RM = rm -f
CFLAGS = -I $(INCLDIR) -DTHREADS=$(THREADS) -Wall -Wextra -fsanitize=address -g3#-Werror -Ofast
FLAGS = -L $(LIB)libft -lft -L $(LIB)libmlx -lmlx
MACOS_MACRO = -DMACOS
LINUX_MACRO = -DLINUX
MACOS_FLAGS = -framework OpenGL -framework AppKit
LINUX_FLAGS = -lm -lX11 -lXext -lpthread
UNAME := $(shell uname)
ifeq ($(UNAME),Darwin)
THREADS = $(shell sysctl -n hw.ncpu)
CFLAGS += $(MACOS_MACRO)
FLAGS += $(MACOS_FLAGS)
endif
ifeq ($(UNAME),Linux)
THREADS = $(shell nproc --all)
CFLAGS += $(LINUX_MACRO)
FLAGS += $(LINUX_FLAGS)
endif
$(NAME) : compilelibft compilelibmlx $(OBJS) $(INCLS)
$(CC) $(CFLAGS) $(OBJS) $(FLAGS) -o $(NAME)
compilelibft :
make -C $(LIB)libft all
compilelibmlx :
make -C $(LIB)libmlx all
%.o: %.c $(INCLS)
$(CC) $(CFLAGS) -c -I $(INCLDIR) -o $@ $<
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
run: $(NAME)
./$< scenes/test.rt
run_scene: $(NAME)
./$< scenes/$(filter-out $@, $(MAKECMDGOALS)).rt
run_save: $(NAME)
./$< scenes/test.rt -save
run_all: $(NAME)
./$< scenes/90spheres.rt &
./$< scenes/circle.rt &
./$< scenes/cylinder.rt &
./$< scenes/default.rt &
./$< scenes/example.rt &
./$< scenes/gradient.rt &
./$< scenes/mollecules.rt &
./$< scenes/peach.rt &
./$< scenes/square.rt &
./$< scenes/triangle.rt &
./$< scenes/test.rt
# ###########################
# --BLACK_FG = \033[38;5;0m
# --RED_FG = \033[38;5;196m
# --REDL_FG = \033[1;31m
# --GREEN_FG = \033[38;5;46m
# --CYAN_FG = \033[0;36m
# --YELLOW_FG = \033[1;33m
# --BLACK_BG = \033[48;5;0m
# --BLUE_BG = \033[48;5;39m
# --PINK_BG = \033[48;5;213m
# --YELLOW_BG = \033[48;5;11m
# --RANLIB_BG = \033[48;5;172m
# --GREEN_BG = \033[48;5;46m
# --CLEAR_COLOR = \033[m
# ###########################