-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (119 loc) · 3.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
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
138
139
140
141
142
143
144
145
NAME = miniRT
CC = gcc
# CFLAGS = -Wall -Wextra -Werror -fsanitize=address -g
CFLAGS = -Wall -Wextra -Werror -g
DFLAGS = -MMD -MP
SRCDIR = srcs
SRCS = $(SRCDIR)/affine_rotation.c \
$(SRCDIR)/bright_color_clc1.c \
$(SRCDIR)/color_img.c \
$(SRCDIR)/conf_validation.c \
$(SRCDIR)/fmt_checker_camera.c \
$(SRCDIR)/fmt_checker_cylinder.c \
$(SRCDIR)/fmt_checker_light.c \
$(SRCDIR)/fmt_checker_plane.c \
$(SRCDIR)/fmt_checker_sphere.c \
$(SRCDIR)/fmt_checker_cone.c \
$(SRCDIR)/fmt_checker_triangle.c \
$(SRCDIR)/get_color_with_at.c \
$(SRCDIR)/get_from_split.c \
$(SRCDIR)/get_lights.c \
$(SRCDIR)/get_objects.c \
$(SRCDIR)/get_objects2.c \
$(SRCDIR)/get_ref.c \
$(SRCDIR)/has_valid_format.c \
$(SRCDIR)/identifers.c \
$(SRCDIR)/img_color_clc1.c \
$(SRCDIR)/is_valid_contens.c \
$(SRCDIR)/is_valid_orientation_vector.c \
$(SRCDIR)/is_valid_rgb_in_range.c \
$(SRCDIR)/lightsource.c \
$(SRCDIR)/lightsource_spotlight.c \
$(SRCDIR)/main.c \
$(SRCDIR)/make_instance.c \
$(SRCDIR)/make_instance2.c \
$(SRCDIR)/new_obj.c \
$(SRCDIR)/obj_cylinder.c \
$(SRCDIR)/obj_plane.c \
$(SRCDIR)/obj_rect.c \
$(SRCDIR)/obj_sphere.c \
$(SRCDIR)/obj_cone.c \
$(SRCDIR)/obj_triangle.c \
$(SRCDIR)/parse_file.c \
$(SRCDIR)/parse_line.c \
$(SRCDIR)/put_error.c \
$(SRCDIR)/set_event.c \
$(SRCDIR)/set_rotation_matrix.c \
$(SRCDIR)/utils.c \
$(SRCDIR)/utils2.c \
$(SRCDIR)/vec_clc1.c \
$(SRCDIR)/vec_clc2.c \
$(SRCDIR)/vec_clc3.c \
$(SRCDIR)/vec_clc4.c
OBJDIR = ./objs
LIBFTDIR = ./libft
LIBFT = $(LIBFTDIR)/libft.a
OBJ := $(patsubst $(SRCDIR)%, $(OBJDIR)%, $(SRCS:%.c=%.o))
DEPENDS := $(patsubst $(SRCDIR)%, $(OBJDIR)%, $(SRCS:%.c=%.d))
# for online
# mac
# LIBXDIR = ./minilibx
# LIBMLX = ./minilibx/libmlx.a
# LIBMLXFLAGS = -framework OpenGL -framework AppKit
# linux
# LIBXDIR = ./minilibx-linux
# LIBMLX = $(LIBXDIR)/libmlx.a
# LIBMLXFLAGS = -lXext -lX11
# CFLAGS += -lm
# for online
# INCLUDES = -I./includes -I./libft/includes -I./minilibx-linux
# for offline
INCLUDES = -I./includes -I./libft/includes
all: $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
-mkdir -p $(@D)
$(CC) $(CFLAGS) $(DFLAGS) $(INCLUDES) -c $< -o $@
%.o: %.c
-mkdir -p $(@D)
$(CC) $(CFLAGS) $(DFLAGS) $(INCLUDES) -c $< -o $@
# for online
# $(NAME): $(LIBFT) $(LIBMLX) $(OBJ)
# $(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(LIBMLX) $(INCLUDES) $(LIBMLXFLAGS) -lm -o $@
# for offline
$(NAME): $(LIBFT) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(INCLUDES) -L/usr/X11R6/lib -lmlx -lX11 -lXext -framework OpenGL -framework AppKit -o $@
$(LIBFT): FORCE
make -C ./$(LIBFTDIR)
FORCE:
# for online
# $(LIBMLX):
# make -C $(LIBXDIR)
clean:
rm -f $(OBJ) $(DEPENDS)
make clean -C $(LIBFTDIR)
# for online
# clean:
# rm -f $(OBJ) $(DEPENDS)
# make clean -C $(LIBFTDIR)
# make clean -C $(LIBXDIR)
fclean: clean
rm -f $(NAME)
make fclean -C $(LIBFTDIR)
NAME_DEBUG = debugfile
CFLAGS_DEBUG = -g
$(NAME_DEBUG): $(LIBFT) $(LIBMLX) $(OBJ)
@printf "$(GREEN)"
$(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(INCLUDES) -L/usr/X11R6/lib -lmlx -lX11 -lXext -framework OpenGL -framework AppKi -o $@
@printf "$(RESET)"
# for online
# $(NAME_DEBUG): $(LIBFT) $(LIBMLX) $(OBJ)
# @printf "$(GREEN)"
# $(CC) $(CFLAGS) $(OBJ) $(LIBFT) $(LIBMLX) $(INCLUDES) $(LIBMLXFLAGS) -lm -o $@
# @printf "$(RESET)"
debug: CFLAGS += $(CFLAGS_DEBUG)
debug: $(NAME_DEBUG)
re: fclean all
.PHONY: all clean fclean re FORCE
norm:
norminette
-include $(DEPENDS)