X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2FMakefile;h=8c2c6a7028392642c5156cd92ee4329c72b4b899;hb=ff9ca3e76eb6432dee8ed2442e3942b93d0f6ba5;hp=2a03492fa863b6e2fdd5984026a873c8cd24c86e;hpb=7b4aa1070882cba085c9d6ed03d934734c395fe5;p=stockfish diff --git a/src/Makefile b/src/Makefile index 2a03492f..8c2c6a70 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,11 +20,18 @@ ### Section 1. General Configuration ### ========================================================================== +### Establish the operating system name +UNAME = $(shell uname) + ### Executable name EXE = stockfish ### Installation dir definitions PREFIX = /usr/local +# Haiku has a non-standard filesystem layout +ifeq ($(UNAME),Haiku) + PREFIX=/boot/common +endif BINDIR = $(PREFIX)/bin ### Built-in benchmark for pgo-builds @@ -168,6 +175,7 @@ endif ifeq ($(COMP),mingw) comp=mingw CXX=g++ + prefetch = yes profile_prepare = gcc-profile-prepare profile_make = gcc-profile-make profile_use = gcc-profile-use @@ -177,6 +185,7 @@ endif ifeq ($(COMP),gcc) comp=gcc CXX=g++ + prefetch = yes profile_prepare = gcc-profile-prepare profile_make = gcc-profile-make profile_use = gcc-profile-use @@ -195,6 +204,7 @@ endif ifeq ($(COMP),clang) comp=clang CXX=clang++ + prefetch = yes profile_prepare = gcc-profile-prepare profile_make = gcc-profile-make profile_use = gcc-profile-use @@ -229,7 +239,10 @@ LDFLAGS = $(EXTRALDFLAGS) ### On mingw use Windows threads, otherwise POSIX ifneq ($(comp),mingw) - LDFLAGS += -lpthread + # Haiku has pthreads in its libroot, so only link it in on other platforms + ifneq ($(UNAME),Haiku) + LDFLAGS += -lpthread + endif endif ifeq ($(os),osx) @@ -270,7 +283,8 @@ ifeq ($(optimize),yes) endif ifeq ($(comp),clang) - CXXFLAGS += -O4 + ### -O4 requires a linker that supports LLVM's LTO + CXXFLAGS += -O3 ifeq ($(os),osx) ifeq ($(arch),i386) @@ -310,11 +324,13 @@ endif ### This is a mix of compile and link time options because the lto link phase ### needs access to the optimization flags. ifeq ($(comp),gcc) - GCC_MAJOR := `$(CXX) -dumpversion | cut -f1 -d.` - GCC_MINOR := `$(CXX) -dumpversion | cut -f2 -d.` - ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \))) - CXXFLAGS += -flto - LDFLAGS += $(CXXFLAGS) + ifeq ($(optimize),yes) + GCC_MAJOR := `$(CXX) -dumpversion | cut -f1 -d.` + GCC_MINOR := `$(CXX) -dumpversion | cut -f2 -d.` + ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \))) + CXXFLAGS += -flto + LDFLAGS += $(CXXFLAGS) + endif endif endif