-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (57 loc) · 1.88 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
NAME = fractol
LIB_FOLDER = libft
LIB = $(LIB_FOLDER)/libft.a
LIBX_FOLDER = minilibx_macos
LIBX = $(LIBX_FOLDER)/libmlx.a
FLAGS = -Wall -Wextra -Werror
XFLAGS = -framework OpenGL -framework AppKit -lpthread
OFLAG = -O3
CC = gcc
SRCS_FOLDER = srcs
SRCS = $(SRCS_FOLDER)/main.c \
$(SRCS_FOLDER)/error.c \
$(SRCS_FOLDER)/struct.c \
$(SRCS_FOLDER)/graphic.c \
$(SRCS_FOLDER)/string.c \
$(SRCS_FOLDER)/interface.c \
$(SRCS_FOLDER)/key.c \
$(SRCS_FOLDER)/mouse.c \
$(SRCS_FOLDER)/color.c \
$(SRCS_FOLDER)/mandelbrot.c \
$(SRCS_FOLDER)/julia.c \
$(SRCS_FOLDER)/bship.c \
$(SRCS_FOLDER)/multibrot.c \
$(SRCS_FOLDER)/thread.c
OBJS_FOLDER = objs
OBJS = $(SRCS:$(SRCS_FOLDER)/%.c=$(OBJS_FOLDER)/%.o)
INC_FOLDER = includes
INCLUDES = $(INC_FOLDER)/fractol.h
all: $(NAME)
$(NAME): $(LIBX) $(LIB) $(OBJS)
@ $(CC) $(FLAGS) -I $(INCLUDES) $(OFLAG) -o $@ $^ $(LIB) $(LIBX) $(XFLAGS)
@ echo "Compilation $(NAME) ...."\
".................................................. \033[32m[OK]\033[0m"
@ echo "Compilation $(LIBX_FOLDER) ...."\
"........................................... \033[32m[OK]\033[0m"
$(LIB):
@ make -C $(LIB_FOLDER)
$(LIBX):
@ make -C $(LIBX_FOLDER)
$(OBJS_FOLDER):
@ mkdir $(OBJS_FOLDER)
$(OBJS_FOLDER)/%.o: $(SRCS_FOLDER)/%.c $(INCLUDES) | $(OBJS_FOLDER) $(INCLUDES)
@ $(CC) $(FLAGS) -I $(INCLUDES) $(OFLAG) -o $@ -c $<
clean:
@ rm -f $(OBJS)
@ rm -rf $(OBJS_FOLDER)
@ make -C $(LIB_FOLDER) clean
@ make -C $(LIBX_FOLDER) clean
@ echo "Delete *.o ($(NAME)) ...."\
"................................................. \033[32m[OK]\033[0m"
fclean: clean
@ rm -f $(NAME) $(LIB) $(LIBX)
@ echo "Delete $(LIB) ....."\
"................................................ \033[32m[OK]\033[0m"
@ echo "Delete $(NAME) ........"\
"................................................... \033[32m[OK]\033[0m"
re: fclean all