Android.rules: add support for clang compiler
Summary: building executables with the NDK clang requires -target and -gcc-toolchain arguments. Reviewers: eugene, danalbert Subscribers: srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D30574 llvm-svn: 297145
This commit is contained in:
parent
3770763cda
commit
8faf9b750a
|
@ -14,22 +14,51 @@ endif
|
||||||
ifeq "$(ARCH)" "arm"
|
ifeq "$(ARCH)" "arm"
|
||||||
SYSROOT_ARCH := arm
|
SYSROOT_ARCH := arm
|
||||||
STL_ARCH := armeabi-v7a
|
STL_ARCH := armeabi-v7a
|
||||||
|
TRIPLE_ARCH := armv7
|
||||||
ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
|
ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
|
||||||
else ifeq "$(ARCH)" "aarch64"
|
else ifeq "$(ARCH)" "aarch64"
|
||||||
SYSROOT_ARCH := arm64
|
SYSROOT_ARCH := arm64
|
||||||
|
TRIPLE_ARCH := aarch64
|
||||||
STL_ARCH := arm64-v8a
|
STL_ARCH := arm64-v8a
|
||||||
else ifeq "$(ARCH)" "i386"
|
else ifeq "$(ARCH)" "i386"
|
||||||
SYSROOT_ARCH := x86
|
SYSROOT_ARCH := x86
|
||||||
STL_ARCH := x86
|
STL_ARCH := x86
|
||||||
|
TRIPLE_ARCH := i686
|
||||||
else ifeq "$(ARCH)" "mips64r6"
|
else ifeq "$(ARCH)" "mips64r6"
|
||||||
SYSROOT_ARCH := mips64
|
SYSROOT_ARCH := mips64
|
||||||
STL_ARCH := mips64
|
STL_ARCH := mips64
|
||||||
|
TRIPLE_ARCH := mips64el
|
||||||
else ifeq "$(ARCH)" "mips32"
|
else ifeq "$(ARCH)" "mips32"
|
||||||
SYSROOT_ARCH := mips
|
SYSROOT_ARCH := mips
|
||||||
STL_ARCH := mips
|
STL_ARCH := mips
|
||||||
|
TRIPLE_ARCH := mipsel
|
||||||
else
|
else
|
||||||
SYSROOT_ARCH := $(ARCH)
|
SYSROOT_ARCH := $(ARCH)
|
||||||
STL_ARCH := $(ARCH)
|
STL_ARCH := $(ARCH)
|
||||||
|
TRIPLE_ARCH := $(ARCH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(findstring 86,$(ARCH))" "86"
|
||||||
|
TOOLCHAIN_DIR := $(STL_ARCH)-4.9
|
||||||
|
else
|
||||||
|
TOOLCHAIN_DIR := $(TRIPLE_ARCH)-linux-android-4.9
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(HOST_OS)" "Linux"
|
||||||
|
HOST_TAG := linux-x86_64
|
||||||
|
else ifeq "$(HOST_OS)" "Darwin"
|
||||||
|
HOST_TAG := darwin-x86_64
|
||||||
|
else
|
||||||
|
HOST_TAG := windows-x86_64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(findstring clang,$(CC))" "clang"
|
||||||
|
ARCH_CFLAGS += \
|
||||||
|
-target $(TRIPLE_ARCH)-none-linux-android \
|
||||||
|
-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
|
||||||
|
ARCH_LDFLAGS += \
|
||||||
|
-target $(TRIPLE_ARCH)-none-linux-android \
|
||||||
|
-gcc-toolchain $(NDK_ROOT)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ARCH_CFLAGS += \
|
ARCH_CFLAGS += \
|
||||||
|
|
|
@ -31,6 +31,22 @@ THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
|
||||||
LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../
|
LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# If OS is not defined, use 'uname -s' to determine the OS name.
|
||||||
|
#
|
||||||
|
# uname on Windows gives "windows32", but most environments standardize
|
||||||
|
# on "Windows_NT", so we'll make it consistent here. When running
|
||||||
|
# tests from Visual Studio, the environment variable isn't inherited
|
||||||
|
# all the way down to the process spawned for make.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
HOST_OS = $(shell uname -s)
|
||||||
|
ifeq "$(HOST_OS)" "windows32"
|
||||||
|
HOST_OS = Windows_NT
|
||||||
|
endif
|
||||||
|
ifeq "$(OS)" ""
|
||||||
|
OS = $(HOST_OS)
|
||||||
|
endif
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
|
# If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
|
||||||
# from the triple alone
|
# from the triple alone
|
||||||
|
@ -68,22 +84,6 @@ ifeq "$(OS)" "Android"
|
||||||
include $(THIS_FILE_DIR)/Android.rules
|
include $(THIS_FILE_DIR)/Android.rules
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# If OS is not defined, use 'uname -s' to determine the OS name.
|
|
||||||
#
|
|
||||||
# uname on Windows gives "windows32", but most environments standardize
|
|
||||||
# on "Windows_NT", so we'll make it consistent here. When running
|
|
||||||
# tests from Visual Studio, the environment variable isn't inherited
|
|
||||||
# all the way down to the process spawned for make.
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
HOST_OS = $(shell uname -s)
|
|
||||||
ifeq "$(HOST_OS)" "windows32"
|
|
||||||
HOST_OS = Windows_NT
|
|
||||||
endif
|
|
||||||
ifeq "$(OS)" ""
|
|
||||||
OS = $(HOST_OS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# If ARCH is not defined, default to x86_64.
|
# If ARCH is not defined, default to x86_64.
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue