Add HOST_CROSS_OS

Instead of using recursive make to change the HOST_OS when building the
windows SDK under linux, add the concept of cross-building to another
host os.

Bug: 23566667
Change-Id: I6dc525b601b6251d458d197c30bf4660d7485502
This commit is contained in:
Dan Willemsen 2015-08-14 12:59:50 -07:00
parent 4379e2b8bb
commit 057aaea54a
27 changed files with 372 additions and 210 deletions

View file

@ -34,14 +34,27 @@ ifdef LOCAL_IS_HOST_MODULE
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
endif
my_prefix := HOST_
ifeq ($(LOCAL_HOST_PREFIX),)
my_prefix := HOST_
else
my_prefix := $(LOCAL_HOST_PREFIX)
endif
my_host := host-
else
my_prefix := TARGET_
my_host :=
endif
ifeq ($(my_prefix),HOST_CROSS_)
my_host_cross := true
else
my_host_cross :=
endif
my_module_tags := $(LOCAL_MODULE_TAGS)
ifeq ($(my_host_cross),true)
my_module_tags :=
endif
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
@ -150,15 +163,18 @@ 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
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
$(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
generated_sources_dir := $(call local-generated-sources-dir)
@ -214,6 +230,8 @@ $(cleantarget)::
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
@ -345,6 +363,7 @@ endif
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
endif
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)

View file

@ -145,7 +145,7 @@ endif
# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
# all code is position independent, and then those warnings get promoted to
# errors.
ifndef USE_MINGW
ifneq ($($(my_prefix)OS),windows)
ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
my_cflags += -fpie
else
@ -186,7 +186,7 @@ endif
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(HOST_OS),windows)
ifneq ($($(my_prefix)OS),windows)
ifeq ($(my_clang),)
my_clang := true
endif
@ -307,17 +307,17 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_glob
else # LOCAL_IS_HOST_MODULE
ifeq ($(my_clang),true)
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CFLAGS)
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CONLYFLAGS)
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CPPFLAGS)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_LDFLAGS)
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES)
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
else
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS)
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CONLYFLAGS)
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LDFLAGS)
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES)
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
endif # my_clang
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
@ -1015,9 +1015,9 @@ endif
import_includes := $(intermediates)/import_includes
import_includes_deps := $(strip \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes))
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps)
@echo Import includes file: $@
@ -1122,7 +1122,7 @@ endif
built_static_libraries := \
$(foreach lib,$(my_static_libraries), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib)
@ -1131,7 +1131,7 @@ endif
built_whole_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.

View file

@ -37,11 +37,6 @@ ifneq ($(USE_CCACHE),)
export CCACHE_CPP2 := true
CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
# If we are cross-compiling Windows binaries on Linux
# then use the linux ccache binary instead.
ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
endif
ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
# Check that the executable is here.
ccache := $(strip $(wildcard $(ccache)))

View file

@ -0,0 +1,56 @@
include $(BUILD_SYSTEM)/clang/x86.mk
CLANG_CONFIG_x86_HOST_CROSS_TRIPLE := i686-pc-mingw32
CLANG_CONFIG_x86_HOST_CROSS_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_HOST_CROSS_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_ASFLAGS) \
-target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE)
CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CFLAGS := \
$(CLANG_CONFIG_EXTRA_CFLAGS) \
$(CLANG_CONFIG_HOST_CROSS_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_ASFLAGS)
CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CONLYFLAGS := \
$(CLANG_CONFIG_EXTRA_CONLYFLAGS) \
$(CLANG_CONFIG_HOST_CROSS_EXTRA_CONLYFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CONLYFLAGS) \
$(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CONLYFLAGS)
CLANG_CONFIG_x86_HOST_CROSS_EXTRA_CPPFLAGS := \
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_HOST_CROSS_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_x86_HOST_CROSS_COMBO_EXTRA_CPPFLAGS) \
-target $(CLANG_CONFIG_x86_HOST_CROSS_TRIPLE)
CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS := \
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_HOST_CROSS_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_x86_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_CONFIG_x86_HOST_CROSS_EXTRA_CFLAGS)
CLANG_HOST_CROSS_GLOBAL_CONLYFLAGS := \
$(call convert-to-host-clang-flags,$(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_CONFIG_x86_HOST_CROSS_EXTRA_CPPFLAGS)
CLANG_HOST_CROSS_GLOBAL_LDFLAGS := \
$(call convert-to-host-clang-flags,$(HOST_CROSS_GLOBAL_LDFLAGS)) \
$(CLANG_CONFIG_x86_HOST_CROSS_EXTRA_LDFLAGS)
HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a

View file

@ -16,9 +16,6 @@ CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA
CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS)
CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS)
endif
ifeq ($(HOST_OS),windows)
CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
endif
CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \

View file

@ -16,9 +16,6 @@ CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EX
CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS)
CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS)
endif
ifeq ($(HOST_OS),windows)
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
endif
CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \

View file

@ -48,7 +48,3 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/
endif
endif # Linux
ifeq ($(HOST_OS),windows)
# nothing required here yet
endif

View file

@ -84,6 +84,12 @@ CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
# Clang flags for all host cross rules
CLANG_CONFIG_HOST_CROSS_EXTRA_ASFLAGS :=
CLANG_CONFIG_HOST_CROSS_EXTRA_CFLAGS :=
CLANG_CONFIG_HOST_CROSS_EXTRA_CPPFLAGS :=
CLANG_CONFIG_HOST_CROSS_EXTRA_LDFLAGS :=
# Clang flags for all target rules
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
@ -126,6 +132,10 @@ 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
endif
# TARGET config
clang_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk

View file

@ -173,6 +173,13 @@ LOCAL_MODULE_TARGET_ARCH_WARN:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
LOCAL_MODULE_HOST_ARCH:=
LOCAL_MODULE_HOST_ARCH_WARN:=
LOCAL_MODULE_UNSUPPORTED_HOST_ARCH:=
LOCAL_MODULE_UNSUPPORTED_HOST_ARCH_WARN:=
LOCAL_MODULE_HOST_CROSS_ARCH:=
LOCAL_MODULE_HOST_CROSS_ARCH_WARN:=
LOCAL_MODULE_UNSUPPORTED_HOST_CROSS_ARCH:=
LOCAL_MODULE_UNSUPPORTED_HOST_CROSS_ARCH_WARN:=
LOCAL_NO_FPIE :=
LOCAL_CXX_STL := default
LOCAL_NATIVE_COVERAGE :=
@ -268,10 +275,27 @@ LOCAL_C_INCLUDES_$(HOST_OS):=
LOCAL_GENERATED_SOURCES_$(HOST_OS):=
LOCAL_REQUIRED_MODULES_$(HOST_OS):=
ifdef HOST_CROSS_OS
LOCAL_SRC_FILES_$(HOST_CROSS_OS):=
LOCAL_STATIC_LIBRARIES_$(HOST_CROSS_OS):=
LOCAL_SHARED_LIBRARIES_$(HOST_CROSS_OS):=
LOCAL_CFLAGS_$(HOST_CROSS_OS):=
LOCAL_CPPFLAGS_$(HOST_CROSS_OS):=
LOCAL_LDFLAGS_$(HOST_CROSS_OS):=
LOCAL_LDLIBS_$(HOST_CROSS_OS):=
LOCAL_ASFLAGS_$(HOST_CROSS_OS):=
LOCAL_C_INCLUDES_$(HOST_CROSS_OS):=
LOCAL_GENERATED_SOURCES_$(HOST_CROSS_OS):=
LOCAL_REQUIRED_MODULES_$(HOST_CROSS_OS):=
endif
LOCAL_SRC_FILES_$(HOST_OS)_$(HOST_ARCH):=
ifdef HOST_2ND_ARCH
LOCAL_SRC_FILES_$(HOST_OS)_$(HOST_2ND_ARCH):=
endif
ifdef HOST_CROSS_OS
LOCAL_SRC_FILES_$(HOST_CROSS_OS)_$(HOST_CROSS_ARCH):=
endif
LOCAL_SRC_FILES_32:=
LOCAL_SRC_FILES_64:=

View file

@ -0,0 +1,55 @@
#
# 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 += -m32
$(combo_var_prefix)GLOBAL_LDFLAGS += -m32
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/lib32
# 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 >= Win2K.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0500
# Get 64-bit off_t and related functions.
$(combo_2nd_arch_prefix)HOST_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)HOST_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 :=

View file

@ -1,62 +0,0 @@
#
# 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
HOST_ACP_UNAVAILABLE := true
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -Wno-unused-parameter
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32
TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-
$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include
$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include
$(combo_2nd_arch_prefix)HOST_GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
# Use C99-compliant printf functions (%zd).
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
# Admit to using >= Win2K.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0500
# Get 64-bit off_t and related functions.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D_FILE_OFFSET_BITS=64
$(combo_2nd_arch_prefix)HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
$(combo_2nd_arch_prefix)HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
$(combo_2nd_arch_prefix)HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += \
--enable-stdcall-fixup
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
############################################################
## Macros after this line are shared by the 64-bit config.
HOST_SHLIB_SUFFIX := .dll
HOST_EXECUTABLE_SUFFIX := .exe
# $(1): The file to check
define get-file-size
stat --format "%s" "$(1)" | tr -d '\n'
endef

View file

@ -1,45 +0,0 @@
#
# 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
# right now we get these from the environment, but we should
# pick them from the tree somewhere
TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
HOST_ACP_UNAVAILABLE := true
HOST_GLOBAL_CFLAGS += -DUSE_MINGW
HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
# Use C99-compliant printf functions (%zd).
HOST_GLOBAL_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
# Admit to using >= Win2K.
HOST_GLOBAL_CFLAGS += -D_WIN32_WINNT=0x0500
HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static

View file

@ -257,6 +257,13 @@ combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/combo/select.mk
endif
# Load the windows cross compiler under Linux
ifdef HOST_CROSS_OS
combo_target := HOST_CROSS_
combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
endif
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
@ -603,6 +610,17 @@ $(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS += $($(HOST_2ND_ARCH_VAR_PREFIX)HO
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS += $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CPPFLAGS)
endif
ifdef HOST_CROSS_OS
HOST_CROSS_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
HOST_CROSS_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
HOST_CROSS_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
HOST_CROSS_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
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)
endif
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
TARGET_DEFAULT_JAVA_LIBRARIES := core-libart core-junit ext framework okhttp

View file

@ -1,6 +1,6 @@
#############################################################
## Set up flags based on LOCAL_CXX_STL.
## Input variables: LOCAL_CXX_STL
## Input variables: LOCAL_CXX_STL, my_prefix
## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc.
#############################################################

View file

@ -87,11 +87,17 @@ TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES :=
$(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 :=
# Generated class file names for Android resource.
# They are escaped and quoted so can be passed safely to a bash command.
ANDROID_RESOURCE_GENERATED_CLASSES := 'R.class' 'R$$*.class' 'Manifest.class' 'Manifest$$*.class'
# Display names for various build targets
TARGET_DISPLAY := target
HOST_DISPLAY := host
HOST_CROSS_DISPLAY := host cross
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@ -422,7 +428,8 @@ endef
# $(2): target name, like "NotePad"
# $(3): if non-empty, this is a HOST target.
# $(4): if non-empty, force the intermediates to be COMMON
# $(5): if non-empty, force the intermedistes to be for the 2nd arch
# $(5): if non-empty, force the intermediates to be for the 2nd arch
# $(6): if non-empty, force the intermediates to be for the host cross os
define intermediates-dir-for
$(strip \
$(eval _idfClass := $(strip $(1))) \
@ -431,7 +438,7 @@ $(strip \
$(eval _idfName := $(strip $(2))) \
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
$(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
$(eval _idfPrefix := $(if $(strip $(3)),$(if $(strip $(6)),HOST_CROSS,HOST),TARGET)) \
$(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
@ -449,13 +456,14 @@ endef
#
# $(1): if non-empty, force the intermediates to be COMMON
# $(2): if non-empty, force the intermediates to be for the 2nd arch
# $(3): if non-empty, force the intermediates to be for the host cross os
define local-intermediates-dir
$(strip \
$(if $(strip $(LOCAL_MODULE_CLASS)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \
$(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2)) \
$(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2),$(3)) \
)
endef
@ -1106,7 +1114,7 @@ endef
###########################################################
define transform-host-cpp-to-o
@echo "host C++: $(PRIVATE_MODULE) <= $<"
@echo "$($(PRIVATE_PREFIX)DISPLAY) C++: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
$(hide) $(PRIVATE_CXX) \
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
@ -1114,7 +1122,7 @@ $(hide) $(PRIVATE_CXX) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
$(HOST_PROJECT_INCLUDES) \
$($(PRIVATE_PREFIX)PROJECT_INCLUDES) \
$(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
@ -1144,7 +1152,7 @@ $(hide) $(PRIVATE_CC) \
$(addprefix -isystem ,\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
$(HOST_PROJECT_INCLUDES) \
$($(PRIVATE_PREFIX)PROJECT_INCLUDES) \
$(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
@ -1157,12 +1165,12 @@ $(hide) $(PRIVATE_CC) \
endef
define transform-host-c-to-o-no-deps
@echo "host C: $(PRIVATE_MODULE) <= $<"
@echo "$($(PRIVATE_PREFIX)DISPLAY) C: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS))
endef
define transform-host-s-to-o-no-deps
@echo "host asm: $(PRIVATE_MODULE) <= $<"
@echo "$($(PRIVATE_PREFIX)DISPLAY) asm: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_ASFLAGS))
endef
@ -1181,7 +1189,7 @@ endef
###########################################################
define transform-host-m-to-o-no-deps
@echo "host ObjC: $(PRIVATE_MODULE) <= $<"
@echo "$($(PRIVATE_PREFIX)DISPLAY) ObjC: $(PRIVATE_MODULE) <= $<"
$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
endef
@ -1338,19 +1346,19 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
lib_to_include=$$ldir/$(notdir $(1)); \
filelist=; \
subdir=0; \
for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) | \grep '\.o$$'`; do \
for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) t $(1) | \grep '\.o$$'`; do \
if [ -e $$ldir/$$f ]; then \
mkdir $$ldir/$$subdir; \
ext=$$subdir/; \
subdir=$$((subdir+1)); \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) m $$lib_to_include $$f; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) m $$lib_to_include $$f; \
else \
ext=; \
fi; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@ $$filelist
endef
@ -1364,12 +1372,12 @@ endef
# Explicitly delete the archive first so that ar doesn't
# try to add to an existing archive.
define transform-host-o-to-static-lib
@echo "host StaticLib: $(PRIVATE_MODULE) ($@)"
@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
@rm -f $@
$(extract-and-include-host-whole-static-libs)
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
endef
@ -1383,11 +1391,11 @@ endef
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
-Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
-shared -Wl,-soname,$(notdir $@) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
@ -1408,13 +1416,13 @@ endef
endif
define transform-host-o-to-shared-lib
@echo "host SharedLib: $(PRIVATE_MODULE) ($@)"
@echo "$($(PRIVATE_PREFIX)DISPLAY) SharedLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-host-o-to-shared-lib-inner)
endef
define transform-host-o-to-package
@echo "host Package: $(PRIVATE_MODULE) ($@)"
@echo "$($(PRIVATE_PREFIX)DISPLAY) Package: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-host-o-to-shared-lib-inner)
endef
@ -1582,8 +1590,8 @@ HOST_FPIE_FLAGS :=
else
HOST_FPIE_FLAGS := -pie
# Force the correct entry point to workaround a bug in binutils that manifests with -pie
ifeq ($(HOST_OS),windows)
HOST_FPIE_FLAGS += -Wl,-e_mainCRTStartup
ifeq ($(HOST_CROSS_OS),windows)
HOST_CROSS_FPIE_FLAGS += -Wl,-e_mainCRTStartup
endif
endif
@ -1600,10 +1608,10 @@ $(hide) $(PRIVATE_CXX) \
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
-Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
@ -1614,7 +1622,7 @@ endef
endif
define transform-host-o-to-executable
@echo "host Executable: $(PRIVATE_MODULE) ($@)"
@echo "$($(PRIVATE_PREFIX)DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-host-o-to-executable-inner)
endef
@ -2105,7 +2113,7 @@ endef
# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
# in transform-java-to-classes for the sake of vm-tests.
define transform-host-java-to-package
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef

View file

@ -23,6 +23,7 @@
LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif

View file

@ -80,6 +80,7 @@ $(info TARGET_2ND_CPU_VARIANT=$(TARGET_2ND_CPU_VARIANT))
$(info HOST_ARCH=$(HOST_ARCH))
$(info HOST_OS=$(HOST_OS))
$(info HOST_OS_EXTRA=$(HOST_OS_EXTRA))
$(info HOST_CROSS_OS=$(HOST_CROSS_OS))
$(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE))
$(info BUILD_ID=$(BUILD_ID))
$(info OUT_DIR=$(OUT_DIR))

View file

@ -52,12 +52,11 @@ endif
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
# Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the
# Windows SDK. Only a subset of tools and SDK will manage to build properly.
HOST_CROSS_OS :=
# We can cross-build Windows binaries on Linux
ifeq ($(HOST_OS),linux)
ifdef USE_MINGW
HOST_OS := windows
endif
HOST_CROSS_OS := windows
HOST_CROSS_ARCH := x86
endif
ifeq ($(HOST_OS),)
@ -128,11 +127,6 @@ $(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))
$(error must be empty or one of: eng user userdebug)
endif
ifdef USE_MINGW
# We only build sdk host tools in the MinGW windows build.
# Build it as 32-bit as well.
HOST_PREFER_32_BIT := true
endif
SDK_HOST_ARCH := x86
# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
@ -213,8 +207,12 @@ HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
# TODO: remove
BUILD_OUT := $(HOST_OUT)
BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)
HOST_CROSS_OUT_release := $(HOST_OUT_ROOT_release)/windows-$(HOST_PREBUILT_ARCH)
HOST_CROSS_OUT_debug := $(HOST_OUT_ROOT_debug)/windows-$(HOST_PREBUILT_ARCH)
HOST_CROSS_OUT := $(HOST_CROSS_OUT_$(HOST_BUILD_TYPE))
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
@ -232,6 +230,9 @@ HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64
HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
@ -239,9 +240,16 @@ HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
HOST_CROSS_OUT_HEADERS := $(HOST_CROSS_OUT_INTERMEDIATES)/include
HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_GEN := $(HOST_OUT)/gen
HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
HOST_2ND_ARCH_MODULE_SUFFIX := _32

View file

@ -1,5 +1,6 @@
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@ -50,5 +51,30 @@ endif
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
ifdef HOST_CROSS_OS
my_prefix := HOST_CROSS_
LOCAL_HOST_PREFIX := $(my_prefix)
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# Build for Windows
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)
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_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE)
LOCAL_INSTALLED_MODULE := $(saved_LOCAL_INSTALLED_MODULE)
endif
LOCAL_HOST_PREFIX :=
endif
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
my_module_arch_supported :=

View file

@ -10,7 +10,7 @@ ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := EXECUTABLES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
LOCAL_MODULE_SUFFIX := $($(my_prefix)EXECUTABLE_SUFFIX)
endif
$(call host-executable-hook)
@ -27,7 +27,7 @@ ifndef skip_build_from_source
include $(BUILD_SYSTEM)/binary.mk
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
$(LOCAL_BUILT_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)

View file

@ -1,4 +1,5 @@
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@ -34,6 +35,26 @@ endif
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
ifdef HOST_CROSS_OS
my_prefix := HOST_CROSS_
LOCAL_HOST_PREFIX := $(my_prefix)
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# Build for Windows
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_HOST_PREFIX :=
endif
my_module_arch_supported :=
###########################################################

View file

@ -13,7 +13,7 @@ ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
LOCAL_MODULE_SUFFIX := $($(my_prefix)SHLIB_SUFFIX)
endif
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
@ -36,11 +36,11 @@ ifndef skip_build_from_source
# Put the built modules of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_SYSTEM)/binary.mk
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_LIBPROFILE_RT)
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
$(LOCAL_BUILD_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
$(LOCAL_BUILT_MODULE): \

View file

@ -1,4 +1,5 @@
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
include $(BUILD_SYSTEM)/multilib.mk
ifndef LOCAL_MODULE_HOST_ARCH
@ -34,6 +35,22 @@ endif
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif # HOST_2ND_ARCH
ifdef HOST_CROSS_OS
my_prefix := HOST_CROSS_
LOCAL_HOST_PREFIX := $(my_prefix)
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# Build for Windows
OVERRIDE_BUILT_MODULE_PATH :=
LOCAL_BUILT_MODULE :=
LOCAL_INSTALLED_MODULE :=
LOCAL_INTERMEDIATE_TARGETS :=
include $(BUILD_SYSTEM)/host_static_library_internal.mk
endif
LOCAL_HOST_PREFIX :=
endif
my_module_arch_supported :=
###########################################################

View file

@ -449,16 +449,6 @@ ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),)
$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
endif
# Bring in all modules that need to be built.
ifeq ($(HOST_OS),windows)
SDK_ONLY := true
endif
ifeq ($(SDK_ONLY),true)
include $(TOPDIR)sdk/build/windows_sdk_whitelist.mk
include $(TOPDIR)development/build/windows_sdk_whitelist.mk
else # !SDK_ONLY
#
# Typical build; include any Android.mk files we can find.
#
@ -466,8 +456,6 @@ subdirs := $(TOP)
FULL_BUILD := true
endif # !SDK_ONLY
# Before we go and include all of the module makefiles, stash away
# the PRODUCT_* values so that later we can verify they are not modified.
stash_product_vars:=true
@ -579,6 +567,8 @@ $(strip $(foreach m,$(1),\
$(m))))
endef
# If a module is for a cross host os, the required modules must be for
# that OS too.
# If a module is built for 32-bit, the required modules must be 32-bit too;
# Otherwise if the module is an exectuable or shared library,
# the required modules must be 64-bit;
@ -586,6 +576,8 @@ endef
$(foreach m,$(ALL_MODULES),\
$(eval r := $(ALL_MODULES.$(m).REQUIRED))\
$(if $(r),\
$(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),\
$(eval r := $(addprefix host_cross_,$(r))))\
$(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
$(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
$(if $(filter EXECUTABLES SHARED_LIBRARIES,$(ALL_MODULES.$(m).CLASS)),\
@ -608,32 +600,40 @@ $(foreach m,$(ALL_MODULES), \
$(eval r := $(call module-installed-files,$(r))) \
$(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval h_m := $(filter $(HOST_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval hc_m := $(filter $(HOST_CROSS_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
$(eval h_r := $(filter $(HOST_OUT_ROOT)/%, $(r))) \
$(eval hc_r := $(filter $(HOST_CROSS_OUT_ROOT)/%, $(r))) \
$(eval t_m := $(filter-out $(t_r), $(t_m))) \
$(eval h_m := $(filter-out $(h_r), $(h_m))) \
$(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
$(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
$(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
$(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
) \
)
t_m :=
h_m :=
hc_m :=
t_r :=
h_r :=
hc_r :=
# Establish the dependecies on the shared libraries.
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
# so they can be expanded to product_MODULES later.
# $(1): TARGET_ or HOST_.
# $(1): TARGET_ or HOST_ or HOST_CROSS_.
# $(2): non-empty for 2nd arch.
# $(3): non-empty for host cross compile.
define resolve-shared-libs-depes
$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
$(eval p := $(subst :,$(space),$(m)))\
$(eval mod := $(firstword $(p)))\
$(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
$(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
$(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\
$(if $(3),$(eval deps := $(addprefix host_cross_,$(deps))))\
$(eval r := $(filter $($(1)OUT)/%,$(call module-installed-files,\
$(deps))))\
$(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\
$(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
@ -647,6 +647,9 @@ $(call resolve-shared-libs-depes,HOST_)
ifdef HOST_2ND_ARCH
$(call resolve-shared-libs-depes,HOST_,true)
endif
ifdef HOST_CROSS_OS
$(call resolve-shared-libs-depes,HOST_CROSS_,,true)
endif
m :=
r :=

View file

@ -13,11 +13,3 @@ ifeq (,$(filter 32 64 first both none,$(my_module_multilib)))
$(error $(LOCAL_PATH): Invalid LOCAL_MULTILIB specified for module $(LOCAL_MODULE))
endif
endif # my_module_multilib defined
# Windows is a special case. Linux and Darwin are both multilib builds, but we
# don't have a 64-bit Windows build, so make sure it's not a multilib build.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(HOST_OS),windows)
my_module_multilib := 32
endif
endif

View file

@ -14,6 +14,7 @@ ifeq ($(LOCAL_MODULE_CLASS),NOTICE_FILES)
# so my_prefix is not set at this point.
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif
@ -56,6 +57,7 @@ endif
# In case it's actually a host file
module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))
module_installed_filename := $(patsubst $(HOST_CROSS_OUT)%,%,$(module_installed_filename))
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt

View file

@ -8,6 +8,7 @@
ifdef LOCAL_IS_HOST_MODULE
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
else
my_prefix := TARGET_
endif
@ -52,4 +53,26 @@ endif # $(my_skip_non_preferred_arch) not true
LOCAL_2ND_ARCH_VAR_PREFIX :=
ifdef LOCAL_IS_HOST_MODULE
ifdef HOST_CROSS_OS
ifneq (,$(filter EXECUTABLES STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)))
my_prefix := HOST_CROSS_
LOCAL_HOST_PREFIX := $(my_prefix)
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# host cross compilation is supported
OVERRIDE_BUILT_MODULE_PATH :=
LOCAL_BUILT_MODULE :=
LOCAL_INSTALLED_MODULE :=
LOCAL_MODULE_STEM :=
LOCAL_BUILT_MODULE_STEM :=
LOCAL_INSTALLED_MODULE_STEM :=
LOCAL_INTERMEDIATE_TARGETS :=
include $(BUILD_SYSTEM)/prebuilt_internal.mk
endif
LOCAL_HOST_PREFIX :=
endif
endif
endif
my_module_arch_supported :=