Initial commit
This commit is contained in:
58
.gitignore
vendored
Normal file
58
.gitignore
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Build path
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
|
|
||||||
|
# debug information files
|
||||||
|
*.dwo
|
||||||
39
LICENSE
Normal file
39
LICENSE
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# **************************************************************************** #
|
||||||
|
# #
|
||||||
|
# ::: :::::::: #
|
||||||
|
# LICENSE :+: :+: :+: #
|
||||||
|
# +:+ +:+ +:+ #
|
||||||
|
# By: sede-san <sede-san@student.42madrid.com> +#+ +:+ +#+ #
|
||||||
|
# +#+#+#+#+#+ +#+ #
|
||||||
|
# Created: 2025/07/30 20:22:21 by sede-san #+# #+# #
|
||||||
|
# Updated: 2025/07/30 20:22:21 by sede-san ### ########.fr #
|
||||||
|
# #
|
||||||
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
This is a free work delivered for educational purposes during the main course
|
||||||
|
at 42 <42.fr>.
|
||||||
|
|
||||||
|
You are free to use, modify, and share this software. Contributions,
|
||||||
|
suggestions, and pull requests are welcome! Feel free to contact me if you want
|
||||||
|
to share thoughts.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author(s) of this software
|
||||||
|
dedicate any and all copyright interest in the software to the public domain.
|
||||||
|
This dedication is made for the benefit of the public at large and to the
|
||||||
|
detriment of our heirs and successors. We intend this dedication to be an overt
|
||||||
|
act of relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
If the Unlicense public domain dedication is not valid in your jurisdiction,
|
||||||
|
you may use this software under the terms of the Creative Commons Zero v1.0
|
||||||
|
Universal (CC0 1.0) License:
|
||||||
|
|
||||||
|
https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
201
Makefile
Normal file
201
Makefile
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
# **************************************************************************** #
|
||||||
|
# #
|
||||||
|
# ::: :::::::: #
|
||||||
|
# Makefile :+: :+: :+: #
|
||||||
|
# +:+ +:+ +:+ #
|
||||||
|
# By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ #
|
||||||
|
# +#+#+#+#+#+ +#+ #
|
||||||
|
# Created: 2025/07/30 20:22:21 by sede-san #+# #+# #
|
||||||
|
# Updated: 2025/07/31 03:16:03 by sede-san ### ########.fr #
|
||||||
|
# #
|
||||||
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
# ******************************* Output files ******************************* #
|
||||||
|
|
||||||
|
# Executable file name
|
||||||
|
NAME =
|
||||||
|
|
||||||
|
# ************************** Compilation variables *************************** #
|
||||||
|
|
||||||
|
# Compiler
|
||||||
|
CC = cc
|
||||||
|
|
||||||
|
# Compilation flags
|
||||||
|
CFLAGS = -Wall -Wextra -Werror -Wunreachable-code # -Ofast
|
||||||
|
|
||||||
|
# Additional headers
|
||||||
|
HEADERS = -I $(INCLUDE_PATH) # -I $(GNL_INCLUDE_PATH) -I $(PRINTF_INCLUDE_PATH) -I $(LIBFT_INCLUDE_PATH)
|
||||||
|
|
||||||
|
# Debug flags, execute with DEBUG=1 -> make DEBUG=1
|
||||||
|
DFLAGS = -g3
|
||||||
|
ifeq ($(DEBUG), 1)
|
||||||
|
CFLAGS += $(DFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Make command with no-print-directory flag
|
||||||
|
MAKE += --no-print-directory
|
||||||
|
|
||||||
|
# ***************************** Style variables ****************************** #
|
||||||
|
|
||||||
|
# Define color codes
|
||||||
|
RED = \033[0;31m
|
||||||
|
GREEN = \033[0;32m
|
||||||
|
YELLOW = \033[0;33m
|
||||||
|
BLUE = \033[0;34m
|
||||||
|
RESET = \033[0m # No Color
|
||||||
|
|
||||||
|
# Emojis
|
||||||
|
EMOJI_BROOM = 🧹
|
||||||
|
EMOJI_CHECK = ✅
|
||||||
|
EMOJI_CROSS = ❌
|
||||||
|
EMOJI_WRENCH = 🔧
|
||||||
|
EMOJI_BOX = 📦
|
||||||
|
|
||||||
|
# ****************************** Source files ******************************** #
|
||||||
|
|
||||||
|
# Source files path
|
||||||
|
SRC_PATH = src
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
SRC = \
|
||||||
|
|
||||||
|
|
||||||
|
# Include path
|
||||||
|
INCLUDE_PATH = ./include
|
||||||
|
|
||||||
|
# ****************************** Object files ******************************** #
|
||||||
|
|
||||||
|
# Object files path
|
||||||
|
OBJS_PATH = build
|
||||||
|
|
||||||
|
# Source files and destination paths
|
||||||
|
OBJS = $(SRC:$(SRC_PATH)/%.c=$(OBJS_PATH)/%.o)
|
||||||
|
|
||||||
|
# Compile as object files
|
||||||
|
$(OBJS_PATH)/%.o: $(SRC_PATH)/%.c
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
@$(CC) $(CFLAGS) -c $< -o $@ $(HEADERS)
|
||||||
|
@echo "$< compiled"
|
||||||
|
|
||||||
|
# ********************************* Rules ************************************ #
|
||||||
|
|
||||||
|
# Compile all
|
||||||
|
all: lib $(NAME)
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
# Compile project
|
||||||
|
$(NAME): $(OBJS)
|
||||||
|
@echo "$(YELLOW)$(EMOJI_BOX) Linking...$(RESET)"
|
||||||
|
@$(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $(NAME)
|
||||||
|
@echo "$(GREEN)$(EMOJI_CHECK) Linked.$(RESET)"
|
||||||
|
|
||||||
|
# Clean object files
|
||||||
|
clean:
|
||||||
|
@echo "$(RED)$(EMOJI_BROOM) Cleaning object files...$(RESET)"
|
||||||
|
@rm -rf $(OBJS_PATH)
|
||||||
|
@echo "$(GREEN)$(EMOJI_CHECK) Object files cleaned.$(RESET)"
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
# Clean object files and binaries
|
||||||
|
fclean: clean
|
||||||
|
@echo "$(RED)$(EMOJI_BROOM) Cleaning binaries...$(RESET)"
|
||||||
|
@rm -f $(NAME)
|
||||||
|
@if [ -d $(LIBFT_PATH) ]; then \
|
||||||
|
$(MAKE) -C $(LIBFT_PATH) fclean; \
|
||||||
|
fi
|
||||||
|
@if [ -d $(GNL_PATH) ]; then \
|
||||||
|
$(MAKE) -C $(GNL_PATH) fclean; \
|
||||||
|
fi
|
||||||
|
@echo "$(GREEN)$(EMOJI_CHECK) Binaries cleaned.$(RESET)"
|
||||||
|
.PHONY: fclean
|
||||||
|
|
||||||
|
# Recompile
|
||||||
|
re: fclean all
|
||||||
|
.PHONY: re
|
||||||
|
|
||||||
|
# ********************************* Libraries ******************************** #
|
||||||
|
|
||||||
|
# Compile libraries
|
||||||
|
lib:
|
||||||
|
@$(MAKE) libft
|
||||||
|
@$(MAKE) ft_printf
|
||||||
|
@$(MAKE) get_next_line
|
||||||
|
.PHONY: lib
|
||||||
|
|
||||||
|
# Compile file with libraries
|
||||||
|
# LIBS = $(GNL_BIN) $(LIBFT_BIN) $(PRINTF_BIN)
|
||||||
|
|
||||||
|
# Libraries path
|
||||||
|
LIB_PATH = lib
|
||||||
|
|
||||||
|
# ** Libft ** #
|
||||||
|
|
||||||
|
LIBFT = Libft
|
||||||
|
LIBFT_REPO = https://github.com/sdevsantiago/Libft.git
|
||||||
|
LIBFT_PATH = $(LIB_PATH)/$(LIBFT)
|
||||||
|
LIBFT_INCLUDE_PATH = $(LIBFT_PATH)
|
||||||
|
LIBFT_BIN = $(LIBFT_PATH)/libft.a
|
||||||
|
|
||||||
|
libft:
|
||||||
|
@if [ ! -d $(LIBFT_PATH) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Cloning $(LIBFT)...$(RESET)"; \
|
||||||
|
git clone $(LIBFT_REPO) $(LIBFT_PATH); \
|
||||||
|
rm -rf $(LIBFT_PATH)/.git; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(LIBFT) cloned...$(RESET)"; \
|
||||||
|
fi
|
||||||
|
@if [ ! -f $(LIBFT_BIN) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Compiling $(LIBFT)...$(RESET)"; \
|
||||||
|
$(MAKE) -C $(LIBFT_PATH) all bonus clean; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(LIBFT) compiled.$(RESET)"; \
|
||||||
|
else \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(LIBFT) already compiled.$(RESET)"; \
|
||||||
|
fi
|
||||||
|
.PHONY: libft
|
||||||
|
|
||||||
|
# ** ft_printf ** #
|
||||||
|
|
||||||
|
PRINTF = ft_printf
|
||||||
|
PRINTF_REPO = https://github.com/sdevsantiago/ft_printf.git
|
||||||
|
PRINTF_PATH = $(LIB_PATH)/$(PRINTF)
|
||||||
|
PRINTF_INCLUDE_PATH = $(PRINTF_PATH)
|
||||||
|
PRINTF_BIN = $(PRINTF_PATH)/libftprintf.a
|
||||||
|
|
||||||
|
ft_printf:
|
||||||
|
@if [ ! -d $(PRINTF_PATH) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Cloning $(PRINTF)...$(RESET)"; \
|
||||||
|
git clone $(PRINTF_REPO) $(PRINTF_PATH); \
|
||||||
|
rm -rf $(PRINTF_PATH)/.git; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(PRINTF) cloned...$(RESET)"; \
|
||||||
|
fi
|
||||||
|
@if [ ! -f $(PRINTF_BIN) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Compiling $(PRINTF)...$(RESET)"; \
|
||||||
|
$(MAKE) -C $(PRINTF_PATH) all bonus clean; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(PRINTF) compiled.$(RESET)"; \
|
||||||
|
else \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(PRINTF) already compiled.$(RESET)"; \
|
||||||
|
fi
|
||||||
|
.PHONY: ft_printf
|
||||||
|
|
||||||
|
# ** get_next_line ** #
|
||||||
|
|
||||||
|
GNL = get_next_line
|
||||||
|
GNL_REPO = https://github.com/sdevsantiago/get_next_line.git
|
||||||
|
GNL_PATH = $(LIB_PATH)/$(GNL)
|
||||||
|
GNL_INCLUDE_PATH = $(GNL_PATH)
|
||||||
|
GNL_BIN = $(GNL_PATH)/get_next_line.a
|
||||||
|
|
||||||
|
get_next_line:
|
||||||
|
@if [ ! -d $(GNL_PATH) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Cloning $(GNL)...$(RESET)"; \
|
||||||
|
git clone $(GNL_REPO) $(GNL_PATH); \
|
||||||
|
rm -rf $(GNL_PATH)/.git; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(GNL) cloned...$(RESET)"; \
|
||||||
|
fi
|
||||||
|
@if [ ! -f $(GNL_BIN) ]; then \
|
||||||
|
echo "$(YELLOW)$(EMOJI_WRENCH) Compiling $(GNL)...$(RESET)"; \
|
||||||
|
$(MAKE) -C $(GNL_PATH) all clean; \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(GNL) compiled.$(RESET)"; \
|
||||||
|
else \
|
||||||
|
echo "$(GREEN)$(EMOJI_CHECK) $(GNL) already compiled.$(RESET)"; \
|
||||||
|
fi
|
||||||
|
.PHONY: get_next_line
|
||||||
0
docs/.gitkeep
Normal file
0
docs/.gitkeep
Normal file
0
include/.gitkeep
Normal file
0
include/.gitkeep
Normal file
0
src/.gitkeep
Normal file
0
src/.gitkeep
Normal file
Reference in New Issue
Block a user