# optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
# arch = (name) --- (-arch) --- Target architecture
# bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
-# prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch x86 asm-instruction
-# 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
+# prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction
+# popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction
# sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions
# pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction
#
debug = no
bits = 32
prefetch = no
-bsfq = no
popcnt = no
sse = no
pext = no
arch = x86_64
bits = 64
prefetch = yes
- bsfq = yes
sse = yes
endif
arch = x86_64
bits = 64
prefetch = yes
- bsfq = yes
popcnt = yes
sse = yes
endif
arch = x86_64
bits = 64
prefetch = yes
- bsfq = yes
popcnt = yes
sse = yes
pext = yes
ifeq ($(ARCH),armv7)
arch = armv7
prefetch = yes
- bsfq = yes
endif
ifeq ($(ARCH),ppc-32)
ifeq ($(COMP),gcc)
comp=gcc
CXX=g++
- CXXFLAGS += -pedantic -Wextra -Wshadow
+ CXXFLAGS += -pedantic -Wextra -Wshadow -m$(bits)
ifneq ($(UNAME),Darwin)
LDFLAGS += -Wl,--no-as-needed
endif
ifeq ($(COMP),clang)
comp=clang
CXX=clang++
- CXXFLAGS += -pedantic -Wextra -Wshadow
+ CXXFLAGS += -pedantic -Wextra -Wshadow -m$(bits)
+ LDFLAGS += -m$(bits)
ifeq ($(UNAME),Darwin)
- CXXFLAGS += -std=c++0x -stdlib=libc++
- DEPENDFLAGS += -std=c++0x -stdlib=libc++
+ CXXFLAGS += -stdlib=libc++
+ DEPENDFLAGS += -stdlib=libc++
endif
endif
### Travis CI script uses COMPILER to overwrite CXX
ifdef COMPILER
- CXX=$(COMPILER)
+ COMPCXX=$(COMPILER)
+endif
+
+### Allow overwriting CXX from command line
+ifdef COMPCXX
+ CXX=$(COMPCXX)
endif
### On mingw use Windows threads, otherwise POSIX
CXXFLAGS += -DNO_PREFETCH
endif
-### 3.8 bsfq
-ifeq ($(bsfq),yes)
- CXXFLAGS += -DUSE_BSFQ
-endif
-
### 3.9 popcnt
ifeq ($(popcnt),yes)
ifeq ($(comp),icc)
@echo ""
@echo "To compile stockfish, type: "
@echo ""
- @echo "make target ARCH=arch [COMP=comp]"
+ @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]"
@echo ""
@echo "Supported targets:"
@echo ""
@echo "clang > LLVM Clang compiler"
@echo "icc > Intel compiler"
@echo ""
- @echo "Examples. If you don't know what to do, you likely want to run: "
+ @echo "Simple examples. If you don't know what to do, you likely want to run: "
@echo ""
@echo "make build ARCH=x86-64 (This is for 64-bit systems)"
@echo "make build ARCH=x86-32 (This is for 32-bit systems)"
@echo ""
+ @echo "Advanced examples, for experienced users: "
+ @echo ""
+ @echo "make build ARCH=x86-64 COMP=clang"
+ @echo "make profile-build ARCH=x86-64-modern COMP=gcc COMPCXX=g++-4.8"
+ @echo ""
+
.PHONY: build profile-build
build:
@echo "arch: '$(arch)'"
@echo "bits: '$(bits)'"
@echo "prefetch: '$(prefetch)'"
- @echo "bsfq: '$(bsfq)'"
@echo "popcnt: '$(popcnt)'"
@echo "sse: '$(sse)'"
@echo "pext: '$(pext)'"
test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "armv7"
@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 "$(pext)" = "yes" || test "$(pext)" = "no"