-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·72 lines (53 loc) · 1.64 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
RED=$'\x1b[31m
GREEN=$'\x1b[32m
PURPLE=$'\x1b[35m
NAME = cub3d
INCLUDE = include
HEADER = $(INCLUDE)/cub.h
CC = clang
CFLAGS = -Wall -Wextra -Werror -O3
CFLAGS += -Imlx
LIBFT_DIR = libft
LIBFT_LIB = $(LIBFT_DIR)/libft.a
MLX_DIR = mlx
MLX_LIB = $(MLX_DIR)/libmlx.a
GNL_DIR = gnl
GNL_LIB = $(GNL_DIR)/nextline.a
OFILES = ofiles
LIBFLAGS = -Lmlx -lmlx -framework OpenGL -framework AppKit
DRAW = $(addprefix drawing/, drawing_map draw_game get_dest get_horizontal get_vertical)
MOVES = $(addprefix moves/, keys get_pos collegion)
PARSING = $(addprefix parsing/, error_handler gen_map_table read_cub check_path)
UTILS = $(addprefix utils/, count ft_strcmp is_empty rays pixels rgb init_data minimap ft_clear)
FILES = $(addprefix src/, main $(PARSING) $(UTILS) $(DRAW) $(MOVES))
OBJ = $(addprefix $(OFILES)/, $(FILES:=.o))
all : $(NAME)
$(NAME): $(MLX_LIB) $(OBJ) $(LIBFT_LIB) $(GNL_LIB) $(HEADER)
@$(CC) $(CFLAGS) $(LIBFT_LIB) $(GNL_LIB) $(OBJ) $(LIBFLAGS) $(MLX_LIB) -o $(NAME)
$(OFILES)/src/%.o: src/%.c $(HEADER)
@mkdir -p $(@D)
@$(CC) -I$(INCLUDE) $(CFLAGS) -o $@ -c $<
@echo "$(GREEN)" "compiling $<"
$(LIBFT_LIB):
@$(MAKE) -C $(LIBFT_DIR)
$(GNL_LIB):
@$(MAKE) -C $(GNL_DIR)
$(MLX_LIB):
-@$(MAKE) -C $(MLX_DIR) 2> /dev/null
clean:
@rm -rf $(OBJ)
@rm -rf ofiles
@$(MAKE) clean -C $(LIBFT_DIR)
@$(MAKE) clean -C $(GNL_DIR)
@$(MAKE) clean -C $(MLX_DIR)
@echo "$(RED)" "cleaning ..."
fclean : clean
@rm -rf $(NAME) *.gch
@$(MAKE) fclean -C $(LIBFT_DIR)
@$(MAKE) fclean -C $(GNL_DIR)
@$(MAKE) clean -C $(MLX_DIR)
@echo "$(RED)" "full cleaning..."
bonus : $(NAME)
re : fclean all
@echo "$(PURPLE)" "remaking"
.PHONY: all clean fclean re bonus