From 969555d572a01ab778d45414c353149e2b69b499 Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 20:21:53 +0200 Subject: [PATCH 1/6] =?UTF-8?q?=E2=9C=A8=20feature(Makefile):=20pretty=20m?= =?UTF-8?q?akefile,=20added=20`-rdynamic`=20LDFLAG,=20moved=20debug=20warn?= =?UTF-8?q?ing,=20added=20`debug`=20Makefile=20rule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 120 ++++++++++++++++++------------ src/renderer/core/render_core.cpp | 10 +-- 2 files changed, 75 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index c621183..bbc8780 100644 --- a/Makefile +++ b/Makefile @@ -6,96 +6,124 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2024/01/10 14:20:30 by maldavid ### ########.fr # +# Updated: 2024/04/23 20:20:33 by kiroussa ### ########.fr # # # # **************************************************************************** # -NAME = libmlx.so +NAME = libmlx.so +MAKE = make --no-print-directory -SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**)) +SRCS = $(wildcard $(addsuffix /*.cpp, src/core)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/platform)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer/**)) -OBJ_DIR = objs/makefile -OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) +OBJ_DIR = objs +OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) -OS = $(shell uname -s) -DEBUG ?= false -TOOLCHAIN ?= clang -IMAGES_OPTIMIZED ?= true -FORCE_INTEGRATED_GPU ?= false -GRAPHICS_MEMORY_DUMP ?= false -PROFILER ?= false +OS = $(shell uname -s) +DEBUG ?= false +TOOLCHAIN ?= clang +IMAGES_OPTIMIZED ?= true +FORCE_INTEGRATED_GPU ?= false +GRAPHICS_MEMORY_DUMP ?= false +PROFILER ?= false +_ENABLEDFLAGS = -MODE = "release" - -CXX = clang++ - -CXXFLAGS = -std=c++17 -O3 -fPIC -Wall -Wextra -Werror -DSDL_MAIN_HANDLED -INCLUDES = -I./includes -I./src -I./third_party - -LDLIBS = +CXX = clang++ +CXXFLAGS = -std=c++17 -O3 -fPIC -Wall -Wextra -Werror -DSDL_MAIN_HANDLED +INCLUDES = -I./includes -I./src -I./third_party ifeq ($(TOOLCHAIN), gcc) - CXX = g++ - CXXFLAGS += -Wno-error=cpp +CXX = g++ +CXXFLAGS += -Wno-error=cpp else - CXXFLAGS += -Wno-error=#warning +CXXFLAGS += -Wno-error=#warning endif ifeq ($(OS), Darwin) - LDLIBS += -L /opt/homebrew/lib -lSDL2 - CXXFLAGS += -I /opt/homebrew/include - NAME = libmlx.dylib +LDFLAGS += -L /opt/homebrew/lib -lSDL2 +CXXFLAGS += -I /opt/homebrew/include +NAME = libmlx.dylib endif ifeq ($(DEBUG), true) - CXXFLAGS += -g -D DEBUG - MODE = "debug" +CXXFLAGS += -g3 -D DEBUG +LDFLAGS += -rdynamic endif ifeq ($(FORCE_INTEGRATED_GPU), true) - CXXFLAGS += -D FORCE_INTEGRATED_GPU +_ENABLEDFLAGS += FORCE_INTEGRATED_GPU endif ifeq ($(IMAGES_OPTIMIZED), true) - CXXFLAGS += -D IMAGE_OPTIMIZED +_ENABLEDFLAGS += IMAGE_OPTIMIZED endif ifeq ($(GRAPHICS_MEMORY_DUMP), true) - CXXFLAGS += -D GRAPHICS_MEMORY_DUMP +_ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP endif ifeq ($(PROFILER), true) - CXXFLAGS += -D PROFILER +_ENABLEDFLAGS += PROFILER endif +CXXFLAGS += $(addprefix -D, $(_ENABLEDFLAGS)) + RM = rm -rf +_RESET = $(shell tput sgr0) +_BOLD = $(shell tput bold) +_ITALIC = $(shell tput sitm) +_UNDER = $(shell tput smul) +_GREEN = $(shell tput setaf 2) +_YELLOW = $(shell tput setaf 3) +_RED = $(shell tput setaf 1) +_GRAY = $(shell tput setaf 8) +_PURPLE = $(shell tput setaf 5) + +ifeq ($(DEBUG), true) +MODE = $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET) +else +MODE = $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET) +endif + $(OBJ_DIR)/%.o: %.cpp - @printf "\033[1;32m[compiling... "$(MODE)" "$(CXX)"]\033[1;00m "$<"\n" + @mkdir -p $(dir $@) + @printf "$(MODE) $(_GRAY)|$(_RESET) Compiling $(_BOLD)$<$(_RESET) $(_GRAY)$(_ITALIC)($@)$(_RESET)\n" @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ all: $(NAME) -$(NAME): $(OBJ_DIR) $(OBJS) - @printf "\033[1;32m[linking ... "$(MODE)"]\033[1;00m "$@"\n" - @$(CXX) -shared -o $(NAME) $(OBJS) $(LDLIBS) - @printf "\033[1;32m[build finished]\033[1;00m\n" +$(NAME): $(OBJS) + @printf "$(MODE) $(_GRAY)|$(_RESET) Linking $(_BOLD)$(NAME)$(_RESET) $(_GRAY)$(_ITALIC)(from ./$(OBJ_DIR)/)$(_RESET)\n" + @$(CXX) -shared -o $(NAME) $(OBJS) $(LDFLAGS) + @printf "$(_BOLD)$(NAME)$(_RESET) compiled $(_GREEN)$(_BOLD)successfully$(_RESET)\n" -$(OBJ_DIR): - @mkdir -p $(sort $(addprefix $(OBJ_DIR)/, $(dir $(SRCS)))) - @printf "\033[1;32m[created objs directory]\033[1;00m\n" +_printbuildinfos: + @printf "$(_RED)$(_BOLD)Warning: $(_RESET)MLX is being compiled in $(MODE) mode.\n" + @printf "This activates $(_BOLD)Vulkan's validation layers$(_RESET) and $(_BOLD)MLX debug messages$(_RESET), which may impact rendering performances.\n\n" + + @printf "Building $(_BOLD)$(NAME)$(_RESET) in $(_BOLD)$(MODE)$(_RESET) mode\n" + @printf "\tOperating System: $(_BOLD)$(OS)$(_RESET)\n" + @printf "\tCompiler: $(_BOLD)$(CXX)$(_RESET)\n" + @printf "\tEnabled flags: $(_BOLD)$(_ENABLEDFLAGS)$(_RESET)\n" + @printf "\tCXXFLAGS: $(_BOLD)$(CXXFLAGS)$(_RESET)\n" + @printf "\tINCLUDES: $(_BOLD)$(INCLUDES)$(_RESET)\n" + @printf "\tLDFLAGS: $(_BOLD)$(LDFLAGS)$(_RESET)\n" + +debug: + @$(MAKE) _printbuildinfos DEBUG=true + @$(MAKE) all DEBUG=true -j clean: @$(RM) $(OBJ_DIR) - @printf "\033[1;32m[object files removed]\033[1;00m\n" + @printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n" fclean: clean @$(RM) $(NAME) - @printf "\033[1;32m["$(NAME)" removed]\033[1;00m\n" + @printf "Cleaned $(_BOLD)$(NAME)$(_RESET)\n" re: fclean all -.PHONY: all clean fclean re +.PHONY: all clean debug fclean re diff --git a/src/renderer/core/render_core.cpp b/src/renderer/core/render_core.cpp index 1de3720..c96e6d6 100644 --- a/src/renderer/core/render_core.cpp +++ b/src/renderer/core/render_core.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */ -/* Updated: 2024/01/20 08:20:07 by maldavid ### ########.fr */ +/* Updated: 2024/04/23 20:09:14 by kiroussa ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,14 +16,6 @@ #include #include -#ifdef DEBUG - #ifdef MLX_COMPILER_MSVC - #pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances") - #else - #warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances" - #endif -#endif - namespace mlx { namespace RCore From 280e3b43d33a9460c0c32abdc6d1c7ceb789e4b9 Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 20:33:11 +0200 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=94=A8=20chore(render=5Fcore.cpp):=20?= =?UTF-8?q?revert=20moving=20the=20warning=20to=20Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +---- src/renderer/core/render_core.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bbc8780..76af4e9 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2024/04/23 20:20:33 by kiroussa ### ########.fr # +# Updated: 2024/04/23 20:32:32 by kiroussa ### ########.fr # # # # **************************************************************************** # @@ -101,9 +101,6 @@ $(NAME): $(OBJS) @printf "$(_BOLD)$(NAME)$(_RESET) compiled $(_GREEN)$(_BOLD)successfully$(_RESET)\n" _printbuildinfos: - @printf "$(_RED)$(_BOLD)Warning: $(_RESET)MLX is being compiled in $(MODE) mode.\n" - @printf "This activates $(_BOLD)Vulkan's validation layers$(_RESET) and $(_BOLD)MLX debug messages$(_RESET), which may impact rendering performances.\n\n" - @printf "Building $(_BOLD)$(NAME)$(_RESET) in $(_BOLD)$(MODE)$(_RESET) mode\n" @printf "\tOperating System: $(_BOLD)$(OS)$(_RESET)\n" @printf "\tCompiler: $(_BOLD)$(CXX)$(_RESET)\n" diff --git a/src/renderer/core/render_core.cpp b/src/renderer/core/render_core.cpp index c96e6d6..0a52b5c 100644 --- a/src/renderer/core/render_core.cpp +++ b/src/renderer/core/render_core.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */ -/* Updated: 2024/04/23 20:09:14 by kiroussa ### ########.fr */ +/* Updated: 2024/04/23 20:32:54 by kiroussa ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,6 +16,14 @@ #include #include +#ifdef DEBUG + #ifdef MLX_COMPILER_MSVC + #pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances") + #else + #warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances" + #endif +#endif + namespace mlx { namespace RCore From 291927a1cc9b4ac531cd4bce0e67d7c2293d2056 Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 20:37:17 +0200 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=90=9B=20fix(actions):=20try=20and=20?= =?UTF-8?q?fix=20logging=20in=20GitHub=20Actions=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 76af4e9..aac97f1 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2024/04/23 20:32:32 by kiroussa ### ########.fr # +# Updated: 2024/04/23 20:37:01 by kiroussa ### ########.fr # # # # **************************************************************************** # @@ -72,15 +72,16 @@ CXXFLAGS += $(addprefix -D, $(_ENABLEDFLAGS)) RM = rm -rf -_RESET = $(shell tput sgr0) -_BOLD = $(shell tput bold) -_ITALIC = $(shell tput sitm) -_UNDER = $(shell tput smul) -_GREEN = $(shell tput setaf 2) -_YELLOW = $(shell tput setaf 3) -_RED = $(shell tput setaf 1) -_GRAY = $(shell tput setaf 8) -_PURPLE = $(shell tput setaf 5) +TPUT = tput -T xterm-256color +_RESET = $(shell $(TPUT) sgr0) +_BOLD = $(shell $(TPUT) bold) +_ITALIC = $(shell $(TPUT) sitm) +_UNDER = $(shell $(TPUT) smul) +_GREEN = $(shell $(TPUT) setaf 2) +_YELLOW = $(shell $(TPUT) setaf 3) +_RED = $(shell $(TPUT) setaf 1) +_GRAY = $(shell $(TPUT) setaf 8) +_PURPLE = $(shell $(TPUT) setaf 5) ifeq ($(DEBUG), true) MODE = $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET) From 7f7b6704ce436dba56dea7e1f6131b6634e39593 Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 20:38:26 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=90=9B=20fix(Makefile):=20optimize=20?= =?UTF-8?q?color=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index aac97f1..c179744 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2024/04/23 20:37:01 by kiroussa ### ########.fr # +# Updated: 2024/04/23 20:38:01 by kiroussa ### ########.fr # # # # **************************************************************************** # @@ -19,9 +19,9 @@ SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer)) SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer/**)) OBJ_DIR = objs -OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) +OBJS := $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) -OS = $(shell uname -s) +OS := $(shell uname -s) DEBUG ?= false TOOLCHAIN ?= clang IMAGES_OPTIMIZED ?= true @@ -73,20 +73,20 @@ CXXFLAGS += $(addprefix -D, $(_ENABLEDFLAGS)) RM = rm -rf TPUT = tput -T xterm-256color -_RESET = $(shell $(TPUT) sgr0) -_BOLD = $(shell $(TPUT) bold) -_ITALIC = $(shell $(TPUT) sitm) -_UNDER = $(shell $(TPUT) smul) -_GREEN = $(shell $(TPUT) setaf 2) -_YELLOW = $(shell $(TPUT) setaf 3) -_RED = $(shell $(TPUT) setaf 1) -_GRAY = $(shell $(TPUT) setaf 8) -_PURPLE = $(shell $(TPUT) setaf 5) +_RESET := $(shell $(TPUT) sgr0) +_BOLD := $(shell $(TPUT) bold) +_ITALIC := $(shell $(TPUT) sitm) +_UNDER := $(shell $(TPUT) smul) +_GREEN := $(shell $(TPUT) setaf 2) +_YELLOW := $(shell $(TPUT) setaf 3) +_RED := $(shell $(TPUT) setaf 1) +_GRAY := $(shell $(TPUT) setaf 8) +_PURPLE := $(shell $(TPUT) setaf 5) ifeq ($(DEBUG), true) -MODE = $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET) +MODE := $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET) else -MODE = $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET) +MODE := $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET) endif $(OBJ_DIR)/%.o: %.cpp From a7aa05fcbee11bf3f14be1309af35fc153d2267c Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 20:42:39 +0200 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=94=A8=20chore(actions):=20change=20u?= =?UTF-8?q?sage=20of=20`DEBUG=3Dtrue`=20to=20the=20`debug`=20rule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/linux_clang.yml | 2 +- .github/workflows/linux_gcc.yml | 2 +- .github/workflows/macos_x86.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux_clang.yml b/.github/workflows/linux_clang.yml index 0081cc4..b35ab2c 100644 --- a/.github/workflows/linux_clang.yml +++ b/.github/workflows/linux_clang.yml @@ -35,7 +35,7 @@ jobs: # Build the lib - name: Build MacroLibX - run: make -j && make fclean && make -j DEBUG=true + run: make -j && make fclean && make debug # Build the example - name: Build Example diff --git a/.github/workflows/linux_gcc.yml b/.github/workflows/linux_gcc.yml index 9a0be87..35e0348 100644 --- a/.github/workflows/linux_gcc.yml +++ b/.github/workflows/linux_gcc.yml @@ -35,7 +35,7 @@ jobs: # Build the lib - name: Build MacroLibX - run: make TOOLCHAIN=gcc -j && make fclean && make TOOLCHAIN=gcc DEBUG=true -j + run: make TOOLCHAIN=gcc -j && make fclean && make TOOLCHAIN=gcc debug # Build the example - name: Build Example diff --git a/.github/workflows/macos_x86.yml b/.github/workflows/macos_x86.yml index 18919d5..78433d2 100644 --- a/.github/workflows/macos_x86.yml +++ b/.github/workflows/macos_x86.yml @@ -35,7 +35,7 @@ jobs: # Build the lib - name: Build MacroLibX - run: make -j && make fclean && make DEBUG=true -j + run: make -j && make fclean && make debug # Build the example - name: Build Example From 920e0f5e6646087964d6c4cc17d3325899b84d30 Mon Sep 17 00:00:00 2001 From: xtrm Date: Tue, 23 Apr 2024 22:46:32 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=94=A8=20chore:=20mauvaisfeedback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 68 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index c179744..f4d1ebe 100644 --- a/Makefile +++ b/Makefile @@ -6,22 +6,14 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2024/04/23 20:38:01 by kiroussa ### ########.fr # +# Updated: 2024/04/23 22:45:41 by kiroussa ### ########.fr # # # # **************************************************************************** # NAME = libmlx.so MAKE = make --no-print-directory -SRCS = $(wildcard $(addsuffix /*.cpp, src/core)) -SRCS += $(wildcard $(addsuffix /*.cpp, src/platform)) -SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer)) -SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer/**)) - -OBJ_DIR = objs -OBJS := $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) - -OS := $(shell uname -s) +OS ?= $(shell uname -s) DEBUG ?= false TOOLCHAIN ?= clang IMAGES_OPTIMIZED ?= true @@ -30,6 +22,14 @@ GRAPHICS_MEMORY_DUMP ?= false PROFILER ?= false _ENABLEDFLAGS = +SRCS = $(wildcard $(addsuffix /*.cpp, src/core)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/platform)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer)) +SRCS += $(wildcard $(addsuffix /*.cpp, src/renderer/**)) + +OBJ_DIR = objs/make/$(shell echo $(OS) | tr '[:upper:]' '[:lower:]') +OBJS := $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) + CXX = clang++ CXXFLAGS = -std=c++17 -O3 -fPIC -Wall -Wextra -Werror -DSDL_MAIN_HANDLED INCLUDES = -I./includes -I./src -I./third_party @@ -84,44 +84,46 @@ _GRAY := $(shell $(TPUT) setaf 8) _PURPLE := $(shell $(TPUT) setaf 5) ifeq ($(DEBUG), true) -MODE := $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET) +MODE := $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET)$(_PURPLE) else -MODE := $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET) +MODE := $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET)$(_GREEN) endif +OBJS_TOTAL = $(words $(OBJS)) +N_OBJS := $(shell find $(OBJ_DIR) -type f -name '*.o' 2>/dev/null | wc -l) +OBJS_TOTAL := $(shell echo $(OBJS_TOTAL) - $(N_OBJS) | bc) +CURR_OBJ = 0 + $(OBJ_DIR)/%.o: %.cpp - @mkdir -p $(dir $@) - @printf "$(MODE) $(_GRAY)|$(_RESET) Compiling $(_BOLD)$<$(_RESET) $(_GRAY)$(_ITALIC)($@)$(_RESET)\n" - @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ + mkdir -p $(dir $@) + $(eval CURR_OBJ=$(shell echo $(CURR_OBJ) + 1 | bc)) + $(eval PERCENT=$(shell echo $(CURR_OBJ) \* 100 / $(OBJS_TOTAL) | bc)) + printf "$(_GREEN)($(_BOLD)%3s%%$(_RESET)$(_GREEN)) $(_RESET)Compiling $(_BOLD)$<$(_RESET)\n" "$(PERCENT)" + $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ -all: $(NAME) +all: _printbuildinfos $(NAME) -$(NAME): $(OBJS) - @printf "$(MODE) $(_GRAY)|$(_RESET) Linking $(_BOLD)$(NAME)$(_RESET) $(_GRAY)$(_ITALIC)(from ./$(OBJ_DIR)/)$(_RESET)\n" - @$(CXX) -shared -o $(NAME) $(OBJS) $(LDFLAGS) - @printf "$(_BOLD)$(NAME)$(_RESET) compiled $(_GREEN)$(_BOLD)successfully$(_RESET)\n" +$(NAME): $(OBJS) + printf "Linking $(_BOLD)$(NAME)$(_RESET)\n" + $(CXX) -shared -o $(NAME) $(OBJS) $(LDFLAGS) + printf "$(_BOLD)$(NAME)$(_RESET) compiled $(_GREEN)$(_BOLD)successfully$(_RESET)\n" _printbuildinfos: - @printf "Building $(_BOLD)$(NAME)$(_RESET) in $(_BOLD)$(MODE)$(_RESET) mode\n" - @printf "\tOperating System: $(_BOLD)$(OS)$(_RESET)\n" - @printf "\tCompiler: $(_BOLD)$(CXX)$(_RESET)\n" - @printf "\tEnabled flags: $(_BOLD)$(_ENABLEDFLAGS)$(_RESET)\n" - @printf "\tCXXFLAGS: $(_BOLD)$(CXXFLAGS)$(_RESET)\n" - @printf "\tINCLUDES: $(_BOLD)$(INCLUDES)$(_RESET)\n" - @printf "\tLDFLAGS: $(_BOLD)$(LDFLAGS)$(_RESET)\n" + printf "$(_PURPLE)$(_BOLD)MacroLibX $(_RESET)Compiling in $(_BOLD)$(MODE)$(_RESET) mode on $(_BOLD)$(OS)$(_RESET) | Using $(_BOLD)$(CXX)$(_RESET), flags: $(_BOLD)$(_ENABLEDFLAGS)\n" debug: - @$(MAKE) _printbuildinfos DEBUG=true - @$(MAKE) all DEBUG=true -j + $(MAKE) all DEBUG=true -j clean: - @$(RM) $(OBJ_DIR) - @printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n" + $(RM) $(OBJ_DIR) + printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n" fclean: clean - @$(RM) $(NAME) - @printf "Cleaned $(_BOLD)$(NAME)$(_RESET)\n" + $(RM) $(NAME) + printf "Cleaned $(_BOLD)$(NAME)$(_RESET)\n" re: fclean all .PHONY: all clean debug fclean re + +.SILENT: