The target:
Odroid U3 (http://www.hardkernel.com/main/products/prdt_info.php?g_code=g138745696275)
Debian Jessie
As listed in #550 and #638 three modifications are needed for compilation to work:
float-abi flag for GCC If an FPU is present and supported by the installed os then passed value need to be hard.
I didn't find any better solution than using readelf to check for the availibilty of Tag_ABI_VFP_args which sould indicate support for the FPU. The check is only done if the arch is arm and if readelf is not present
on the system, there will be an error (/bin/sh: 1: readelf: not found) but it will not break and will continue with the default softfp value. Outputing the error is not really acceptable but I wanted some feedback on the
check itself.
-lpthread is needed on armv7 outside of Android
I replaced UNAME with KERNEL and OS to allow to differentiate Android.
m32 flag
My understanding is that outside of Android the flag is generating errors on armv7.
These modifications should introduce change only for non Android armv7 build.
No functional change.
### ==========================================================================
### Establish the operating system name
### ==========================================================================
### Establish the operating system name
+KERNEL = $(shell uname -s)
+ifneq ($(KERNEL),Darwin)
+ OS = $(shell uname -o)
+endif
### Executable name
EXE = stockfish
### Executable name
EXE = stockfish
ifeq ($(COMP),gcc)
comp=gcc
CXX=g++
ifeq ($(COMP),gcc)
comp=gcc
CXX=g++
- CXXFLAGS += -pedantic -Wextra -Wshadow -m$(bits)
- ifneq ($(UNAME),Darwin)
+ CXXFLAGS += -pedantic -Wextra -Wshadow
+
+ ifeq ($(ARCH),armv7)
+ ifeq ($(OS),Android)
+ CXXFLAGS += -m$(bits)
+ endif
+ else
+ CXXFLAGS += -m$(bits)
+ endif
+
+ ifneq ($(KERNEL),Darwin)
LDFLAGS += -Wl,--no-as-needed
endif
endif
LDFLAGS += -Wl,--no-as-needed
endif
endif
ifeq ($(COMP),mingw)
comp=mingw
ifeq ($(COMP),mingw)
comp=mingw
ifeq ($(bits),64)
ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
CXX=x86_64-w64-mingw32-c++
ifeq ($(bits),64)
ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
CXX=x86_64-w64-mingw32-c++
ifeq ($(COMP),clang)
comp=clang
CXX=clang++
ifeq ($(COMP),clang)
comp=clang
CXX=clang++
- CXXFLAGS += -pedantic -Wextra -Wshadow -m$(bits)
- LDFLAGS += -m$(bits)
- ifeq ($(UNAME),Darwin)
+ CXXFLAGS += -pedantic -Wextra -Wshadow
+
+ ifeq ($(ARCH),armv7)
+ ifeq ($(OS),Android)
+ CXXFLAGS += -m$(bits)
+ LDFLAGS += -m$(bits)
+ endif
+ else
+ CXXFLAGS += -m$(bits)
+ LDFLAGS += -m$(bits)
+ endif
+
+ ifeq ($(KERNEL),Darwin)
CXXFLAGS += -stdlib=libc++
DEPENDFLAGS += -stdlib=libc++
endif
CXXFLAGS += -stdlib=libc++
DEPENDFLAGS += -stdlib=libc++
endif
profile_clean = gcc-profile-clean
endif
profile_clean = gcc-profile-clean
endif
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9
LDFLAGS += -arch $(arch) -mmacosx-version-min=10.9
endif
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9
LDFLAGS += -arch $(arch) -mmacosx-version-min=10.9
endif
### On mingw use Windows threads, otherwise POSIX
ifneq ($(comp),mingw)
# On Android Bionic's C library comes with its own pthread implementation bundled in
### On mingw use Windows threads, otherwise POSIX
ifneq ($(comp),mingw)
# On Android Bionic's C library comes with its own pthread implementation bundled in
# Haiku has pthreads in its libroot, so only link it in on other platforms
# Haiku has pthreads in its libroot, so only link it in on other platforms
+ ifneq ($(KERNEL),Haiku)
LDFLAGS += -lpthread
endif
endif
LDFLAGS += -lpthread
endif
endif
+ ifeq ($(KERNEL),Darwin)
ifeq ($(arch),i386)
CXXFLAGS += -mdynamic-no-pic
endif
ifeq ($(arch),i386)
CXXFLAGS += -mdynamic-no-pic
endif
CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
endif
endif
ifeq ($(comp),icc)
CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
endif
endif
ifeq ($(comp),icc)
+ ifeq ($(KERNEL),Darwin)
CXXFLAGS += -mdynamic-no-pic
endif
endif
ifeq ($(comp),clang)
CXXFLAGS += -mdynamic-no-pic
endif
endif
ifeq ($(comp),clang)
+ ifeq ($(KERNEL),Darwin)
ifeq ($(pext),no)
CXXFLAGS += -flto
LDFLAGS += $(CXXFLAGS)
ifeq ($(pext),no)
CXXFLAGS += -flto
LDFLAGS += $(CXXFLAGS)
endif
ifeq ($(comp),mingw)
endif
ifeq ($(comp),mingw)
ifeq ($(optimize),yes)
ifeq ($(debug),no)
CXXFLAGS += -flto
ifeq ($(optimize),yes)
ifeq ($(debug),no)
CXXFLAGS += -flto
### 3.9 Android 5 can only run position independent executables. Note that this
### breaks Android 4.0 and earlier.
### 3.9 Android 5 can only run position independent executables. Note that this
### breaks Android 4.0 and earlier.
CXXFLAGS += -fPIE
LDFLAGS += -fPIE -pie
endif
CXXFLAGS += -fPIE
LDFLAGS += -fPIE -pie
endif
@echo "optimize: '$(optimize)'"
@echo "arch: '$(arch)'"
@echo "bits: '$(bits)'"
@echo "optimize: '$(optimize)'"
@echo "arch: '$(arch)'"
@echo "bits: '$(bits)'"
+ @echo "kernel: '$(KERNEL)'"
+ @echo "os: '$(OS)'"
@echo "prefetch: '$(prefetch)'"
@echo "popcnt: '$(popcnt)'"
@echo "sse: '$(sse)'"
@echo "prefetch: '$(prefetch)'"
@echo "popcnt: '$(popcnt)'"
@echo "sse: '$(sse)'"