Support to build executables for TARGET_2ND_ARCH
By default, an executable is built for TARGET_ARCH. To build it for TARGET_2ND_ARCH in a 64bit product, use: LOCAL_32BIT_ONLY := true To skip a module for TARGET_2ND_ARCH, use: LOCAL_NO_2ND_ARCH := true Bug: 11654773 Change-Id: Ieb293d25b21024bfe1b554044df338e064ac7b46
This commit is contained in:
parent
ec6d6262ac
commit
dd814bf8c2
|
@ -142,7 +142,8 @@ LOCAL_DIST_BUNDLED_BINARIES:=
|
|||
LOCAL_HAL_STATIC_LIBRARIES:=
|
||||
LOCAL_NO_SYNTAX_CHECK:=
|
||||
LOCAL_NO_STATIC_ANALYZER:=
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX:=
|
||||
LOCAL_32BIT_ONLY:= # '',true
|
||||
LOCAL_NO_2ND_ARCH:= # '',true
|
||||
|
||||
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
|
||||
# iterate over thousands of entries every time.
|
||||
|
|
|
@ -1323,7 +1323,7 @@ endif
|
|||
define transform-o-to-executable
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "target Executable: $(PRIVATE_MODULE) ($@)"
|
||||
$(transform-o-to-executable-inner)
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-executable-inner)
|
||||
endef
|
||||
|
||||
|
||||
|
@ -1342,7 +1342,7 @@ endif
|
|||
define transform-o-to-static-executable
|
||||
@mkdir -p $(dir $@)
|
||||
@echo "target StaticExecutable: $(PRIVATE_MODULE) ($@)"
|
||||
$(transform-o-to-static-executable-inner)
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-static-executable-inner)
|
||||
endef
|
||||
|
||||
|
||||
|
|
|
@ -238,6 +238,7 @@ TARGET_2ND_ARCH_MODULE_SUFFIX := _32
|
|||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
|
||||
|
||||
TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
|
||||
TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
|
||||
|
|
|
@ -1,69 +1,13 @@
|
|||
###########################################################
|
||||
## Standard rules for building an executable file.
|
||||
##
|
||||
## Additional inputs from base_rules.make:
|
||||
## None.
|
||||
###########################################################
|
||||
# We don't automatically set up rules to build executables for both
|
||||
# TARGET_ARCH and TARGET_2ND_ARCH.
|
||||
# By default, an executable is built for TARGET_ARCH.
|
||||
# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_32BIT_ONLY := true".
|
||||
|
||||
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
endif
|
||||
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
||||
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
|
||||
endif
|
||||
|
||||
$(call target-executable-hook)
|
||||
|
||||
skip_build_from_source :=
|
||||
ifdef LOCAL_PREBUILT_MODULE_FILE
|
||||
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
|
||||
include $(BUILD_PREBUILT)
|
||||
skip_build_from_source := true
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef skip_build_from_source
|
||||
|
||||
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
||||
|
||||
# Define PRIVATE_ variables from global vars
|
||||
my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
||||
else
|
||||
my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
|
||||
endif
|
||||
my_target_fdo_lib := $(TARGET_FDO_LIB)
|
||||
my_target_libgcc := $(TARGET_LIBGCC)
|
||||
my_target_crtbegin_dynamic_o := $(TARGET_CRTBEGIN_DYNAMIC_O)
|
||||
my_target_crtbegin_static_o := $(TARGET_CRTBEGIN_STATIC_O)
|
||||
my_target_crtend_o := $(TARGET_CRTEND_O)
|
||||
ifdef LOCAL_SDK_VERSION
|
||||
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
|
||||
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
|
||||
my_target_global_ld_dirs := \
|
||||
$(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
|
||||
$(my_ndk_version_root)/usr/lib) \
|
||||
$(my_target_global_ld_dirs)
|
||||
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
|
||||
my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
|
||||
my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
|
||||
my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
|
||||
endif
|
||||
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
|
||||
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
||||
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
|
||||
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
|
||||
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
|
||||
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
|
||||
$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
|
||||
|
||||
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
||||
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
|
||||
$(transform-o-to-static-executable)
|
||||
else
|
||||
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
|
||||
$(transform-o-to-executable)
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
endif
|
||||
|
||||
endif # skip_build_from_source
|
||||
include $(BUILD_SYSTEM)/executable_internal.mk
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
###########################################################
|
||||
## Standard rules for building an executable file.
|
||||
##
|
||||
## Additional inputs from base_rules.make:
|
||||
## None.
|
||||
###########################################################
|
||||
|
||||
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
endif
|
||||
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
||||
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
|
||||
endif
|
||||
|
||||
$(call target-executable-hook)
|
||||
|
||||
skip_build_from_source :=
|
||||
ifdef LOCAL_PREBUILT_MODULE_FILE
|
||||
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
|
||||
include $(BUILD_PREBUILT)
|
||||
skip_build_from_source := true
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef skip_build_from_source
|
||||
|
||||
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
||||
|
||||
# Define PRIVATE_ variables from global vars
|
||||
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
|
||||
ifeq ($(LOCAL_CLANG),true)
|
||||
my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
|
||||
else
|
||||
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
|
||||
endif
|
||||
my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
|
||||
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
|
||||
my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O)
|
||||
my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_STATIC_O)
|
||||
my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_O)
|
||||
ifdef LOCAL_SDK_VERSION
|
||||
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
|
||||
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
|
||||
my_target_global_ld_dirs := \
|
||||
$(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
|
||||
$(my_ndk_version_root)/usr/lib) \
|
||||
$(my_target_global_ld_dirs)
|
||||
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
|
||||
my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
|
||||
my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
|
||||
my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
|
||||
endif
|
||||
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
|
||||
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
||||
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
|
||||
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
|
||||
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
|
||||
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
|
||||
$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
|
||||
|
||||
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
||||
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
|
||||
$(transform-o-to-static-executable)
|
||||
else
|
||||
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
|
||||
$(transform-o-to-executable)
|
||||
endif
|
||||
|
||||
endif # skip_build_from_source
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
LOCAL_RAW_STATIC_LIBRARY:=true
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(BUILD_SYSTEM)/static_library_internal.mk
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
|
||||
# Build for TARGET_ARCH
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
include $(BUILD_SYSTEM)/shared_library_internal.mk
|
||||
endif
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
|
||||
ifneq ($(LOCAL_NO_2ND_ARCH),true)
|
||||
# Build for TARGET_2ND_ARCH
|
||||
OVERRIDE_BUILT_MODULE_PATH :=
|
||||
LOCAL_BUILT_MODULE :=
|
||||
LOCAL_INSTALLED_MODULE :=
|
||||
|
@ -14,4 +19,5 @@ LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|||
include $(BUILD_SYSTEM)/shared_library_internal.mk
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
|
||||
endif
|
||||
endif # LOCAL_NO_2ND_ARCH
|
||||
endif # TARGET_2ND_ARCH
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
|
||||
# Build for TARGET_ARCH
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
include $(BUILD_SYSTEM)/static_library_internal.mk
|
||||
endif
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
|
||||
ifneq ($(LOCAL_NO_2ND_ARCH),true)
|
||||
# Build for TARGET_2ND_ARCH
|
||||
OVERRIDE_BUILT_MODULE_PATH :=
|
||||
LOCAL_BUILT_MODULE :=
|
||||
LOCAL_INSTALLED_MODULE :=
|
||||
|
@ -14,4 +19,5 @@ LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|||
include $(BUILD_SYSTEM)/static_library_internal.mk
|
||||
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
||||
|
||||
endif
|
||||
endif # LOCAL_NO_2ND_ARCH
|
||||
endif # TARGET_2ND_ARCH
|
||||
|
|
Loading…
Reference in New Issue