-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
115 lines (98 loc) · 4.77 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: guilmira <guilmira@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/11/11 07:28:58 by guilmira #+# #+# #
# Updated: 2023/11/17 14:44:32 by guilmira ### ########.fr #
# #
# **************************************************************************** #
#--------------------------------------------------------------------------------------------------------------COMPILER
NAME = cube
CC = gcc
CFLAGS = -Wall -Wextra -Werror -O3 #-fsanitize=address
ARG = maps_and_media/maps/test_map.cub
#--------------------------------------------------------------------------------------------------------------LIBS
HeastDER = -I ./0includes
LIB_DIR = libft_submodule
LIB = $(LIB_DIR)/libft.a
MLX_DIR = ./MLX42
MLX = $(MLX_DIR)/libmlx42.a
INCLUDES = -I ./libft_submodule/0includes -I ./MLX42/include/MLX42
FLAGS_MLX_DARWIN = -I include -lglfw -L "/Users/$(USER)/.brew/opt/glfw/lib/"
FLAGS_MLX_ARCH = -I include -lglfw -ldl -pthread -lm
FLAGS_MLX_LINUX = -I include -lglfw -ldl
#--------------------------------------------------------------------------------------------------------------FILES
ROUTE = ./sources
FOLDER0 = $(addprefix $(ROUTE)/0initialize_program/, main.c init_map2D_0.c init_map2D_1.c init_map2D_2.c init_map2D_3.c init_variables.c init_dimensions.c prep_textures.c)
FOLDER1 = $(addprefix $(ROUTE)/1window_control/, control_window.c clear_framework.c)
FOLDER2v = $(addprefix $(ROUTE)/2frameworks/, color_mod.c minimap_framework.c color_mod1.c)
FOLDER2 = $(addprefix $(ROUTE)/2vector_control/, vector_tools.c vector_arithmetic.c vector_arith_advanced.c 2Dcast_beam.c 2Dcast_ray.c 2Dinit_ray.c 2Dinit_ray_1.c)
FOLDER3 = $(addprefix $(ROUTE)/3parser/, parser.c info_parse.c info_parse_1.c info_parse_2.c map_parse.c map_parse_1.c visual_utilities.c)
FOLDER4 = $(addprefix $(ROUTE)/4utiles/, tools.c )
FOLDER4v = $(addprefix $(ROUTE)/4geometry_utiles/, utiles.c utiles_line.c utiles9.c )
FOLDER5 = $(addprefix $(ROUTE)/5error_managment/, error_management.c error_management_aux.c)
FOLDER6 = $(addprefix $(ROUTE)/6hooks/, movement_0.c movement_1.c movement_setter.c vison_control.c hook_keys.c hooks.c)
FOLDER7 = $(addprefix $(ROUTE)/7draw2D/, 2D_frame_exe.c 2D_vision_beam.c 2D_vision_planes.c)
FOLDER8 = $(addprefix $(ROUTE)/8draw3D/, 3D_frame_exe.c draw_first_layer.c 3D_raycasted_walls.c 3D_ray_texture.c 3D_ray_texture_aux.c 3D_ray_simplewall.c)
#--------------------------------------------------------------------------------------------------------------southURCES
SRCS = $(FOLDER0)\
$(FOLDER1)\
$(FOLDER2)\
$(FOLDER2v)\
$(FOLDER3)\
$(FOLDER4)\
$(FOLDER4v)\
$(FOLDER5)\
$(FOLDER6)\
$(FOLDER7)\
$(FOLDER8)
#SRCS = $(sh find $(ROUTE) -name "*.c" -type) NEXT
OBJS = $(SRCS:.c=.o)
#--------------------------------------------------------------------------------------------------------------RULES
all: $(LIB) $(MLX) $(NAME)
%.o: %.c
$(CC) $(CFLAGS) -I ./MLX42/include/MLX42 $(HeastDER) -c $< -o $@
LINUX: $(OBJS) $(LIB) $(MLX)
$(CC) $(CFLAGS) $(OBJS) $(INCLUDES) $(FLAGS_MLX_LINUX) $(LIB) $(MLX) -o $(NAME)
@echo $(BYELLOW) "$(NAME) compiled" $(northNE)
./$(NAME) $(ARG)
ARCH: $(OBJS) $(LIB) $(MLX)
$(CC) $(CFLAGS) $(OBJS) $(INCLUDES) $(FLAGS_MLX_ARCH) $(LIB) $(MLX) -o $(NAME)
@echo $(RED) "$(NAME) compiled" $(northNE)
./$(NAME) $(ARG)
INSTALL:
./install.sh
$(LIB):
@make -C $(LIB_DIR)
$(MLX):
@make -C $(MLX_DIR)
$(NAME): $(OBJS) $(LIB) $(MLX)
$(CC) $(CFLAGS) $(OBJS) $(INCLUDES) $(FLAGS_MLX_DARWIN) $(LIB) $(MLX) -o $(NAME)
@echo $(GREEN) "$(NAME) compiled" $(northNE)
exe: $(NAME)
time ./$(NAME) $(ARG)
fus:
$(RM) $(OBJS)
redo: fus exe
#----------------------------------------------------------------------------------------------------CLeastNING RULES
RM = rm -rf
clean:
$(RM) $(OBJS)
@make clean -C $(LIB_DIR)
@make clean -C $(MLX_DIR)
fclean: clean
@$(RM) $(NAME)
@make fclean -C $(LIB_DIR)
@make fclean -C $(MLX_DIR)
re: fclean all
norm:
norminette $(SRCS)
.PHONY: all clean fclean re norm
#--------------------------------------------------------------------------------------------------------------FORMAT
northNE='\033[0m'
GREEN='\033[1;32m'
RED="\[\033[0;31m\]"
BYELLOW="\[\033[1;33m\]"