-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (71 loc) · 1.66 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
NAME = fractol
CFLAGS = -Wall -Werror -Wextra
UNAME = $(shell uname)
ifeq ($(UNAME), Linux)
CC := clang -std=c99
else
CC := gcc
endif
# INCLUDES
INC_PATH = ./includes/ \
./mlx/includes/ \
/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ \
/usr/include/X11/
LIB = -L ./mlx -lmlx \
-lpthread
# SOURCES
SRC_NAME = fractal.c \
main.c \
color.c \
complex_util.c \
complex_math.c \
struct_utils.c \
hook.c \
hook_bis.c \
str_utils.c \
thread.c \
fractol.c
SRC_PATH = ./srcs/
# OBJECTS
OBJ_NAME = $(SRC_NAME:.c=.o)
OBJ_PATH = ./objs/
# PREFIXES
SRC = $(addprefix $(SRC_PATH), $(SRC_NAME))
OBJ = $(addprefix $(OBJ_PATH), $(OBJ_NAME))
INC = $(addprefix -I, $(INC_PATH))
#color
YELLOW = "\\033[33m"
BLUE = "\\033[34m"
RED = "\\033[31m"
WHITE = "\\033[0m"
CYAN = "\\033[36m"
GREEN = "\\033[32m"
BOLD = "\\033[1m"
PINK = "\\033[95m"
OK = $(CYAN)OK$(WHITE)
WAIT = $(RED)WAIT$(WHITE)
.PHONY : all clean fclean re
all : $(NAME)
$(NAME) : $(OBJ)
@printf "\rCompiling project $(WAIT)"
ifeq ($(UNAME), Linux)
@$(CC) $(CFLAGS) $(OBJ) $(INC) -L/usr/x86_64-linux-gnu -lX11 -lXext -lm -lpthread -o $(NAME) $(LIB)
else
@$(CC) $(CFLAGS) $(OBJ) $(INC) -framework OpenGL -framework AppKit -o $(NAME) $(LIB)
endif
@printf "\rCompiling project $(OK) \n"
$(OBJ) : | $(OBJ_PATH)
$(OBJ_PATH) :
@mkdir objs
$(OBJ_PATH)%.o: $(SRC_PATH)%.c
@printf "\rCompiling $< into object file.. $(WAIT)"
@$(CC) $(CFLAGS) $(INC) -o $@ -c $<
@printf "\rCompiling $< into object file.. $(OK) \n"
clean :
@rm -rf $(OBJ_PATH)
fclean : clean
@rm -rf $(NAME)
re : fclean all
run : all
@clear
./fractol Julia