Debian Codegraph @

lldb/packages/Python/lldbsuite/test/make/Android.rules

raw
1 NDK_ROOT := $(shell dirname $(CC))/../../../../..
2
3 ifeq "$(findstring 64, $(ARCH))" "64"
4 # lowest 64-bit API level
5 API_LEVEL := 21
6 else ifeq "$(ARCH)" "i386"
7 # clone(2) declaration is present only since this api level
8 API_LEVEL := 17
9 else
10 # lowest supported 32-bit API level
11 API_LEVEL := 16
12 endif
13
14 ifeq "$(ARCH)" "arm"
15 SYSROOT_ARCH := arm
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"
20 SYSROOT_ARCH := arm64
21 STL_ARCH := arm64-v8a
22 TRIPLE := aarch64-none-linux-android
23 else ifeq "$(ARCH)" "i386"
24 SYSROOT_ARCH := x86
25 STL_ARCH := x86
26 TRIPLE := i686-none-linux-android
27 else
28 SYSROOT_ARCH := $(ARCH)
29 STL_ARCH := $(ARCH)
30 TRIPLE := $(ARCH)-none-linux-android
31 endif
32
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
37 else
38 TOOLCHAIN_DIR := $(subst -none,,$(TRIPLE))-4.9
39 endif
40
41 ifeq "$(ARCH)" "arm"
42 TOOL_PREFIX := arm-linux-androideabi
43 else
44 TOOL_PREFIX := $(subst -none,,$(TRIPLE))
45 endif
46
47 ifeq "$(HOST_OS)" "Linux"
48 HOST_TAG := linux-x86_64
49 else ifeq "$(HOST_OS)" "Darwin"
50 HOST_TAG := darwin-x86_64
51 else
52 HOST_TAG := windows-x86_64
53 endif
54
55 GCC_TOOLCHAIN = $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
56
57 OBJCOPY ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-objcopy
58 ARCHIVER ?= $(GCC_TOOLCHAIN)/bin/$(TOOL_PREFIX)-ar
59
60 ifeq "$(findstring clang,$(CC))" "clang"
61 ARCH_CFLAGS += -target $(TRIPLE) --gcc-toolchain=$(GCC_TOOLCHAIN)
62 ARCH_LDFLAGS += -target $(TRIPLE) --gcc-toolchain=$(GCC_TOOLCHAIN)
63 endif
64
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
69
70 ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
71
72 ARCH_CXXFLAGS += \
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
76
77 ARCH_LDFLAGS += \
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 \
80 -lc++abi \
81 -nostdlib++