-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
115 lines (87 loc) · 2.28 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
-include mk/includes.mk
-include mk/sources.mk
-include mk/colors.mk
# Das Progamm
NAME = cub3D
# Version
BONUS = 0
# Compiler
CC = cc
CFLAGS = -Wall -Werror -Wextra -MMD -g
LDFLAGS = -L $(LIBFT_PATH) -lft
MLXFLAGS = -lX11 -lXext -L $(MLX_PATH) -lmlx -lm
# Libft
LIBFT_PATH = libft/
LIBFT_NAME = libft.a
LIBFT = $(LIBFT_PATH)$(LIBFT_NAME)
# Minilibx
MLX_PATH = mlx/
MLX_NAME = libmlx.a
MLX = $(MLX_PATH)$(MLX_NAME)
HEAD = -I ./inc/ \
-I ./libft/inc \
-I ./mlx/
DEPS = ${OBJS:.o=.d}
# Sources
SRCS_PATH = srcs/
# Objects
OBJS_PATH = objs/
OBJS_NAMES = $(SRCS:.c=.o)
OBJS = $(addprefix $(OBJS_PATH)/, $(OBJS_NAMES))
# -fsanitize=address
MAKEFLAGS = --no-print-directory
all : ${NAME}
$(OBJS_PATH)/%.o : %.c
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -DBONUS=$(BONUS) -c $< -o $@ $(HEAD)
@printf "$(_FOREST_GREEN)🐛 Falling asleep... %-50s \r" $@
$(OBJS_PATH) :
@mkdir -p $(OBJS_PATH)
@echo "$(_EMMERALD)Cub3D: .obj/ folder created$(_END)"
$(LIBFT) :
@echo "$(_GOLD)Summoning libft's madhatter$(_END)"
@make -sC $(LIBFT_PATH)
$(MLX) :
@echo "$(_LILAC)Downloading & crafting MiniLibX$(_END)"
@if [ -d mlx];then echo ok;else git clone https://github.com/42Paris/minilibx-linux.git mlx;fi
@make -sC $(MLX_PATH)
$(NAME) : $(LIBFT) $(MLX) $(OBJS_PATH) $(OBJS)
@$(CC) $(CFLAGS) $(OBJS) -DBONUS=$(BONUS) -o $(NAME) $(LIBFT) $(LDFLAGS) $(MLX) $(MLXFLAGS)
@echo "\n🐇$(_FOREST_GREEN)$(_BOLD) DOWN THE RABBIT HOLE WE GO $(_END)🐇"
pack:
@echo "$(_LILAC)Downloading textures and maps$(_END)"
@git clone [email protected]:Makasabi/Cub3d_textures_maps_pack.git pack
@mv pack/xpm ./
@mv pack/des ./
@rm -rf pack
clean:
@echo "$(_AQUAMARINE)Which potion will it be ? $(_END)"
@rm -rf $(OBJS_PATH)
@rm -rf $(OBJS)
@make clean -C libft
fclean: clean
@echo "$(_AQUAMARINE)$(_BOLD)🗝️ Leaving Wonderland 🎩$(_END)"
@rm -rf $(NAME)
@make fclean -C libft
@rm -rf mlx
cleanpack:
@rm -rf des
@rm -rf xpm
@rm -rf pack
bonus:
@rm -rf $(NAME)
@rm -rf $(OBJS_PATH)
@rm -rf $(OBJS)
make BONUS=1
@tput civis
# @tput cnorm
re: fclean all
cle:
@echo "$(_AQUAMARINE)Clearing Cub3D files $(_END)"
@rm -rf $(OBJS_PATH)
@rm -rf $(OBJS)
@rm -rf $(NAME)
@rm -rf $(BONUS)
cub: cle all
-include $(DEPS)
.PHONY: all clean fclean re cub cle bonus cleanpack pack