-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (45 loc) · 976 Bytes
/
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
# Colors
DEF_COLOR = \033[0;39m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
NAME = rot_cube
SRC = $(addprefix src/, main.c \
inputs.c \
draw.c \
draw_utils.c \
utils.c \
init.c \
update.c \
)
MAT_SRC = $(addprefix mat/, mat.c)
OBJ := $(SRC:%.c=%.o)
MAT_OBJ := $(MAT_SRC:%.c=%.o)
CCFLAGS =
all: $(NAME)
# MacOs
$(NAME): $(OBJ) $(MAT_OBJ)
gcc $(CCFLAGS) $^ -Lmlx -lmlx -framework OpenGL -framework AppKit -o $(NAME)
@echo "$(GREEN)$(NAME) compiled!$(DEF_COLOR)"
debug: $(OBJ) $(MAT_OBJ)
gcc $(CCFLAGS) $^ -fsanitize=address -Lmlx -lmlx -framework OpenGL -framework AppKit -o $(NAME)
# MacOs
%.o: %.c
@make -C mlx/
gcc $(CCFLAGS) -Imlx -Iincludes -c $< -o $@
clean:
rm -f $(OBJ) $(MAT_OBJ)
fclean: clean
make fclean -C mlx/
rm -f $(NAME)
shape:
rm -f $(OBJ)
rm -f $(NAME)
$(MAKE)
re: fclean all
.PHONY: mlx