-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (64 loc) · 2.19 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jibanez <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/02/03 11:59:13 by jibanez #+# #+# #
# Updated: 2015/05/29 13:05:47 by jibanez ### ########.fr #
# #
# **************************************************************************** #
NAME = rtv1
# Directories
SRCDIR = sources
OBJDIR = objects
INCDIR = includes
MAINDIR = $(SRCDIR)/main
CAMDIR = $(SRCDIR)/camera
RENDERDIR = $(SRCDIR)/render
VECTORDIR = $(SRCDIR)/vector
MATRIXDIR = $(SRCDIR)/matrix
# Libraries
LIBFT = libft
# Format
GREEN = \x1b[32;01m
ORANGE = \x1b[33;01m
STOP_COLOR = \x1b[0m
OK = $(GREEN)--> [OK]$(STOP_COLOR)
INFO = @echo "Compile $< to $@ $(OK)"
# Compilation / Linking
CC = clang
CFLAGS = -Wall -Wextra -Werror
OFLAGS =
IFLAGS = -I$(INCDIR) -I$(LIBFT)/includes
LFLAGS = -L$(LIBFT) -lft -lm \
-lmlx -framework OpenGL -framework AppKit
RM = rm -rf
COMPIL = $(CC) $(CFLAGS) $(OFLAGS) $(IFLAGS) -o $@ -c $<
LINK = $(CC) $(LFLAGS) -o $@ $^
# Include sources.mk
include $(MAINDIR)/sources.mk
include $(CAMDIR)/sources.mk
include $(RENDERDIR)/sources.mk
include $(VECTORDIR)/sources.mk
include $(MATRIXDIR)/sources.mk
POBJ = $(addprefix $(OBJDIR)/, $(OBJ))
# Rules
.PHONY: all clean re fclean libft
all: $(OBJDIR) $(LIBFT) $(NAME)
$(NAME): $(POBJ)
$(LINK)
@echo "$(GREEN)--> [Done!] --> ./$@ $(STOP_COLOR)"
$(OBJDIR):
@mkdir $(OBJDIR)
@echo "$(ORANGE)Create $(OBJDIR) directory$(STOP_COLOR)"
$(LIBFT):
make -C $(LIBFT)
clean:
@$(RM) $(OBJDIR)
@echo "$(ORANGE)Remove $(OBJDIR) directory$(STOP_COLOR)"
fclean: clean
$(RM) $(NAME)
@echo "$(GREEN)--> [Clean!]$(STOP_COLOR)"
re: fclean all