From 65bc1c35f11907690de293acd038fa5fcb096c1d Mon Sep 17 00:00:00 2001 From: Raphael Date: Sun, 27 Apr 2025 13:00:39 +0200 Subject: [PATCH] init(09): pushing files of the exercice 01 --- .gitignore | 1 + cpp09/ex01/Makefile | 141 ++++++++++++++++++++++++++++++++++++++++++++ cpp09/ex01/RPN.cpp | 13 ++++ cpp09/ex01/RPN.hpp | 0 cpp09/ex01/main.cpp | 15 +++++ 5 files changed, 170 insertions(+) create mode 100644 cpp09/ex01/Makefile create mode 100644 cpp09/ex01/RPN.cpp create mode 100644 cpp09/ex01/RPN.hpp create mode 100644 cpp09/ex01/main.cpp diff --git a/.gitignore b/.gitignore index 49df8a2..ec3932e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ easyfind span mutated btc +RPN diff --git a/cpp09/ex01/Makefile b/cpp09/ex01/Makefile new file mode 100644 index 0000000..692071d --- /dev/null +++ b/cpp09/ex01/Makefile @@ -0,0 +1,141 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2025/04/27 13:00:00 by rparodi ### ########.fr # +# # +# **************************************************************************** # + +# Variables + +# Name +NAME = RPN + +# Commands +CXX = c++ +RM = rm -rf + +# Flags +# Mandatory flags for 42 +CXXFLAGS = -Werror -Wextra -Wall -std=c++98 +# Flags to have the dependences (can be removed for correction) +# Flags to have the debug (can be removed for correction) +DEBUG = -g3 +# DEBUG += -fsanitize=address +CXXFLAGS += $(DEBUG) + +# Sources +SRC = RPN.cpp \ + main.cpp + +INC_DIR = + +CPPFLAGS = $(addprefix -I, $(INC_DIR)) -MMD -MP + +# Flags to have the dependences (can be removed for correction) +# DEBUG = -g3 +# CPPFLAGS += $(DEBUG) + +# Objects +OBJDIRNAME = ./build +OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.cpp=.o)) + +# Colors +GREEN = \033[32m +GREY = \033[0;90m +RED = \033[0;31m +GOLD = \033[38;5;220m +END = \033[0m + +# Rules + +# All (make all) +all: header $(NAME) footer + +get_db: + @rm -rf ./cpp_09.tgz ./cpp_09 ./data.csv &> /dev/null + @wget https://cdn.intra.42.fr/document/document/33121/cpp_09.tgz &> /dev/null + @tar -xvf cpp_09.tgz &> /dev/null + @cp ./cpp_09/data.csv . &> /dev/null + @rm -rf ./cpp_09.tgz ./cpp_09 &> /dev/null + @printf '$(GREY)Downloaded $(END)$(GREEN)data.csv$(END)\n' + +# Clean (make clean) +clean: + @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' + @printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n' + @$(RM) $(OBJDIRNAME) + +# Clean (make fclean) +fclean: clean + @printf '$(GREY) Removing $(END)$(RED)Program$(END)\n' + @$(RM) $(NAME) + @echo "" + +# Restart (make re) +re: header fclean all + +# Dependences for all +$(NAME): $(OBJ) + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Creating the objects +$(OBJDIRNAME)/%.o: %.cpp + @mkdir -p $(dir $@) + @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' + @$(CXX) $(CXXFLAGS) -o $@ -c $< + +# Header +header: + @clear + @printf '\n\n' + @printf '$(GOLD) ******* ****** ******* $(END)\n' + @printf '$(GOLD) ****** *** ******* $(END)\n' + @printf '$(GOLD) ******* * ******* $(END)\n' + @printf '$(GOLD) ****** ******* $(END)\n' + @printf '$(GOLD) ******* ******* $(END)\n' + @printf '$(GOLD) ******************* ******* * $(END)\n' + @printf '$(GOLD) ******************* ******* *** $(END)\n' + @printf '$(GOLD) ****** ******* ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GREY) Made by rparodi$(END)\n\n' + +# Footer +footer: + @printf "\n" + @printf "$(GOLD) ,_ _,$(END)\n" + @printf "$(GOLD) | \\___//|$(END)\n" + @printf "$(GOLD) |=6 6=|$(END)\n" + @printf "$(GOLD) \\=._Y_.=/$(END)\n" + @printf "$(GOLD) ) \` ( ,$(END)\n" + @printf "$(GOLD) / \\ (('$(END)\n" + @printf "$(GOLD) | | ))$(END)\n" + @printf "$(GOLD) /| | | |\\_//$(END)\n" + @printf "$(GOLD) \\| |._.| |/-\`$(END)\n" + @printf "$(GOLD) '\"' '\"'$(END)\n" + @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' + +clangd: + @printf "CompileFlags:\n" > ./.clangd + @printf " Add:\n" >> ./.clangd + @printf " - \"-xc++\"\n" >> ./.clangd + @for FLAG in $(CXXFLAGS); do \ + printf " - \"$$FLAG\"\n" >> ./.clangd; \ + done + @printf " - \"-I"$(shell pwd)"/\"\n" >> .clangd; + @for file in $(INC_DIR); do \ + printf " - \"-I"$(shell pwd)"/"$$file"\"" >> .clangd; \ + done + @printf "\n" >> ./.clangd + @printf '$(GREY) Now parsing settings is set in $(END)$(GREEN)./.clangd$(END)\n' + +# Phony +.PHONY: all clean fclean re get_db clangd +-include ${OBJ:.o=.d} diff --git a/cpp09/ex01/RPN.cpp b/cpp09/ex01/RPN.cpp new file mode 100644 index 0000000..4adfde0 --- /dev/null +++ b/cpp09/ex01/RPN.cpp @@ -0,0 +1,13 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* RPN.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/27 12:57:56 by rparodi #+# #+# */ +/* Updated: 2025/04/27 12:58:01 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "RPN.hpp" diff --git a/cpp09/ex01/RPN.hpp b/cpp09/ex01/RPN.hpp new file mode 100644 index 0000000..e69de29 diff --git a/cpp09/ex01/main.cpp b/cpp09/ex01/main.cpp new file mode 100644 index 0000000..a685fe4 --- /dev/null +++ b/cpp09/ex01/main.cpp @@ -0,0 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/27 12:58:08 by rparodi #+# #+# */ +/* Updated: 2025/04/27 13:00:01 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int main(int argc, char **argv) { + +}