-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (45 loc) · 1.73 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gibkim <gibkim@student.42seoul.kr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/05 10:18:50 by gibkim #+# #+# #
# Updated: 2023/11/28 16:12:47 by gibkim ### ########.fr #
# #
# **************************************************************************** #
CC = cc
RM = rm -rf
CFLAGS = -Wall -Wextra -Werror -I.
LIBFT_DIR = libft
LIBFT = libft.a
LIBMLX_DIR = mlx
LIBMLX = libmlx.dylib
SRC_DIR = srcs
OBJ_DIR = objs
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS))
HEADER = $(SRC_DIR)/minirt.h
NAME = miniRT
all: $(NAME)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HEADER) | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
bonus: all
$(OBJ_DIR):
mkdir -p $@
$(NAME): $(OBJS)
$(MAKE) -C $(LIBFT_DIR) bonus
$(MAKE) -C $(LIBMLX_DIR)
$(CC) $(CFLAGS) -lmlx -Imlx -Llibft -lft -framework OpenGL -framework AppKit -o $@ $^
install_name_tool -change $(LIBMLX) $(LIBMLX_DIR)/$(LIBMLX) $@
clean:
$(MAKE) -C $(LIBFT_DIR) $@
$(RM) $(OBJS)
$(RM) $(OBJ_DIR)
fclean: clean
$(MAKE) -C $(LIBFT_DIR) $@
$(MAKE) -C $(LIBMLX_DIR) $^
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re bonus