diff --git a/lldb/packages/Python/lldbsuite/test/make/Android.rules b/lldb/packages/Python/lldbsuite/test/make/Android.rules new file mode 100644 index 000000000000..82aaa02a047f --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/make/Android.rules @@ -0,0 +1,43 @@ +NDK_ROOT := $(shell dirname $(CC))/../../../../.. +NDK_ROOT := $(realpath $(NDK_ROOT)) + +ifeq "$(findstring 64, $(ARCH))" "64" + # lowest 64-bit API level + API_LEVEL := 21 +else ifeq "$(ARCH)" "i386" + # clone(2) declaration is present only since this api level + API_LEVEL := 17 +else + # lowest supported 32-bit API level + API_LEVEL := 9 +endif + +ifeq "$(ARCH)" "arm" + SYSROOT_ARCH := arm + STL_ARCH := armeabi-v7a + ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm +else ifeq "$(ARCH)" "aarch64" + SYSROOT_ARCH := arm64 + STL_ARCH := arm64-v8a +else ifeq "$(ARCH)" "i386" + SYSROOT_ARCH := x86 + STL_ARCH := x86 +else ifeq "$(ARCH)" "mips64r6" + SYSROOT_ARCH := mips64 + STL_ARCH := mips64 +else ifeq "$(ARCH)" "mips32" + SYSROOT_ARCH := mips + STL_ARCH := mips +else + SYSROOT_ARCH := $(ARCH) + STL_ARCH := $(ARCH) +endif + +ARCH_CFLAGS += \ + --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) \ + -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \ + -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \ + -isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward +ARCH_LDFLAGS += -lm \ + $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a \ + --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 5abbc85e649b..4387a840ead0 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -35,7 +35,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../ # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more # from the triple alone #---------------------------------------------------------------------- -TRIPLE_CFLAGS := +ARCH_CFLAGS := ifneq "$(TRIPLE)" "" triple_space = $(subst -, ,$(TRIPLE)) ARCH =$(word 1, $(triple_space)) @@ -52,18 +52,21 @@ ifneq "$(TRIPLE)" "" ifeq "$(TRIPLE_VERSION)" "" TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/') endif - TRIPLE_CFLAGS :=-mios-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" + ARCH_CFLAGS :=-mios-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" else SDKROOT = $(shell xcrun --sdk iphonesimulator --show-sdk-path) ifeq "$(TRIPLE_VERSION)" "" TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/') endif - TRIPLE_CFLAGS :=-mios-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" + ARCH_CFLAGS :=-mios-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" endif endif endif endif endif +ifeq "$(OS)" "Android" + include $(THIS_FILE_DIR)/Android.rules +endif #---------------------------------------------------------------------- # If OS is not defined, use 'uname -s' to determine the OS name. @@ -199,13 +202,13 @@ else CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include endif -CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS) +CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(ARCH_CFLAGS) # Use this one if you want to build one part of the result without debug information: ifeq "$(OS)" "Darwin" - CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS) + CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(ARCH_CFLAGS) else - CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS) + CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(ARCH_CFLAGS) endif ifeq "$(MAKE_DWO)" "YES" @@ -221,7 +224,7 @@ CXXFLAGS += -std=c++11 CXXFLAGS += $(subst -fmodules,, $(CFLAGS)) LD = $(CC) LDFLAGS ?= $(CFLAGS) -LDFLAGS += $(LD_EXTRAS) +LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS) ifeq (,$(filter $(OS), Windows_NT Android)) ifneq (,$(filter YES,$(ENABLE_THREADS))) LDFLAGS += -pthread