X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2FMakefile;h=ee4374d8610462c22ef7cc54e95c435f6a3e221f;hp=71aa7b30d195370738bcab3705f4385b7328b308;hb=55df3fa2d7631ed67e46f9433aa7f3a71c18e5e7;hpb=b93693b831e7c8a4f870f77d48e2fe6c7b1ed96a diff --git a/src/Makefile b/src/Makefile index 71aa7b30..ee4374d8 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 @@ -32,7 +39,7 @@ PGOBENCH = ./$(EXE) bench 32 1 10 default depth ### Object files OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \ - material.o misc.o move.o movegen.o movepick.o pawns.o position.o \ + material.o misc.o movegen.o movepick.o notation.o pawns.o position.o \ search.o thread.o timeman.o tt.o uci.o ucioption.o ### ========================================================================== @@ -51,6 +58,7 @@ OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \ # bsfq = yes/no --- -DUSE_BSFQ --- Use bsfq x86_64 asm-instruction (only # with GCC and ICC 64-bit) # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt x86_64 asm-instruction +# sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions # # Note that Makefile is space sensitive, so when adding new architectures # or modifying existing flags, you have to make sure there are no extra spaces @@ -70,6 +78,7 @@ ifeq ($(ARCH),general-64) prefetch = no bsfq = no popcnt = no + sse = no endif ifeq ($(ARCH),general-32) @@ -79,6 +88,7 @@ ifeq ($(ARCH),general-32) prefetch = no bsfq = no popcnt = no + sse = no endif # x86-section @@ -89,6 +99,7 @@ ifeq ($(ARCH),x86-64) prefetch = yes bsfq = yes popcnt = no + sse = yes endif ifeq ($(ARCH),x86-64-modern) @@ -98,6 +109,7 @@ ifeq ($(ARCH),x86-64-modern) prefetch = yes bsfq = yes popcnt = yes + sse = yes endif ifeq ($(ARCH),x86-32) @@ -107,6 +119,7 @@ ifeq ($(ARCH),x86-32) prefetch = yes bsfq = no popcnt = no + sse = yes endif ifeq ($(ARCH),x86-32-old) @@ -116,6 +129,18 @@ ifeq ($(ARCH),x86-32-old) prefetch = no bsfq = no popcnt = no + sse = no +endif + +#arm section +ifeq ($(ARCH),armv7) + arch = armv7 + os = any + bits = 32 + prefetch = yes + bsfq = yes + popcnt = no + sse = no endif # osx-section @@ -126,6 +151,7 @@ ifeq ($(ARCH),osx-ppc-64) prefetch = no bsfq = no popcnt = no + sse = no endif ifeq ($(ARCH),osx-ppc-32) @@ -135,6 +161,7 @@ ifeq ($(ARCH),osx-ppc-32) prefetch = no bsfq = no popcnt = no + sse = no endif ifeq ($(ARCH),osx-x86-64) @@ -144,6 +171,7 @@ ifeq ($(ARCH),osx-x86-64) prefetch = yes bsfq = yes popcnt = no + sse = yes endif ifeq ($(ARCH),osx-x86-32) @@ -153,6 +181,7 @@ ifeq ($(ARCH),osx-x86-32) prefetch = yes bsfq = no popcnt = no + sse = yes endif @@ -221,7 +250,7 @@ ifeq ($(comp),clang) endif ifeq ($(os),osx) - CXXFLAGS += -arch $(arch) + CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.0 endif ### 3.3 General linker settings @@ -229,11 +258,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.0 endif ### 3.4 Debugging @@ -255,6 +287,10 @@ ifeq ($(optimize),yes) CXXFLAGS += -mdynamic-no-pic endif endif + + ifeq ($(arch),armv7) + CXXFLAGS += -fno-gcse + endif endif ifeq ($(comp),mingw) @@ -270,6 +306,7 @@ ifeq ($(optimize),yes) endif ifeq ($(comp),clang) + ### -O4 requires a linker that supports LLVM's LTO CXXFLAGS += -O3 ifeq ($(os),osx) @@ -290,8 +327,10 @@ endif ### 3.7 prefetch ifeq ($(prefetch),yes) - CXXFLAGS += -msse - DEPENDFLAGS += -msse + ifeq ($(sse),yes) + CXXFLAGS += -msse + DEPENDFLAGS += -msse + endif else CXXFLAGS += -DNO_PREFETCH endif @@ -310,11 +349,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 @@ -347,6 +388,7 @@ help: @echo "osx-ppc-32 > PPC-Mac OS X 32 bit" @echo "osx-x86-64 > x86-Mac OS X 64 bit" @echo "osx-x86-32 > x86-Mac OS X 32 bit" + @echo "armv7 > ARMv7 32 bit" @echo "general-64 > unspecified 64-bit" @echo "general-32 > unspecified 32-bit" @echo "" @@ -425,6 +467,7 @@ config-sanity: @echo "prefetch: '$(prefetch)'" @echo "bsfq: '$(bsfq)'" @echo "popcnt: '$(popcnt)'" + @echo "sse: '$(sse)'" @echo "" @echo "Flags:" @echo "CXX: $(CXX)" @@ -436,12 +479,13 @@ config-sanity: @test "$(debug)" = "yes" || test "$(debug)" = "no" @test "$(optimize)" = "yes" || test "$(optimize)" = "no" @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \ - test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" + test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "armv7" @test "$(os)" = "any" || test "$(os)" = "osx" @test "$(bits)" = "32" || test "$(bits)" = "64" @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no" @test "$(bsfq)" = "yes" || test "$(bsfq)" = "no" @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no" + @test "$(sse)" = "yes" || test "$(sse)" = "no" @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" $(EXE): $(OBJS)