diff --git a/core/config.mk b/core/config.mk index 5ff582a13..7ff3b368f 100644 --- a/core/config.mk +++ b/core/config.mk @@ -383,7 +383,7 @@ ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY))) endif PATH_TO_CLANG_TIDY := \ - $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy + $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy ifeq ($(wildcard $(PATH_TO_CLANG_TIDY)),) ifneq (,$(filter 1 true,$(WITH_TIDY))) $(warning *** Disable WITH_TIDY because $(PATH_TO_CLANG_TIDY) does not exist) diff --git a/core/envsetup.mk b/core/envsetup.mk index 43593e63c..acf755f15 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -116,13 +116,15 @@ HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())") BUILD_OS := $(HOST_OS) HOST_CROSS_OS := -# We can cross-build Windows binaries on Linux +# We can cross-build Windows binaries on x86 Linux ifeq ($(HOST_OS),linux) +ifeq ($(HOST_ARCH),x86) HOST_CROSS_OS := windows HOST_CROSS_ARCH := x86 HOST_CROSS_2ND_ARCH := x86_64 2ND_HOST_CROSS_IS_64_BIT := true endif +endif ifeq ($(HOST_OS),) $(error Unable to determine HOST_OS from uname -sm: $(UNAME)!) @@ -134,10 +136,15 @@ ifneq (,$(findstring x86_64,$(UNAME))) HOST_2ND_ARCH := x86 HOST_IS_64_BIT := true else +ifneq (,$(findstring aarch64,$(UNAME))) + HOST_ARCH := arm64 + HOST_IS_64_BIT := true +else ifneq (,$(findstring i686,$(UNAME))$(findstring x86,$(UNAME))) $(error Building on a 32-bit x86 host is not supported: $(UNAME)!) endif endif +endif BUILD_ARCH := $(HOST_ARCH) BUILD_2ND_ARCH := $(HOST_2ND_ARCH) @@ -157,8 +164,12 @@ $(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE) endif endif +ifneq (,$(findstring x86_64,$(UNAME))) # We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir. HOST_PREBUILT_ARCH := x86 +else +HOST_PREBUILT_ARCH := $(HOST_ARCH) +endif # This is the standard way to name a directory containing prebuilt host # objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH) diff --git a/core/main.mk b/core/main.mk index bc4ed0421..34e87f6ec 100644 --- a/core/main.mk +++ b/core/main.mk @@ -14,6 +14,12 @@ ifndef KATI host_prebuilts := linux-x86 ifeq ($(shell uname),Darwin) host_prebuilts := darwin-x86 +else +ifeq (aarch64,$(shell uname -m)) +host_prebuilts := linux-arm64 +else + $(error not arm64) +endif endif .PHONY: run_soong_ui diff --git a/core/soong_config.mk b/core/soong_config.mk index e21083d7c..09d4b5814 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -71,11 +71,11 @@ $(SOONG_VARIABLES): FORCE echo ' "DeviceSecondaryAbi": ["$(TARGET_2ND_CPU_ABI)", "$(TARGET_2ND_CPU_ABI2)"],'; \ echo ''; \ echo ' "HostArch": "$(HOST_ARCH)",'; \ - echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \ + test $(shell uname -m) = aarch64 || echo ' "HostSecondaryArch": "$(HOST_2ND_ARCH)",'; \ echo ''; \ - echo ' "CrossHost": "$(HOST_CROSS_OS)",'; \ - echo ' "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \ - echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \ + test $(shell uname -m) = aarch64 || echo ' "CrossHost": "$(HOST_CROSS_OS)",'; \ + test $(shell uname -m) = aarch64 || echo ' "CrossHostArch": "$(HOST_CROSS_ARCH)",'; \ + test $(shell uname -m) = aarch64 || echo ' "CrossHostSecondaryArch": "$(HOST_CROSS_2ND_ARCH)",'; \ echo ' "Safestack": $(if $(filter true,$(USE_SAFESTACK)),true,false),'; \ echo ' "EnableCFI": $(if $(filter false,$(ENABLE_CFI)),false,true),'; \ echo ' "Device_uses_hwc2": $(if $(filter true,$(TARGET_USES_HWC2)),true,false),'; \ --- /dev/null 2017-05-30 12:59:06.809484016 +0000 +++ core/clang/HOST_arm.mk 2017-06-08 16:05:39.563015342 +0000 @@ -0,0 +1 @@ +$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-armv7.a --- /dev/null 2017-05-30 12:59:06.809484016 +0000 +++ core/clang/HOST_arm64.mk 2017-06-08 16:05:39.564015311 +0000 @@ -0,0 +1 @@ +HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64.a --- /dev/null 2017-05-30 12:59:06.809484016 +0000 +++ core/combo/HOST_linux-arm.mk 2017-06-08 16:05:39.564015311 +0000 @@ -0,0 +1,30 @@ +# +# Copyright (C) 2006 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Configuration for builds hosted on linux-arm. +# Included by combo/select.mk + +define $(combo_var_prefix)transform-shared-lib-to-toc +$(call _gen_toc_command_for_elf,$(1),$(2)) +endef + +############################################################ +## Macros after this line are shared by the 64-bit config. + +# $(1): The file to check +define get-file-size +stat --format "%s" "$(1)" | tr -d '\n' +endef --- /dev/null 2017-05-30 12:59:06.809484016 +0000 +++ core/combo/HOST_linux-arm64.mk 2017-06-08 16:05:39.564015311 +0000 @@ -0,0 +1,27 @@ +# +# Copyright (C) 2006 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Configuration for builds hosted on linux-arm64. +# Included by combo/select.mk + +define $(combo_var_prefix)transform-shared-lib-to-toc +$(call _gen_toc_command_for_elf,$(1),$(2)) +endef + +# $(1): The file to check +define get-file-size +stat --format "%s" "$(1)" | tr -d '\n' +endef