-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (44 loc) · 1.68 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
NAME = scop
CC = clang
CFLAGS = -Wall -Wextra -Werror -O3 -fsanitize=address
HEADERS_DIR = ./includes
SRCS_DIR = ./srcs
OBJS_DIR = ./objs
HEADERS = scop.h typedefs.h stb_image.h
HEADERS := $(addprefix $(HEADERS_DIR)/, $(HEADERS))
SRCS = main.c gl_context.c loop.c create_shader_program.c
SRCS += register_events.c handle_exit.c handle_keyboard.c parse_obj_fd.c
SRCS += handle_dropfile.c init_data.c clear_data.c load_model.c
SRCS += generate_data.c cross.c norm.c dot.c parse_mtl.c trackball.c
SRCS += m_view.c m_projection.c quaternion.c matrix.c create_skybox.c
SRCS += render_scene.c render_model.c handle_mouse.c render_skybox.c
OBJS = $(SRCS:.c=.o)
LIBFT = libft.a
LIBFT_DIR = ./libft
LIBFT_INCL = $(LIBFT_DIR)/includes/
INCLUDES = -I $(HEADERS_DIR) -I $(LIBFT_INCL)
LIBRARIES = -L. -lft -lSDL2 -lGL -lGLEW
TO_LINKING = $(addprefix $(OBJS_DIR)/, $(OBJS)) $(INCLUDES) $(LIBRARIES)
SUB_DIR = shaders events scene math render
VPATH = $(SRCS_DIR) $(addprefix $(SRCS_DIR)/, $(SUB_DIR)) $(OBJS_DIR)
.PHONY: all build clean fclean re
all :
$(MAKE) -j8 build -s
build : $(NAME)
$(NAME) : $(LIBFT) $(OBJS_DIR) $(OBJS) $(HEADERS)
@$(CC) $(CFLAGS) -o $(NAME) $(TO_LINKING)
@printf "\n\e[38;5;46m%-40s SUCCESSFUL BUILD 🖥\e[0m\n" ./$(NAME)
$(LIBFT) :
+$(MAKE) -C $(LIBFT_DIR) build
cp $(LIBFT_DIR)/$(LIBFT) .
$(OBJS_DIR) :
mkdir $(OBJS_DIR)
$(OBJS) : %.o : %.c
@$(CC) $(CFLAGS) -c $< -o $(OBJS_DIR)/$@ $(INCLUDES)
@printf "%-40s \e[38;5;49mcompiled\e[0m\n" $<
clean :
rm -rf $(OBJS_DIR)
fclean : clean
rm -f $(LIBFT)
rm -f $(NAME)
re : fclean all