X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2FMakefile;h=c3660a20fa674739009e3fe65eb9ba9a06e2d8fa;hp=492403d3ce875b60e4027710c951b9b94a5e3f64;hb=ca41ee6632368676a2fb98fd2970ac9b183f0aa9;hpb=aecfca2dc2d760df257e18cd6b29d266a3c3e68a diff --git a/src/Makefile b/src/Makefile index 492403d3..c3660a20 100644 --- a/src/Makefile +++ b/src/Makefile @@ -344,10 +344,20 @@ endif ### needs access to the optimization flags. ifeq ($(optimize),yes) ifeq ($(debug), no) - ifeq ($(comp),$(filter $(comp),gcc clang mingw)) + ifeq ($(comp),$(filter $(comp),gcc clang)) CXXFLAGS += -flto LDFLAGS += $(CXXFLAGS) endif + +# To use LTO and static linking on windows, the tool chain requires a recent gcc: +# gcc version 10.1 in msys2 or TDM-GCC version 9.2 are know to work, older might not. +# So, only enable it for a cross from Linux by default. + ifeq ($(comp),mingw) + ifeq ($(KERNEL),Linux) + CXXFLAGS += -flto + LDFLAGS += $(CXXFLAGS) + endif + endif endif endif