Adding the libft

This commit is contained in:
Raphael 2024-10-31 17:24:36 +01:00
parent 1b98b537b7
commit c947e43e51
62 changed files with 2098 additions and 19 deletions

View file

@ -6,7 +6,7 @@
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
# Updated: 2024/10/31 11:16:34 by rparodi ### ########.fr #
# Updated: 2024/10/31 17:19:01 by rparodi ### ########.fr #
# #
# **************************************************************************** #
@ -15,6 +15,7 @@
# Name
NAME = Cub3D
NAME_BONUS = Cub3D_bonus
# Commands
CC = cc
@ -28,14 +29,14 @@ CFLAGS += -g3 -MMD
# CFLAGS += -fsanitize=address
# CFLAGS += -fsanitize=thread
INCLUDES = ./includes/
INCLUDES = -I ./includes/ -I ./includes/libft/
SRC = sources/main.c \
sources/error.c \
parsing/arguments.c
# Objects
OBJDIRNAME = ./objects
OBJDIRNAME = ./build
OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.c=.o))
# Colors
@ -53,10 +54,8 @@ all: header $(NAME) footer
# Bonus (make bonus)
bonus: header $(OBJ) $(LIB_OBJ) footer
@mkdir -p $(OBJDIRNAME)
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
@printf '$(GREY) Be Carefull ur in $(END)$(GREEN)Debug Mode$(END)\n'
@cc $(CFLAGS) -D BONUS=1 -o $(NAME) $(OBJ) $(LIB_OBJ)
@cc $(CFLAGS) -D BONUS=1 -o $(NAME_BONUS) $(OBJ) $(LIB_OBJ)
# Clean (make clean)
clean:
@ -68,6 +67,7 @@ clean:
fclean: clean
@printf '$(GREY) Removing $(END)$(RED)Program$(END)\n'
@$(RM) $(NAME)
@$(RM) $(NAME_BONUS)
@echo ""
# Restart (make re)
@ -75,16 +75,16 @@ re: header fclean all
# Dependences for all
$(NAME): $(OBJ)
@make --no-print-directory -C ./libft lib
@mkdir -p $(OBJDIRNAME)
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
@cc $(CFLAGS) -o $(NAME) $(OBJ)
@cc $(CFLAGS) ./build/libft.a -o $(NAME) $(OBJ)
# Creating the objects
$(OBJDIRNAME)/%.o: %.c
@mkdir -p $(dir $@)
@printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n'
@cc $(CFLAGS) -o $@ -c $< -I$(INCLUDES)
@cc $(CFLAGS)-o $@ -c $< $(INCLUDES)
# Header
header: