diff --git a/cpp09/ex02/Makefile b/cpp09/ex02/Makefile index 78834b3..6222c23 100644 --- a/cpp09/ex02/Makefile +++ b/cpp09/ex02/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2025/05/01 14:45:09 by rparodi ### ########.fr # +# Updated: 2025/05/01 15:58:53 by rparodi ### ########.fr # # # # **************************************************************************** # @@ -75,45 +75,18 @@ re: header fclean all $(NAME): $(OBJ) @mkdir -p $(OBJDIRNAME) @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' - @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + @$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(CPPFLAGS) -o $(NAME) $(OBJ) # Creating the objects $(OBJDIRNAME)/%.o: %.cpp @mkdir -p $(dir $@) @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' - @$(CXX) $(CXXFLAGS) -o $@ -c $< + @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ -c $< test: - @printf '$(GREY) Testing with $(END)$(GOLD)./RPN ""$(END)\n' - @./$(NAME) "" - @printf '\n' - @printf '$(GREY) MemCheck with $(END)$(GOLD)./RPN ""$(END)\n' - @valgrind ./$(NAME) "" 2> /tmp/RPN_test - @cat /tmp/RPN_test | rg --color=always "ERROR SUMMARY" -A 10 - @printf '$(GREY) Testing with $(END)$(GOLD)./RPN "8 9 * 9 - 9 - 9 - 4 - 1 +"$(END)\n' - @./$(NAME) "8 9 * 9 - 9 - 9 - 4 - 1 +" - @printf '\n' - @printf '$(GREY) MemCheck with $(END)$(GOLD)./RPN "8 9 * 9 - 9 - 9 - 4 - 1 +"$(END)\n' - @valgrind ./$(NAME) "8 9 * 9 - 9 - 9 - 4 - 1 +" 2> /tmp/RPN_test - @cat /tmp/RPN_test | rg --color=always "ERROR SUMMARY" -A 10 - @printf '$(GREY) Testing with $(END)$(GOLD)./RPN "7 7 * 7 -"$(END)\n' - @./$(NAME) "7 7 * 7 -" - @printf '\n' - @printf '$(GREY) MemCheck with $(END)$(GOLD)./RPN "7 7 * 7 -"$(END)\n' - @valgrind ./$(NAME) "7 7 * 7 -" 2> /tmp/RPN_test - @cat /tmp/RPN_test | rg --color=always "ERROR SUMMARY" -A 10 - @printf '$(GREY) Testing with $(END)$(GOLD)./RPN "1 2 * 2 / 2 * 2 4 - +"$(END)\n' - @./$(NAME) "1 2 * 2 / 2 * 2 4 - +" - @printf '\n' - @printf '$(GREY) MemCheck with $(END)$(GOLD)./RPN "1 2 * 2 / 2 * 2 4 - +"$(END)\n' - @valgrind ./$(NAME) "1 2 * 2 / 2 * 2 4 - +" 2> /tmp/RPN_test - @cat /tmp/RPN_test | rg --color=always "ERROR SUMMARY" -A 10 - @printf '$(GREY) Testing with $(END)$(GOLD)./RPN "(1 + 1)"$(END)\n' - @./$(NAME) "(1 + 1)" - @printf '\n' - @printf '$(GREY) MemCheck with $(END)$(GOLD)./RPN "(1 + 1)"$(END)\n' - @valgrind ./$(NAME) "(1 + 1)" 2> /tmp/RPN_test - @cat /tmp/RPN_test | rg --color=always "ERROR SUMMARY" -A 10 + +debug: CPPFLAGS += -D DEBUG=1 +debug: re # Header header: diff --git a/cpp09/ex02/PmergeMe b/cpp09/ex02/PmergeMe new file mode 100755 index 0000000..ad93363 Binary files /dev/null and b/cpp09/ex02/PmergeMe differ diff --git a/cpp09/ex02/PmergeMe.hpp b/cpp09/ex02/PmergeMe.hpp index 979f17d..300d152 100644 --- a/cpp09/ex02/PmergeMe.hpp +++ b/cpp09/ex02/PmergeMe.hpp @@ -6,8 +6,27 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/01 14:45:25 by rparodi #+# #+# */ -/* Updated: 2025/05/01 14:45:29 by rparodi ### ########.fr */ +/* Updated: 2025/05/01 16:06:02 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #pragma once + +#include + +#define CLR_RESET "\033[0m" + +#define CLR_BLACK "\033[0;30m" +#define CLR_RED "\033[0;31m" +#define CLR_GREEN "\033[0;32m" +#define CLR_YELLOW "\033[0;33m" +#define CLR_BLUE "\033[0;34m" +#define CLR_MAGENTA "\033[0;35m" +#define CLR_CYAN "\033[0;36m" +#define CLR_WHITE "\033[0;37m" +#define CLR_GOLD "\033[38;5;220m" +#define CLR_GREY "\033[38;5;240m" + +#ifndef DEBUG +#define DEBUG 0 +#endif diff --git a/cpp09/ex02/main.cpp b/cpp09/ex02/main.cpp index 9eb63eb..9748723 100644 --- a/cpp09/ex02/main.cpp +++ b/cpp09/ex02/main.cpp @@ -6,8 +6,17 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/01 14:45:40 by rparodi #+# #+# */ -/* Updated: 2025/05/01 14:45:41 by rparodi ### ########.fr */ +/* Updated: 2025/05/01 16:28:50 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ +#include "PmergeMe.hpp" +#include +int main(int argc, char **argv) { + if (DEBUG) + std::cerr << CLR_MAGENTA << "Warning: DEBUG_MODE is now enable" << CLR_RESET << std::endl << std::endl; + if (argc < 2) + std::cerr << CLR_RED << "Usage:\t" << argv[0] << " ..." << CLR_RESET << std::endl; + return (0); +}