-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
81 lines (64 loc) · 2.76 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ael-khni <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/06/03 10:15:17 by ael-khni #+# #+# #
# Updated: 2022/06/04 14:08:09by ael-khni ### ########.fr #
# #
# **************************************************************************** #
NAME = cub3D
CC = cc
FLAGS = -Wall -Wextra -Werror
RM = rm -rf
INCLUDES = -I /usr/local/include
LIBMLX = -L /usr/local/lib
OBJDIR = .objFiles
INIT = $(addprefix init/, map_init)
PARSER = $(addprefix parser/, parser check_map check_walls parser_utils \
get_data check_cub)
UTILS = $(addprefix utils/, gnl ft_strlen ft_strdup ft_strndup ft_split \
ft_puterror ft_strcmp ft_strncmp ft_itoa ft_atoi)
DDA = $(addprefix DDA/, luncher draw key_hook moves tex)
FILES = $(addprefix srcs/, cub3d $(PARSER) $(UTILS) $(DDA) $(INIT))
#OBJFILES = $(addprefix .objFiles/, cub3d $(UTILS))
SRC = $(FILES:=.c)
OBJ = $(addprefix $(OBJDIR)/, $(FILES:=.o))
HEADER = $(addprefix includes/, cub3d.h)
CUB3DHEADER = -I includes
#Colors:
GREEN = \e[92;5;118m
YELLOW = \e[93;5;226m
GRAY = \e[33;2;37m
RESET = \e[0m
CURSIVE = \e[33;3m
#Debug
ifeq ($(DEBUG), 1)
OPTS = -g
endif
.PHONY: all clean fclean re bonus norm
all: $(NAME)
$(NAME): $(OBJ) $(HEADER)
@printf "$(CURSIVE)$(GRAY) - Compiling $(NAME)... $(RESET)\n"
@$(CC) $(OBJ) $(INCLUDES) $(CUB3DHEADER) $(LIBMLX) $(OPTS) -lmlx -framework OpenGL -framework AppKit -o $(NAME)
@printf "$(_SUCCESS) $(GREEN)- Executable ready.\n$(RESET)"
$(OBJDIR)/%.o: %.c $(HEADER)
@mkdir -p $(dir $@)
@ printf "$(CURSIVE)$(GRAY) - Making object file $@ from source file $< ... $(RESET)\n"
@#printf "$(CURSIVE)$(GRAY) - Making object file $(notdir $@) from source file $(notdir $<) ... $(RESET)\n"
@$(CC) -Wall -Wextra -Werror $(OPTS) $(CUB3DHEADER) $(OPTS) -c $< -o $@
norm:
@printf "$(CURSIVE)$(GRAY)"
@norminette
@printf "$(RESET)"
clean:
@ $(RM) $(OBJDIR) $(OBJ)
@printf "$(CURSIVE)$(GRAY) - Removing object files ... $(RESET)\n"
@printf "$(YELLOW) - Object files removed.$(RESET)\n"
fclean: clean
@ $(RM) $(NAME)
@printf "$(CURSIVE)$(GRAY) - Removing $(NAME)... $(RESET)\n"
@printf "$(YELLOW) - Executable removed.$(RESET)\n"
re: fclean all