From 0391323626858e0732ffc1d2a7a0be5625a54077 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 8 Nov 2024 11:46:08 +0100 Subject: [PATCH] Adding the minilibx and updated the makefile --- Makefile | 47 ++++++++++++++++++++++++++--------------------- includes/cub3d.h | 3 ++- minilibx-linux | 1 + 3 files changed, 29 insertions(+), 22 deletions(-) create mode 160000 minilibx-linux diff --git a/Makefile b/Makefile index 3bb7ce9..6a6ed1c 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,10 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/11/01 12:17:05 by rparodi ### ########.fr # +# Updated: 2024/11/08 11:45:04 by rparodi ### ########.fr # # # # **************************************************************************** # - # Variables # Name @@ -24,18 +23,24 @@ RM = rm -rf # Flags CFLAGS = -Werror -Wextra -Wall CFLAGS += -g3 -MMD - # CFLAGS += -fsanitize=address # CFLAGS += -fsanitize=thread -INCLUDES = -I ./includes/ -I ./includes/libft/ +INCLUDES = -I ./includes/ -I ./includes/libft/ -I ./minilibx-linux + +# Paths +LIBFT_DIR = ./libft +LIBFT_PERSONAL_DIR = ./libft_personal +MLX_DIR = ./minilibx-linux # Library flags +LDFLAGS = -L./build -lft -lft_personal -lm -LDFLAGS =\ - -L./build -lft -lft_personal +# MiniLibX flags for macOS with XQuartz +MLXFLAGS = -L$(MLX_DIR) -lmlx -L/opt/X11/lib -lX11 -lXext -lXrender -lXrandr -lXi -# -lm \ +# Add MLXFLAGS to the linker flags +LDFLAGS += $(MLXFLAGS) SRC = sources/main.c \ sources/error.c \ @@ -53,7 +58,7 @@ GOLD = \033[38;5;220m END = \033[0m # Rules - +# # All (make all) all: header $(NAME) footer @@ -61,7 +66,7 @@ all: header $(NAME) footer bonus: header $(OBJ) footer @mkdir -p $(OBJDIRNAME) @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' - @cc $(CFLAGS) -D BONUS=1 -o $(NAME_BONUS) $(OBJ) $(LDFLAGS) + @$(CC) $(CFLAGS) -D BONUS=1 -o $(NAME_BONUS) $(OBJ) $(LDFLAGS) # Clean (make clean) clean: @@ -79,27 +84,27 @@ fclean: clean # Restart (make re) re: header fclean all +# Compile external libraries build/libft.a: - @make --no-print-directory -C ./libft + @make --no-print-directory -C $(LIBFT_DIR) build/libft_personal.a: - @make --no-print-directory -C ./libft_personal - -build/mlx.a: - @./minilibx-linux/configure + @make --no-print-directory -C $(LIBFT_PERSONAL_DIR) +build/libmlx.a: + @make --no-print-directory -C $(MLX_DIR) # Dependences for all -$(NAME): $(OBJ) build/libft.a build/libft_personal.a build/mlx.a +$(NAME): $(OBJ) build/libft.a build/libft_personal.a build/libmlx.a @mkdir -p $(OBJDIRNAME) @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' - @cc $(CFLAGS) ./build/libft.a -o $(NAME) $(OBJ) $(LDFLAGS) + @$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $(NAME) # Creating the objects $(OBJDIRNAME)/%.o: %.c @mkdir -p $(dir $@) @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' - @cc $(CFLAGS)-o $@ -c $< $(INCLUDES) + @$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< -# Header +# Header header: @clear @printf '\n\n' @@ -115,7 +120,7 @@ header: @printf '$(GOLD) ****** $(END)\n' @printf '$(GREY) Made by rparodi$(END)\n\n' -# Footer +# Footer footer: @printf "\n" @printf "$(GOLD) ,_ _,$(END)\n" @@ -130,7 +135,7 @@ footer: @printf "$(GOLD) '\"' '\"'$(END)\n" @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' -# Phony +# Phony targets .PHONY: all bonus clean fclean re --include ${OBJ:.o=.d} +-include ${OBJ:.o=.d} diff --git a/includes/cub3d.h b/includes/cub3d.h index 94cf8bc..6011025 100644 --- a/includes/cub3d.h +++ b/includes/cub3d.h @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/30 16:30:26 by rparodi #+# #+# */ -/* Updated: 2024/10/31 16:54:38 by rparodi ### ########.fr */ +/* Updated: 2024/11/08 11:40:44 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,7 @@ # include # include "libft.h" +# include "../minilibx-linux/mlx.h" # include "message_error.h" # ifndef BONUS diff --git a/minilibx-linux b/minilibx-linux new file mode 160000 index 0000000..7dc53a4 --- /dev/null +++ b/minilibx-linux @@ -0,0 +1 @@ +Subproject commit 7dc53a411a7d4ae286c60c6229bd1e395b0efb82