Rewrite Makefile
This page covers how Makefile is rewritten.
Use CXX/CXXFLAGS
Instead of specifying COMP
variable, users can now set CXX
and CXXFLAGS
directly. This is one of the primary objectives of the proposal.
Targets such as build, profile-build, etc., do require a valid CXX
variable, representing a C++ compiler command.
Internal compiler options are now appended to SF_CXXFLAGS
and SF_LDFLAGS
variables.
Compiler Type Detection
When CXX
is properly set, it checks predefined macros to determine the compiler type. It's assumed that compiler is GNU compatible - currently GCC, Clang, and ICX are supported.
ICX:
__INTEL_LLVM_COMPILER
LLVM/Clang:
__clang__
Apple Clang (Xcode): "Apple" in
__VERSION__
macro
GCC:
__GNUC__
MinGW
Checks if __MINGW32__
macro is set when the compiler is GCC or Clang. When detected, the name of the Stockfish executable file is set to "stockfish.exe".
Makefile in Subdirectory
If ARCH
is not set to native, the Makefile in the arch/ directory is included based on the selected build profile. The sub-Makefile adds compiler flags specific to the machine and target architecture (i.e. -mavx2
), and exports arch-specific help message and config-sanity rule.
x86*
: arch/i386arm*
: arch/armOthers: arch/generic
Build Profiles
native
Removed get_native_properties.sh and use -march=native
compiler option. Also defines ARCH_NATIVE
macro so that specific extensions/features can be selectively enabled/disabled within the code.
x86
NO_AVX512
option is introduced and available for AVX-512 presets. 512-bit SIMD instructions are not used if this option is set.
x86-64-avx512-vnni
Synonym to x86-64-vnni512, or x86-64-vnni256 if
NO_AVX512
is set.Removed
-mavx512dq
.
x86-64-avx512
Added
-mavx512vl
.
x86-64-bmi: New profile
Inherits x86-64-avx and has
-mbmi
.Some AMD processors support BMI1 only.
x86-64-avx: New profile
Inherits x86-64-popcnt and has
-mavx
.Targets Intel Sandy Bridge and Ivy Bridge processors.
x86-64-popcnt: New profile (replaces x86-64-sse41-popcnt)
Added
-msse4.2
.
x86-64-sse41: New profile
Inherits x86-64-ssse3 and has
-msse4.1
.Targets non-Intel/AMD x86 processors (e.g. VIA Nano)
x86-64-abm: New profile
Inherits x86-64-sse2 and has
-msse3
,-msse4a
and-mabm
.Some AMD processors support SSE4a but no SSSE3/SSE4.1. Compilers enable
__POPCNT__
flag.
x86-64-sse3-popcnt: Retired (equal to x86-64-abm)
x86-32-sse41-popcnt: Retired
x86-32-sse2: Retired
ARM
armv7
Removed Neon support. (NDK)
Removed
-mthumb
. (NDK)
armv7-neon
Added
-mfloat-abi=softfp
. This option is now present regardless of the compiler type.Removed
-mthumb
. (NDK)
Compiler Options
GCC
Add
-flto=jobserver
instead of-flto
if GCC version is 12 or above.
Clang
Use
xcrun llvm-profdata
if compiler is Apple Clang.
ICX
Removed undocumented or default options:
--intel
,-pedantic
,-Wdeprecated
,-Wconditional-uninitialized
Fixed PGO build options.
Miscellaneous
strip
Both stockfish and stockfish.exe are stripped if exist.
install
Removed -
prefix.
format
Set CLANG_FORMAT
as a target-specific variable.
Prints a message if clang-format is not installed.
profile-build
Renamed WINE
variable to EMULATE
.
Last updated