]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Improve compatibility with older versions of Mac OS X
[stockfish] / src / Makefile
index dea8db04675e66d26b21e4c755f91df217ae85e3..fc6a4fae3fb81254460882a0d0b5e4709676b41e 100644 (file)
 ### 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
@@ -221,7 +231,7 @@ ifeq ($(comp),clang)
 endif
 
 ifeq ($(os),osx)
-       CXXFLAGS += -arch $(arch)
+       CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.6
 endif
 
 ### 3.3 General linker settings
@@ -229,11 +239,14 @@ 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)
-       LDFLAGS += -arch $(arch)
+       LDFLAGS += -arch $(arch) -mmacosx-version-min=10.6
 endif
 
 ### 3.4 Debugging
@@ -311,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