-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile.android
63 lines (55 loc) · 3.02 KB
/
Makefile.android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
APINAME = android-23
APIJAR = ${ANDROID_SDK_ROOT}/platforms/${APINAME}/android.jar
GPSJAR = ${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar
API = android-9
SDK = ${ANDROID_SDK_ROOT}
NDK = ${ANDROID_NDK_ROOT}
UNAME := $(shell uname)
HOST := $(shell echo ${UNAME} | tr '[:upper:]' '[:lower:]')-x86_64
LLVM_VERSION = 3.5
LLVM_TOOLCHAIN := llvm-${LLVM_VERSION}
GCC_VERSION = 4.8
ifeq (${ABI}, x86)
NDK_ARCH := arch-x86
GCC_BIN_PREFIX := i686-linux-android-
GCC_TOOLCHAIN := x86-${GCC_VERSION}
CPPFLAGS := ${CPPFLAGS} -target i686-none-linux-android
LLVM_FLAGS = -gcc-toolchain ${GCC_TOOLCHAIN_PATH}
else ifeq (${ABI}, mips)
NDK_ARCH := arch-mips
GCC_BIN_PREFIX := mipsel-linux-android-
GCC_TOOLCHAIN := mipsel-linux-android-${GCC_VERSION}
CPPFLAGS := ${CPPFLAGS} -target mipsel-none-linux-android
LLVM_FLAGS = -gcc-toolchain ${GCC_TOOLCHAIN_PATH}
else
NDK_ARCH := arch-arm
GCC_BIN_PREFIX := arm-linux-androideabi-
GCC_TOOLCHAIN := arm-linux-androideabi-${GCC_VERSION}
CPPFLAGS := ${CPPFLAGS} -marm
LLVM_FLAGS = -gcc-toolchain ${GCC_TOOLCHAIN_PATH}
ifeq (${ABI}, armeabi)
DEFINES := ${DEFINES} -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__
CPPFLAGS := ${CPPFLAGS} -target armv5te-none-linux-androideabi -march=armv5te -mtune=xscale -mfloat-abi=soft
else
override ABI = armeabi-v7a
DEFINES := ${DEFINES} -DARCH_ARMEABIV7A
CPPFLAGS := ${CPPFLAGS} -target armv5te-none-linux-androideabi-v7a -march=armv7-a -mfpu=vfp -mfloat-abi=softfp
LDFLAGS := -Wl,--fix-cortex-a8
endif
endif
DEFINES := ${DEFINES} -DANDROID
override PLATFORM = android/${ABI}
LLVM_TOOLCAHIN_PATH = ${NDK}/toolchains/${LLVM_TOOLCHAIN}/prebuilt/${HOST}
GCC_TOOLCHAIN_PATH = ${NDK}/toolchains/${GCC_TOOLCHAIN}/prebuilt/${HOST}
LLVM_TOOL_PREFIX = ${LLVM_TOOLCAHIN_PATH}/bin/
GCC_TOOL_PREFIX = ${GCC_TOOLCHAIN_PATH}/bin/${GCC_BIN_PREFIX}
SYSROOT = ${NDK}/platforms/${API}/${NDK_ARCH}
CPPFLAGS := ${CPPFLAGS} --sysroot=${SYSROOT} -fpic -ffunction-sections -fdata-sections -fstrict-aliasing -fvisibility=hidden -MMD
CXXFLAGS := ${CXXFLAGS} -fno-rtti -fno-exceptions
LDFLAGS := ${LDFLAGS} --sysroot=${SYSROOT} -Wl,--no-undefined -Wl,--gc-sections
CXX = ${LLVM_TOOL_PREFIX}clang++ ${DEFINES} ${LLVM_FLAGS}
CC = ${LLVM_TOOL_PREFIX}clang ${DEFINES} ${LLVM_FLAGS}
STRIP = ${LLVM_TOOL_PREFIX}strip ${STRIPFLAGS}
LD = ${LLVM_TOOL_PREFIX}clang++ ${LDFLAGS} ${LLVM_FLAGS}
AR = ${GCC_TOOL_PREFIX}ar crs
export CPPFLAGS CXXFLAGS LDFLAGS CXX CC STRIP LD AR DEFINES PLATFORM