From 9ecbf832593980facba06c9031b8539b9cfdfd26 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 5 Feb 2016 16:20:19 -0800 Subject: [PATCH] Add 64-bit windows cross-compiles This is mostly the same as the existing 2ND_HOST / HOST_CROSS support. The interesting thing I did here was make x86 the 'first' architecture, and x86_64 the second. This way LOCAL_MULTILIB := first defaults to 32-bit windows modules. windows-x86/bin <- defaults to 32-bit executables windows-x86/lib <- 32-bit libraries, like before windows-x86/lib64 <- 64-bit libraries windows-x86/obj <- 32-bit intermediates windows-x86/obj64 <- 64-bit intermediates Then modules are registered with the names: host_cross_liblog <- 32-bit, like before host_cross_liblog_64 <- 64-bit Bug: 26957718 Change-Id: I9f119411acb43e973ec1e6bca3c1dc291c91556c --- core/base_rules.mk | 10 +-- ...OST_CROSS_windows.mk => HOST_CROSS_x86.mk} | 18 ++--- core/clang/HOST_CROSS_x86_64.mk | 56 ++++++++++++++++ core/clang/config.mk | 9 ++- core/clear_vars.mk | 3 + core/combo/HOST_CROSS_windows-x86_64.mk | 65 +++++++++++++++++++ core/config.mk | 17 +++++ core/definitions.mk | 1 + core/dumpvar.mk | 3 + core/envsetup.mk | 9 +++ core/host_executable.mk | 27 ++++++++ core/host_shared_library.mk | 19 ++++++ core/host_static_library.mk | 15 +++++ 13 files changed, 236 insertions(+), 16 deletions(-) rename core/clang/{HOST_CROSS_windows.mk => HOST_CROSS_x86.mk} (68%) create mode 100644 core/clang/HOST_CROSS_x86_64.mk create mode 100644 core/combo/HOST_CROSS_windows-x86_64.mk diff --git a/core/base_rules.mk b/core/base_rules.mk index fcf35496f2..2fe0616eac 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -168,14 +168,14 @@ ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) endif my_register_name := $(LOCAL_MODULE) -ifdef LOCAL_2ND_ARCH_VAR_PREFIX -ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX -my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX) -endif -endif ifeq ($(my_host_cross),true) my_register_name := host_cross_$(LOCAL_MODULE) endif +ifdef LOCAL_2ND_ARCH_VAR_PREFIX +ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX +my_register_name := $(my_register_name)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX) +endif +endif # Make sure that this IS_HOST/CLASS/MODULE combination is unique. module_id := MODULE.$(if \ $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name) diff --git a/core/clang/HOST_CROSS_windows.mk b/core/clang/HOST_CROSS_x86.mk similarity index 68% rename from core/clang/HOST_CROSS_windows.mk rename to core/clang/HOST_CROSS_x86.mk index 74adb58422..b78a0743bb 100644 --- a/core/clang/HOST_CROSS_windows.mk +++ b/core/clang/HOST_CROSS_x86.mk @@ -37,20 +37,20 @@ CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS := \ $(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_LDFLAGS) \ -target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE) -CLANG_HOST_CROSS_GLOBAL_CFLAGS := \ - $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CFLAGS)) \ +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CFLAGS)) \ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CFLAGS) -CLANG_HOST_CROSS_GLOBAL_CONLYFLAGS := \ - $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CONLYFLAGS)) \ +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CONLYFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CONLYFLAGS)) \ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CONLYFLAGS) -CLANG_HOST_CROSS_GLOBAL_CPPFLAGS := \ - $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_CPPFLAGS)) \ +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CPPFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CPPFLAGS)) \ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CPPFLAGS) -CLANG_HOST_CROSS_GLOBAL_LDFLAGS := \ - $(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_LDFLAGS)) \ +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_LDFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_LDFLAGS)) \ $(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS) -HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a +$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a diff --git a/core/clang/HOST_CROSS_x86_64.mk b/core/clang/HOST_CROSS_x86_64.mk new file mode 100644 index 0000000000..b6f2de9768 --- /dev/null +++ b/core/clang/HOST_CROSS_x86_64.mk @@ -0,0 +1,56 @@ + +include $(BUILD_SYSTEM)/clang/x86_64.mk + +CLANG_CONFIG_x86_64_HOST_CROSS_TRIPLE := x86_64-pc-mingw32 + +CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_ASFLAGS := \ + $(CLANG_CONFIG_EXTRA_ASFLAGS) \ + $(CLANG_CONFIG_HOST_CROSS_EXTRA_ASFLAGS) \ + $(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_COMBO_EXTRA_ASFLAGS) \ + -target $(CLANG_CONFIG_x86_64_HOST_CROSS_TRIPLE) + +CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CFLAGS := \ + $(CLANG_CONFIG_EXTRA_CFLAGS) \ + $(CLANG_CONFIG_HOST_CROSS_EXTRA_CFLAGS) \ + $(CLANG_CONFIG_x86_64_EXTRA_CFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_COMBO_EXTRA_CFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_ASFLAGS) + +CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CONLYFLAGS := \ + $(CLANG_CONFIG_EXTRA_CONLYFLAGS) \ + $(CLANG_CONFIG_HOST_CROSS_EXTRA_CONLYFLAGS) \ + $(CLANG_CONFIG_x86_64_EXTRA_CONLYFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_COMBO_EXTRA_CONLYFLAGS) + +CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CPPFLAGS := \ + $(CLANG_CONFIG_EXTRA_CPPFLAGS) \ + $(CLANG_CONFIG_HOST_CROSS_EXTRA_CPPFLAGS) \ + $(CLANG_CONFIG_x86_64_EXTRA_CPPFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_COMBO_EXTRA_CPPFLAGS) \ + -target $(CLANG_CONFIG_x86_64_HOST_CROSS_TRIPLE) + +CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_LDFLAGS := \ + $(CLANG_CONFIG_EXTRA_LDFLAGS) \ + $(CLANG_CONFIG_HOST_CROSS_EXTRA_LDFLAGS) \ + $(CLANG_CONFIG_x86_64_EXTRA_LDFLAGS) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_COMBO_EXTRA_LDFLAGS) \ + -target $(CLANG_CONFIG_x86_64_HOST_CROSS_TRIPLE) + +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CFLAGS)) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CFLAGS) + +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CONLYFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CONLYFLAGS)) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CONLYFLAGS) + +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_CPPFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_CPPFLAGS)) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_CPPFLAGS) + +$(clang_2nd_arch_prefix)CLANG_HOST_CROSS_GLOBAL_LDFLAGS := \ + $(call convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_CROSS_GLOBAL_LDFLAGS)) \ + $(CLANG_CONFIG_x86_64_HOST_CROSS_EXTRA_LDFLAGS) + +$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64.a diff --git a/core/clang/config.mk b/core/clang/config.mk index 5014a6f96d..fb3886eef7 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -149,8 +149,13 @@ clang_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX) include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk endif -ifdef HOST_CROSS_OS -include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_OS).mk +ifdef HOST_CROSS_ARCH +clang_2nd_arch_prefix := +include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_ARCH).mk +ifdef HOST_CROSS_2ND_ARCH +clang_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_2ND_ARCH).mk +endif endif # TARGET config diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 49e56c4cbf..b64b53b657 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -297,6 +297,9 @@ LOCAL_SRC_FILES_$(HOST_OS)_$(HOST_2ND_ARCH):= endif ifdef HOST_CROSS_OS LOCAL_SRC_FILES_$(HOST_CROSS_OS)_$(HOST_CROSS_ARCH):= +ifdef HOST_CROSS_2ND_ARCH +LOCAL_SRC_FILES_$(HOST_CROSS_OS)_$(HOST_CROSS_2ND_ARCH):= +endif endif LOCAL_SRC_FILES_32:= diff --git a/core/combo/HOST_CROSS_windows-x86_64.mk b/core/combo/HOST_CROSS_windows-x86_64.mk new file mode 100644 index 0000000000..1ad6005e34 --- /dev/null +++ b/core/combo/HOST_CROSS_windows-x86_64.mk @@ -0,0 +1,65 @@ +# +# 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. +# + +# Settings to use MinGW as a cross-compiler under Linux +# Included by combo/select.make + +$(combo_var_prefix)GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN +$(combo_var_prefix)GLOBAL_CFLAGS += -Wno-unused-parameter +$(combo_var_prefix)GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32 +$(combo_var_prefix)GLOBAL_CFLAGS += -m64 +$(combo_var_prefix)GLOBAL_LDFLAGS += -m64 +TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32- +$(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include +$(combo_var_prefix)C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include +$(combo_var_prefix)GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib64 + +# Workaround differences in inttypes.h between host and target. +# See bug 12708004. +$(combo_var_prefix)GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS +# Use C99-compliant printf functions (%zd). +$(combo_var_prefix)GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 +# Admit to using >= Vista. Both are needed because of <_mingw.h>. +$(combo_var_prefix)GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0600 -DWINVER=0x0600 +# Get 64-bit off_t and related functions. +$(combo_var_prefix)GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64 + +$(combo_var_prefix)CC := $(TOOLS_PREFIX)gcc +$(combo_var_prefix)CXX := $(TOOLS_PREFIX)g++ +$(combo_var_prefix)AR := $(TOOLS_PREFIX)ar +$(combo_var_prefix)NM := $(TOOLS_PREFIX)nm +$(combo_var_prefix)OBJDUMP := $(TOOLS_PREFIX)objdump + +define $(combo_var_prefix)transform-shared-lib-to-toc +$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OBJDUMP) -x $(1) | grep "^Name" | cut -f3 -d" " > $(2) +$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)NM) -g -f p $(1) | cut -f1-2 -d" " >> $(2) +endef + +$(combo_var_prefix)GLOBAL_LDFLAGS += \ + --enable-stdcall-fixup + +ifneq ($(strip $(BUILD_HOST_static)),) +# Statically-linked binaries are desirable for sandboxed environment +$(combo_var_prefix)GLOBAL_LDFLAGS += -static +endif # BUILD_HOST_static + +$(combo_var_prefix)SHLIB_SUFFIX := .dll +$(combo_var_prefix)EXECUTABLE_SUFFIX := .exe + +$(combo_var_prefix)IS_64_BIT := true + +# The mingw gcc is 4.8, 4.9 is required for color diagnostics +$(combo_var_prefix)UNKNOWN_CFLAGS := -fdiagnostics-color diff --git a/core/config.mk b/core/config.mk index 0034c43243..69d56c81d6 100644 --- a/core/config.mk +++ b/core/config.mk @@ -255,6 +255,12 @@ ifdef HOST_CROSS_OS combo_target := HOST_CROSS_ combo_2nd_arch_prefix := include $(BUILD_SYSTEM)/combo/select.mk + +ifdef HOST_CROSS_2ND_ARCH +combo_target := HOST_CROSS_ +combo_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/combo/select.mk +endif endif # on windows, the tools have .exe at the end, and we depend on the @@ -746,6 +752,17 @@ HOST_CROSS_GLOBAL_LD_DIRS += -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES) HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_CROSS_OUT_HEADERS) HOST_CROSS_GLOBAL_CFLAGS += $(HOST_CROSS_RELEASE_CFLAGS) HOST_CROSS_GLOBAL_CPPFLAGS += $(HOST_CROSS_RELEASE_CPPFLAGS) + +ifdef HOST_CROSS_2ND_ARCH +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CFLAGS += $(filter-out $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_UNKNOWN_CFLAGS),$(COMMON_GLOBAL_CFLAGS)) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_LD_DIRS += -L$($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_HEADERS) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CFLAGS += $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CFLAGS) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_CPPFLAGS += $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_RELEASE_CPPFLAGS) +endif endif ifdef BRILLO diff --git a/core/definitions.mk b/core/definitions.mk index 6b1d8fc3c6..ab7f9a63c5 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -88,6 +88,7 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := HOST_DEPENDENCIES_ON_SHARED_LIBRARIES := $(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES := HOST_CROSS_DEPENDENCIES_ON_SHARED_LIBRARIES := +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_DEPENDENCIES_ON_SHARED_LIBRARIES := # Generated class file names for Android resource. # They are escaped and quoted so can be passed safely to a bash command. diff --git a/core/dumpvar.mk b/core/dumpvar.mk index 797fdce89d..cfb031ff91 100644 --- a/core/dumpvar.mk +++ b/core/dumpvar.mk @@ -78,9 +78,12 @@ $(info TARGET_2ND_ARCH=$(TARGET_2ND_ARCH)) $(info TARGET_2ND_ARCH_VARIANT=$(TARGET_2ND_ARCH_VARIANT)) $(info TARGET_2ND_CPU_VARIANT=$(TARGET_2ND_CPU_VARIANT)) $(info HOST_ARCH=$(HOST_ARCH)) +$(info HOST_2ND_ARCH=$(HOST_2ND_ARCH)) $(info HOST_OS=$(HOST_OS)) $(info HOST_OS_EXTRA=$(HOST_OS_EXTRA)) $(info HOST_CROSS_OS=$(HOST_CROSS_OS)) +$(info HOST_CROSS_ARCH=$(HOST_CROSS_ARCH)) +$(info HOST_CROSS_2ND_ARCH=$(HOST_CROSS_2ND_ARCH)) $(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE)) $(info BUILD_ID=$(BUILD_ID)) $(info OUT_DIR=$(OUT_DIR)) diff --git a/core/envsetup.mk b/core/envsetup.mk index 46c146394f..ae63ae712c 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -62,6 +62,7 @@ HOST_CROSS_OS := ifeq ($(HOST_OS),linux) HOST_CROSS_OS := windows HOST_CROSS_ARCH := x86 +HOST_CROSS_2ND_ARCH := x86_64 endif ifeq ($(HOST_OS),) @@ -276,6 +277,14 @@ else HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) endif +# Out for HOST_CROSS_2ND_ARCH +HOST_CROSS_2ND_ARCH_VAR_PREFIX := 2ND_ +HOST_CROSS_2ND_ARCH_MODULE_SUFFIX := _64 +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj64 +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES)/lib +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib64 +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT_EXECUTABLES) + TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib diff --git a/core/host_executable.mk b/core/host_executable.mk index bc55ef94af..6f19bd1738 100644 --- a/core/host_executable.mk +++ b/core/host_executable.mk @@ -61,6 +61,7 @@ OVERRIDE_BUILT_MODULE_PATH := # we don't want others using the cross compiled version saved_LOCAL_BUILT_MODULE := $(LOCAL_BUILT_MODULE) saved_LOCAL_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) +saved_LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) LOCAL_BUILT_MODULE := LOCAL_INSTALLED_MODULE := LOCAL_INTERMEDIATE_TARGETS := @@ -70,9 +71,35 @@ LOCAL_LDFLAGS += $(HOST_CROSS_FPIE_FLAGS) endif include $(BUILD_SYSTEM)/host_executable_internal.mk +LOCAL_LDFLAGS := $(saved_LOCAL_LDFLAGS) LOCAL_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE) LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE) endif + +ifdef HOST_CROSS_2ND_ARCH +LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/module_arch_supported.mk +ifeq ($(my_module_arch_supported),true) +OVERRIDE_BUILT_MODULE_PATH := +# we don't want others using the cross compiled version +saved_LOCAL_BUILT_MODULE := $(LOCAL_BUILT_MODULE) +saved_LOCAL_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) +saved_LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) +LOCAL_BUILT_MODULE := +LOCAL_INSTALLED_MODULE := +LOCAL_INTERMEDIATE_TARGETS := + +ifeq ($(LOCAL_NO_FPIE),) +LOCAL_LDFLAGS += $(HOST_CROSS_FPIE_FLAGS) +endif + +include $(BUILD_SYSTEM)/host_executable_internal.mk +LOCAL_LDFLAGS := $(saved_LOCAL_LDFLAGS) +LOCAL_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE) +LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE) +endif +LOCAL_2ND_ARCH_VAR_PREFIX := +endif LOCAL_HOST_PREFIX := endif diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk index 49000a4dcd..2e0c9f1ce2 100644 --- a/core/host_shared_library.mk +++ b/core/host_shared_library.mk @@ -53,6 +53,25 @@ LOCAL_INTERMEDIATE_TARGETS := include $(BUILD_SYSTEM)/host_shared_library_internal.mk LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE) endif + +ifdef HOST_CROSS_2ND_ARCH +LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/module_arch_supported.mk +ifeq ($(my_module_arch_supported),true) +# Build for HOST_CROSS_2ND_ARCH +OVERRIDE_BUILT_MODULE_PATH := +LOCAL_BUILT_MODULE := +LOCAL_MODULE_SUFFIX := +# We don't want makefiles using the cross-compiled host tool +saved_LOCAL_INSTALLED_MODULE := $(LOCAL_INSTALLED_MODULE) +LOCAL_INSTALLED_MODULE := +LOCAL_INTERMEDIATE_TARGETS := + +include $(BUILD_SYSTEM)/host_shared_library_internal.mk +LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE) +endif +LOCAL_2ND_ARCH_VAR_PREFIX := +endif LOCAL_HOST_PREFIX := endif diff --git a/core/host_static_library.mk b/core/host_static_library.mk index aa8c0e3d82..068c702175 100644 --- a/core/host_static_library.mk +++ b/core/host_static_library.mk @@ -49,6 +49,21 @@ LOCAL_INTERMEDIATE_TARGETS := include $(BUILD_SYSTEM)/host_static_library_internal.mk endif + +ifdef HOST_CROSS_2ND_ARCH +LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/module_arch_supported.mk +ifeq ($(my_module_arch_supported),true) +# Build for HOST_CROSS_2ND_ARCH +OVERRIDE_BUILT_MODULE_PATH := +LOCAL_BUILT_MODULE := +LOCAL_INSTALLED_MODULE := +LOCAL_INTERMEDIATE_TARGETS := + +include $(BUILD_SYSTEM)/host_static_library_internal.mk +endif +LOCAL_2ND_ARCH_VAR_PREFIX := +endif LOCAL_HOST_PREFIX := endif