From a1541810d99f7c2636f9e9a0adc6cd294790bbd5 Mon Sep 17 00:00:00 2001 From: SmileY Date: Sat, 6 Jan 2024 17:09:33 -0300 Subject: [PATCH] Update makefile --- CSDM/Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/CSDM/Makefile b/CSDM/Makefile index c958a26..533b87b 100644 --- a/CSDM/Makefile +++ b/CSDM/Makefile @@ -1,4 +1,4 @@ -# Include CS SDK +# Include CSSDK CSSDK = include/cssdk # Include Metamod SDK @@ -15,10 +15,18 @@ COMPILER = g++ OBJECTS = *.cpp # Linker Libs -LINKER = -static-libgcc -static-libstdc++ +LINKER = + +# Compiler version check to static linking +RES_COMPILER_VERSION := $(shell expr "`$(COMPILER) -dumpversion`" ">=" "5") + +# Link static lib if compiler is newer than minimum version +ifeq "$(RES_COMPILER_VERSION)" "1" +LINKER += -static-libstdc++ +endif # C flags -CFLAGS = -std=gnu++11 -g0 -O3 -s -flto -funroll-loops -fno-stack-protector -g -DNDEBUG -Dlinux -D__linux__ -D_GLIBCXX_USE_CXX11_ABI=0 -m32 -msse3 -msse4.1 -shared +CFLAGS = -std=gnu++11 -pipe -g0 -O3 -s -flto -funroll-loops -fno-stack-protector -g -DNDEBUG -Dlinux -D__linux__ -D_GLIBCXX_USE_CXX11_ABI=0 -m32 -msse3 -msse4.1 -shared # Include directory INCLUDE = -I. -I$(CSSDK)/common -I$(CSSDK)/dlls -I$(CSSDK)/engine -I$(CSSDK)/game_shared -I$(CSSDK)/pm_shared -I$(CSSDK)/public -I$(METAMOD) @@ -35,7 +43,7 @@ $(BIN_DIR)/%.o: %.c all: mkdir -p $(BIN_DIR) - $(MAKE) $(NAME) + $(MAKE) $(NAME) && strip -x $(BIN_DIR)/$(NAME)_mm.so $(NAME): $(OBJ_LINUX) @@ -48,4 +56,4 @@ default: all clean: rm -rf Release/*.o - rm -rf Release/*.so + rm -rf Release/*.so \ No newline at end of file