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
28 SYSROOT_ARCH := $(ARCH)
30 TRIPLE := $(ARCH)-none-linux-android
33 ifeq "$(findstring 86,$(ARCH))" "86"
34 TOOLCHAIN_DIR := $(STL_ARCH)-4.9
35 else ifeq "$(ARCH)" "arm"
36 TOOLCHAIN_DIR := arm-linux-androideabi-4.9
38 TOOLCHAIN_DIR := $(subst -none,,$(TRIPLE))-4.9
42 TOOL_PREFIX := arm-linux-androideabi
44 TOOL_PREFIX := $(subst -none,,$(TRIPLE))
47 ifeq "$(HOST_OS)" "Linux"
48 HOST_TAG := linux-x86_64
49 else ifeq "$(HOST_OS)" "Darwin"
50 HOST_TAG := darwin-x86_64
52 HOST_TAG := windows-x86_64
55 GCC_TOOLCHAIN = $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
57 OBJCOPY ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-objcopy
58 ARCHIVER ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-ar
60 ifeq "$(findstring clang,$(CC))" "clang"
61 ARCH_CFLAGS += -target $(TRIPLE) --gcc-toolchain=$(GCC_TOOLCHAIN)
62 ARCH_LDFLAGS += -target $(TRIPLE) --gcc-toolchain=$(GCC_TOOLCHAIN)
65 ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sysroot \
66 -isystem $(NDK_ROOT)/sysroot/usr/include/$(TOOL_PREFIX) \
67 -D__ANDROID_API__=$(API_LEVEL) \
68 -isystem $(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH)/usr/include
70 ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
73 -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
74 -isystem $(NDK_ROOT)/sources/android/support/include \
75 -isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
78 -L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
79 $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \