-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (76 loc) · 2.66 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: migmanu <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/10/07 19:24:44 by migmanu #+# #+# #
# Updated: 2023/10/25 16:28:26 by jmigoya- ### ########.fr #
# #
# **************************************************************************** #
# SOURCES
SRCS_DIR = ./src/
SRCS = main.c \
00_build_map/build_map.c \
01_check_map/map_parse.c \
01_check_map/map_flood.c \
10_error_handling/handle_error.c \
02_fill_map/fill_map.c \
02_fill_map/fill_map_utils.c \
02_fill_map/load_assets.c \
02_fill_map/load_assets_utils.c \
03_move_character/move_character.c \
03_move_character/movements.c \
OBJ_FILES = $(addprefix $(SRCS_DIR), $(SRCS:.c=.o))
# GNL
GNL_DIR = ./get_next_line/
GNL = get_next_line.c \
get_next_line_utils.c
GNL_OBJS = $(addprefix $(GNL_DIR), $(GNL:.c=.o))
# LIBFT
LIBFT_DIR = ./libft
LIBFT_PATH = $(LIBFT_DIR)/libft.a
# MLX42
MLX42_DIR = ./MLX42
MLX42_PATH = $(MLX42_DIR)/build/libmlx42.a
# LIBRARIES
INCLUDE_DIRS = -I ./include -I $(LIBFT_DIR) -I $(MLX42_DIR)/include
CFLAGS = -Wall -Werror -Wextra -g $(INCLUDE_DIRS)
LDFLAGS = -L$(LIBFT_DIR) -lft
MFLAGS = $(MLX42_PATH) -Iinclude -ldl -lglfw -pthread -lm
# COMPILATION
NAME = so_long
CC = cc
RM = rm -f
# COLORS
BLACK:="\033[1;30m"
RED:="\033[1;31m"
GREEN:="\033[1;32m"
PURPLE:="\033[1;35m"
CYAN:="\033[1;36m"
WHITE:="\033[1;37m"
EOC:="\033[0;0m"
all: $(NAME)
$(NAME): $(OBJ_FILES) $(GNL_OBJS) $(LIBFT_PATH) $(MLX42_PATH)
@echo $(CYAN) "Compiling $@...🛠️"
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ_FILES) $(GNL_OBJS) $(LDFLAGS) $(MFLAGS)
@echo $(GREEN) "OK COMPILED"
%.o: %.c
@git submodule update --init
@$(CC) $(CFLAGS) -c $< -o $@
$(LIBFT_PATH):
@$(MAKE) -C $(LIBFT_DIR) -s
$(MLX42_PATH):
@cmake -B $(MLX42_DIR)/build $(MLX42_DIR)
@cmake --build $(MLX42_DIR)/build -j4
clean:
@echo $(RED) "Cleaning..." $(EOC)
@make clean -C $(LIBFT_DIR) -s
@$(RM) $(OBJ_FILES) $(GNL_OBJS)
fclean: clean
@echo $(PURPLE) "Full Cleaning...🧹" $(EOC)
@make fclean -C $(LIBFT_DIR) -s
@$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean