diff --git a/.gitignore b/.gitignore index 686ac5c..b9b46a8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /**/lib /**/obj /.vs +/out diff --git a/Makefile b/Makefile index 8f3a065..8e74d83 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ else ifneq ($(DEBUG),0) else CFLAGS += -O3 -DNDEBUG ifneq ($(FLTO),0) - CFLAGS += -flto -fuse-linker-plugin + CFLAGS += -flto endif ifneq ($(FPGO),0) CFLAGS += -fprofile-$(firstword $(FPGO)) diff --git a/mk-release.cmd b/mk-release.cmd new file mode 100644 index 0000000..a232499 --- /dev/null +++ b/mk-release.cmd @@ -0,0 +1,39 @@ +@echo off +setlocal enabledelayedexpansion + +set ECHO="%~dp0.\etc\utils\win32\cecho.exe" +if "%MSVC_PATH%"=="" ( + set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC" +) + +if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" ( + %ECHO% red "\nMSVC not found. Please check MSVC_PATH and try again^!\n" + pause + goto:eof +) + +for %%p in (x86,x64) do ( + call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%p + for %%c in (Release,Release_SSE2) do ( + if not "%%p::%%c" == "x64::Release_SSE2" ( + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Clean [%%p:%%c]" + %ECHO% white "------------------------------------------------------------------------------\n" + MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /target:Clean /verbosity:normal "%~dp0\Slunk.sln" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Compile [%%p:%%c]" + %ECHO% white "------------------------------------------------------------------------------\n" + MSBuild.exe /property:Configuration=%%c /property:Platform=%%p /target:Build /verbosity:normal "%~dp0\Slunk.sln" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + ) + ) +) + +%ECHO% green "\nBuild completed successfully.\n" +pause +goto:eof + +:BuildFailed +%ECHO% red "\nBuild has failed ^!^!^!\n" +pause diff --git a/mk-release.sh b/mk-release.sh new file mode 100755 index 0000000..1fddb7a --- /dev/null +++ b/mk-release.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" + +readonly USE_STATIC=1 +readonly USE_STRIP=1 +readonly USE_MTUNE=corei7 + +PLATFORM="$(uname -a)" +unset SUFFIX +if [[ "${PLATFORM}" == MINGW* || "${PLATFORM}" == CYGWIN* ]]; then + SUFFIX=".exe" +fi + +mkdir -p "out" +rm -f "out/slunkcrypt-*" + +for cpu in 32 64; do + [[ ${cpu} -lt 64 ]] && march=pentium2 || march=x86-64 + make -B CPU=${cpu} MARCH=${march} MTUNE=${USE_MTUNE} STATIC=${USE_STATIC} STRIP=${USE_STRIP} clean all + cp -f "frontend/bin/slunkcrypt${SUFFIX}" "out/slunkcrypt-x${cpu}${SUFFIX}" +done + +printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"