1 NDK_ROOT := $(shell dirname $(CC))/../../../../..
3 ifeq "$(findstring 64, $(ARCH))" "64"
4 # lowest 64-bit API level
6 else ifeq "$(ARCH)" "i386"
7 # clone(2) declaration is present only since this api level
10 # lowest supported 32-bit API level
16 STL_ARCH := armeabi-v7a
17 TRIPLE := armv7-none-linux-androideabi
18 ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
19 else ifeq "$(ARCH)" "aarch64"
22 TRIPLE := aarch64-none-linux-android
23 else ifeq "$(ARCH)" "i386"
26 TRIPLE := i686-none-linux-android
27 else ifeq "$(ARCH)" "mips64r6"
28 SYSROOT_ARCH := mips64
30 TRIPLE := mips64el-none-linux-android
31 else ifeq "$(ARCH)" "mips32"
34 TRIPLE := mipsel-none-linux-android
36 SYSROOT_ARCH := $(ARCH)
38 TRIPLE := $(ARCH)-none-linux-android
41 ifeq "$(findstring 86,$(ARCH))" "86"
42 TOOLCHAIN_DIR := $(STL_ARCH)-4.9
43 else ifeq "$(ARCH)" "arm"
44 TOOLCHAIN_DIR := arm-linux-androideabi-4.9
46 TOOLCHAIN_DIR := $(subst -none,,$(TRIPLE))-4.9
50 TOOL_PREFIX := arm-linux-androideabi
52 TOOL_PREFIX := $(subst -none,,$(TRIPLE))
55 ifeq "$(HOST_OS)" "Linux"
56 HOST_TAG := linux-x86_64
57 else ifeq "$(HOST_OS)" "Darwin"
58 HOST_TAG := darwin-x86_64
60 HOST_TAG := windows-x86_64
63 GCC_TOOLCHAIN = $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
65 OBJCOPY ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-objcopy
66 ARCHIVER ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-ar
68 ifeq "$(findstring clang,$(CC))" "clang"
69 ARCH_CFLAGS += -target $(TRIPLE) -gcc-toolchain $(GCC_TOOLCHAIN)
70 ARCH_LDFLAGS += -target $(TRIPLE) -gcc-toolchain $(GCC_TOOLCHAIN)
73 ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
74 -isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
75 -D__ANDROID_API__=$(API_LEVEL) \
76 -isystem $(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)/usr/include
78 ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
81 -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
82 -isystem $(NDK_ROOT)/sources/android/support/include \
83 -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
86 -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
87 $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \