### 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
ifeq ($(COMP),mingw)
comp=mingw
CXX=g++
+ prefetch = yes
profile_prepare = gcc-profile-prepare
profile_make = gcc-profile-make
profile_use = gcc-profile-use
ifeq ($(COMP),gcc)
comp=gcc
CXX=g++
+ prefetch = yes
profile_prepare = gcc-profile-prepare
profile_make = gcc-profile-make
profile_use = gcc-profile-use
ifeq ($(COMP),clang)
comp=clang
CXX=clang++
+ prefetch = yes
profile_prepare = gcc-profile-prepare
profile_make = gcc-profile-make
profile_use = gcc-profile-use
endif
ifeq ($(os),osx)
- CXXFLAGS += -arch $(arch)
+ CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.6
endif
### 3.3 General linker settings
### 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)
- LDFLAGS += -arch $(arch)
+ LDFLAGS += -arch $(arch) -mmacosx-version-min=10.6
endif
### 3.4 Debugging
### 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