-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
100 lines (78 loc) · 2.18 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
91
92
93
94
95
96
97
98
99
100
### VAR #######################################################
NAME := fdf
DEBUGGING ?=
LIBS := ./libft/libft.a
MLX ?= ./MLX42
HEADER := -I libft -I includes -I $(MLX)/includes
MLXLIB := $(MLX)/libmlx42.a
HEADERS := libft/libft.h
OBJ_DIR := ./obj
SRC_DIR := ./src
### UTILS #####################################################
CFLAGS := -Wall -Wextra -Werror
RM := rm -rf
SRC := main.c \
map.c \
list_manipulation.c \
mlxshizzel.c \
draw_line.c \
render_grid.c \
color.c \
exit.c \
mlx_loops.c \
rotation.c
OBJ := $(addprefix $(OBJ_DIR)/,$(SRC:.c=.o))
SRC := $(addprefix $(SRC_DIR)/,$(SRC))
## BON_SRC :=
## BON_OBJ := $(BON_SRC:_bonus.c=_bonus.o)
## Regular Colors ##############################################
Color_Off = "\033[0m" # Text Reset
Black = "\033[0;30m" # Black
Red = "\033[0;31m" # Red
Green = "\033[0;32m" # Green
Yellow = "\033[0;33m" # Yellow
Blue = "\033[0;34m" # Blue
Purple = "\033[0;35m" # Purple
Cyan = "\033[0;36m" # Cyan
White = "\033[0;37m" # White
### EXEC #######################################################
ifdef DEBUG
MLXLIB += -fsanitize=address
DEBUGGING += DEBUG=1
endif
ifdef LINUX
MLXLIB += -lglfw -ldl -pthread -lm
endif
ifndef LINUX
MLXLIB += -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit
endif
all: libmlx $(NAME)
libmlx:
@$(MAKE) -C $(MLX) $(DEBUGGING)
$(NAME): $(OBJ)
@echo $(Yellow) Building.. 🏠$(Color_Off)
@echo -----------------------
@$(MAKE) -C libft
@$(CC) $^ $(LIBS) $(MLXLIB) -o $(NAME)
@echo $(Green) Complete ✅ $(Color_Off)
@echo -----------------------
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HEADERS) | $(OBJ_DIR)
@echo $(Purple) Compiling.. 🧱 $< $(Color_Off)
@echo -----------------------
@$(CC) $(CFLAGS) $(HEADER) -c $< -o $@
$(OBJ_DIR):
@mkdir $@
clean:
@echo $(Cyan) Sweeping.. 💥 $(Color_Off)
@echo -----------------------
@$(MAKE) -C libft clean
@$(MAKE) -C $(MLX) clean
@$(RM) $(OBJ) $(BON_OBJ)
fclean:
@echo $(Red) Thorough sweeping.. 💥 $(Color_Off)
@echo -----------------------
@$(MAKE) -C libft fclean
@$(MAKE) -C $(MLX) fclean
@$(RM) $(NAME) $(OBJ) $(BON_OBJ)
re: fclean all
.PHONY: clean all fclean re libmlx,