-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
121 lines (97 loc) · 2.82 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
116
117
118
119
120
121
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: sanan <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/03/08 08:47:36 by sanan #+# #+# #
# Updated: 2023/10/24 16:10:20 by sanan ### ########.fr #
# #
# **************************************************************************** #
NAME = cub3D
DIR_PARSING = ./parsing/
SRC_PARSING = $(addprefix $(DIR_PARSING),\
check_wall.c\
elements_init.c\
info_init.c\
parsing_utils.c\
parsing_utils2.c\
check_island_utils.c\
map_init.c\
game_init.c)
DIR_GNL= ./get_next_line/
SRC_GNL =$(addprefix $(DIR_GNL),\
get_next_line.c\
get_next_line_utils.c)
DIR_LIBFT= ./libft/
SRC_LIBFT =$(addprefix $(DIR_LIBFT),\
ft_atoi.c\
ft_linedup.c\
ft_split.c\
ft_strcmp.c\
ft_strncmp.c)
DIR_ERROR= ./error/
SRC_ERROR =$(addprefix $(DIR_ERROR),\
exit_error.c)
SRC_MAIN =\
dda.c\
draw_2.c\
draw.c\
key_events.c\
key_events_2.c\
main.c\
raycast_utils_1.c\
init.c
SRCS = \
$(SRC_PARSING)\
$(SRC_GNL)\
$(SRC_LIBFT)\
$(SRC_ERROR)\
$(SRC_MAIN)
OBJS = $(SRCS:.c=.o)
CC = cc
WFLAGS = -Wall -Wextra -Werror
LIB_MLX = ./MLX/libmlx.dylib
INCLUDE = -I./ -I./MLX
MLX_LINK = -L$(dir $(LIB_MLX)) -lmlx
all : $(NAME)
@$(ECHO) $(PURPLE) "🐶 cub3D is ready!" $(RESET)
$(NAME) : $(OBJS) $(LIB_MLX)
@$(ECHO) $(CYAN) 🐶 assembling $(GREEN) $@
@$(CC) $(WFLAGS) $(SRCS) $(INCLUDE) $(LIB_MLX) $(MLX_LINK) -o $(NAME)
@cp $(LIB_MLX) ./$(notdir $(LIB_MLX))
%.o : %.c
@$(ECHO) $(BLUE) 🐶 compiling $(GREEN) $<
@$(CC) $(WFLAGS) $(INCLUDE) -c $< -o $@
$(LIB_MLX) :
@make -C $(dir $(LIB_MLX))
clean :
@rm -rf $(OBJS)
@make -C $(dir $(LIB_MLX)) clean
@echo $(RED) " 🐶 cleaned object files!" $(RESET)
fclean : clean
@rm -rf $(NAME)
@rm -rf libmlx.dylib
@echo $(RED) " 🐶 cleaned archive, target files!" $(RESET)
re :
@make fclean
@make all
RESET = "\x1b[0m"
GREY = "\x1b[30m"
RED = "\x1b[31m"
GREEN = "\x1b[32m"
YELLOW = "\x1b[33m"
BLUE = "\x1b[34m"
PURPLE = "\x1b[35m"
CYAN = "\x1b[36m"
WHITE = "\x1b[37m"
ifndef ECHO
T := $(shell $(MAKE) $(MAKECMDGOALS) --no-print-directory \
-nrRf $(firstword $(MAKEFILE_LIST)) \
ECHO="COUNTTHIS" | grep -c "COUNTTHIS")
N := x
C = $(words $N)$(eval N := x $N)
ECHO = echo $(YELLOW) "`expr " [ \`expr $C '*' 100 / $T\`" : '.*\(....\)$$'`% ]" $(RESET)
endif
.PHONY : all clean fclean re