-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
119 lines (95 loc) · 3.33 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
#******************************************************************************#
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: broggo <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/07/07 13:56:12 by broggo #+# #+# #
# Updated: 2019/10/06 22:46:48 by sbecker ### ########.fr #
# #
#******************************************************************************#
NAME := RT
SRC_DIR := ./srcs
INC_DIR := ./includes
OBJ_DIR := ./obj
JC_DIR := ./obj/rt_jtoc
LIB_DIR := ./libft
IMG_DIR := ./images
CC := gcc
CFLAGS := -Wall -Wextra -Werror -g -fsanitize=address
SRC := main.c \
check_key_0.c \
check_key_1.c \
check_key_2.c \
check_mouse_0.c \
check_mouse_1.c \
kernel.c \
float3_0.c \
float3_1.c \
cam_and_screen.c \
get_textures.c \
gpu_mem.c \
release_gpu_mem.c \
rt_jtoc/rt_jtoc_utilits.c \
rt_jtoc/rt_jtoc_get_textures.c \
rt_jtoc/rt_jtoc_scene_setup.c \
rt_jtoc/rt_jtoc_get_camera.c \
rt_jtoc/rt_jtoc_get_objects.c \
rt_jtoc/rt_jtoc_get_object_params.c \
rt_jtoc/rt_jtoc_get_extraordinary_obj.c \
rt_jtoc/rt_jtoc_get_basic_obj.c \
rt_jtoc/rt_jtoc_get_lights.c \
rt_jtoc/rt_jtoc_get_effects.c \
rt_jtoc/rt_jtoc_mouse_setup.c \
SRCS := $(addprefix $(SRC_DIR)/, $(SRC))
OBJ := $(SRC:.c=.o)
OBJS := $(addprefix $(OBJ_DIR)/, $(OBJ))
FT := ./libft/
FT_LIB := $(addprefix $(FT),libft.a)
FT_INC := -I ./libft/includes
FT_LNK := -L ./libft -l ft
CL := ./libcl/
CL_LIB := $(addprefix $(FT),libcl.a)
CL_INC := -I ./libcl/include
CL_LNK := -L ./libcl -l cl
JC := ./libjtoc/
JC_LIB := $(addprefix $(JC),libjtoc.a)
JC_INC := -I ./libjtoc/include
JC_LNK := -L ./libjtoc -l jtoc
MLX := ./minilibx
MLX_LIB := $(addprefix $(MLX),libmlx.a)
MLX_INC := -I ./minilibx
MLX_LNK := -L ./minilibx -l mlx -framework OpenGL -framework AppKit
all: dirs $(MLX_LIB) $(FT_LIB) $(CL_LIB) $(JC_LIB) $(OBJ_DIR) $(IMG_DIR) $(NAME)
$(FT_LIB):
make -C $(FT)
$(MLX_LIB):
make -C $(MLX)
$(JC_LIB):
make -C $(JC)
$(CL_LIB):
make -C $(CL)
dirs: $(OBJ_DIR) $(JC_DIR)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(JC_DIR):
mkdir -p $(JC_DIR)
$(IMG_DIR):
mkdir -p $(IMG_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -I $(INC_DIR) $(FT_INC) $(CL_INC) $(MLX_INC) $(JC_INC) -o $@ -c $<
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $(FT_LNK) $(CL_LNK) $(MLX_LNK) $(JC_LNK) $(OBJS) -o $(NAME) -framework OpenCL
clean:
rm -f $(OBJS)
make -C $(FT) clean
make -C $(MLX) clean
make -C $(JC) clean
make -C $(CL) clean
fclean: clean
rm -f $(NAME)
make -C $(FT) fclean
make -C $(JC) fclean
make -C $(CL) clean
re: fclean all