forked from openkylin/platform_build
Support to build native libraries with prebuilt NDK
Bug: http://b/issue?id=2811253 Change-Id: Iabd4ab8b3d7236dffe89f1939e1142e882944026
This commit is contained in:
parent
b66a5c0574
commit
1a08100fa9
|
@ -5,6 +5,31 @@
|
||||||
## The list of object files is exported in $(all_objects).
|
## The list of object files is exported in $(all_objects).
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
######################################
|
||||||
|
## Sanity check for LOCAL_NDK_VERSION
|
||||||
|
######################################
|
||||||
|
my_ndk_version_root :=
|
||||||
|
ifdef LOCAL_NDK_VERSION
|
||||||
|
ifdef LOCAL_IS_HOST_MODULE
|
||||||
|
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION can not be used in host module)
|
||||||
|
endif
|
||||||
|
ifneq ($(filter-out SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
||||||
|
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION can only be used to build target shared/static libraries, \
|
||||||
|
while your module is of class $(LOCAL_MODULE_CLASS))
|
||||||
|
endif
|
||||||
|
ifeq ($(filter $(LOCAL_NDK_VERSION),$(TARGET_AVAILABLE_NDK_VERSIONS)),)
|
||||||
|
$(error $(LOCAL_PATH): Invalid LOCAL_NDK_VERSION '$(LOCAL_NDK_VERSION)' \
|
||||||
|
Choices are $(TARGET_AVAILABLE_NDK_VERSIONS))
|
||||||
|
endif
|
||||||
|
ifndef LOCAL_SDK_VERSION
|
||||||
|
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION must be defined with LOCAL_SDK_VERSION)
|
||||||
|
endif
|
||||||
|
my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r$(LOCAL_NDK_VERSION)/$(BUILD_OS)/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
|
||||||
|
ifeq ($(wildcard $(my_ndk_version_root)),)
|
||||||
|
$(error $(LOCAL_PATH): ndk version root does not exist: $(my_ndk_version_root))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
include $(BUILD_SYSTEM)/base_rules.mk
|
include $(BUILD_SYSTEM)/base_rules.mk
|
||||||
#######################################
|
#######################################
|
||||||
|
@ -18,6 +43,26 @@ ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),)
|
||||||
LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
|
LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
## Define PRIVATE_ variables from global vars
|
||||||
|
###########################################################
|
||||||
|
ifdef LOCAL_NDK_VERSION
|
||||||
|
my_target_project_includes :=
|
||||||
|
my_target_c_inclues := $(my_ndk_version_root)/usr/include
|
||||||
|
# TODO: more reliable way to remove platform stuff.
|
||||||
|
my_target_global_cflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CFLAGS))
|
||||||
|
my_target_global_cppflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CPPFLAGS))
|
||||||
|
else
|
||||||
|
my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
|
||||||
|
my_target_c_inclues := $(TARGET_C_INCLUDES)
|
||||||
|
my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
|
||||||
|
my_target_global_cppflags := $(TARGET_GLOBAL_CPPFLAGS)
|
||||||
|
endif
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_inclues)
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
|
||||||
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
## Define PRIVATE_ variables used by multiple module types
|
## Define PRIVATE_ variables used by multiple module types
|
||||||
###########################################################
|
###########################################################
|
||||||
|
@ -310,11 +355,13 @@ include $(BUILD_COPY_HEADERS)
|
||||||
# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
|
# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
|
||||||
# supply that, for example, when building libc itself.
|
# supply that, for example, when building libc itself.
|
||||||
###########################################################
|
###########################################################
|
||||||
ifndef LOCAL_IS_HOST_MODULE
|
ifdef LOCAL_IS_HOST_MODULE
|
||||||
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
||||||
LOCAL_SHARED_LIBRARIES += $($(my_prefix)DEFAULT_SYSTEM_SHARED_LIBRARIES)
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
else
|
endif
|
||||||
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
else
|
||||||
|
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES := $($(my_prefix)DEFAULT_SYSTEM_SHARED_LIBRARIES)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -373,11 +420,35 @@ endif
|
||||||
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
|
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
|
||||||
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
|
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
|
||||||
|
|
||||||
|
ifdef LOCAL_NDK_VERSION
|
||||||
built_shared_libraries := \
|
built_shared_libraries := \
|
||||||
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
||||||
$(addsuffix $(so_suffix), \
|
$(addsuffix $(so_suffix), \
|
||||||
$(LOCAL_SHARED_LIBRARIES)))
|
$(LOCAL_SHARED_LIBRARIES)))
|
||||||
|
|
||||||
|
# Get the list of INSTALLED libraries. Strip off the various
|
||||||
|
# intermediates directories and point to the common lib dirs.
|
||||||
|
installed_shared_libraries := \
|
||||||
|
$(addprefix $($(my_prefix)OUT_SHARED_LIBRARIES)/, \
|
||||||
|
$(notdir $(built_shared_libraries)))
|
||||||
|
|
||||||
|
my_system_shared_libraries_fullpath := $(addprefix $(my_ndk_version_root)/usr/lib/, \
|
||||||
|
$(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
|
||||||
|
|
||||||
|
built_shared_libraries += $(my_system_shared_libraries_fullpath)
|
||||||
|
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
||||||
|
else
|
||||||
|
LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
||||||
|
built_shared_libraries := \
|
||||||
|
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
||||||
|
$(addsuffix $(so_suffix), \
|
||||||
|
$(LOCAL_SHARED_LIBRARIES)))
|
||||||
|
|
||||||
|
installed_shared_libraries := \
|
||||||
|
$(addprefix $($(my_prefix)OUT_SHARED_LIBRARIES)/, \
|
||||||
|
$(notdir $(built_shared_libraries)))
|
||||||
|
endif
|
||||||
|
|
||||||
built_static_libraries := \
|
built_static_libraries := \
|
||||||
$(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
|
$(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
|
||||||
$(call intermediates-dir-for, \
|
$(call intermediates-dir-for, \
|
||||||
|
@ -388,12 +459,6 @@ built_whole_libraries := \
|
||||||
$(call intermediates-dir-for, \
|
$(call intermediates-dir-for, \
|
||||||
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
|
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
|
||||||
|
|
||||||
# Get the list of INSTALLED libraries. Strip off the various
|
|
||||||
# intermediates directories and point to the common lib dirs.
|
|
||||||
installed_shared_libraries := \
|
|
||||||
$(addprefix $($(my_prefix)OUT_SHARED_LIBRARIES)/, \
|
|
||||||
$(notdir $(built_shared_libraries)))
|
|
||||||
|
|
||||||
# We don't care about installed static libraries, since the
|
# We don't care about installed static libraries, since the
|
||||||
# libraries have already been linked into the module at that point.
|
# libraries have already been linked into the module at that point.
|
||||||
# We do, however, care about the NOTICE files for any static
|
# We do, however, care about the NOTICE files for any static
|
||||||
|
|
|
@ -88,6 +88,7 @@ LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
|
||||||
LOCAL_DX_FLAGS:=
|
LOCAL_DX_FLAGS:=
|
||||||
LOCAL_CERTIFICATE:=
|
LOCAL_CERTIFICATE:=
|
||||||
LOCAL_SDK_VERSION:=
|
LOCAL_SDK_VERSION:=
|
||||||
|
LOCAL_NDK_VERSION:=
|
||||||
LOCAL_NO_EMMA_INSTRUMENT:=
|
LOCAL_NO_EMMA_INSTRUMENT:=
|
||||||
LOCAL_NO_EMMA_COMPILE:=
|
LOCAL_NO_EMMA_COMPILE:=
|
||||||
LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom
|
LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom
|
||||||
|
|
|
@ -214,7 +214,7 @@ $(TARGET_CXX) \
|
||||||
-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
|
-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
|
||||||
-Wl,--gc-sections \
|
-Wl,--gc-sections \
|
||||||
-Wl,-shared,-Bsymbolic \
|
-Wl,-shared,-Bsymbolic \
|
||||||
$(TARGET_GLOBAL_LD_DIRS) \
|
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
|
||||||
$(PRIVATE_ALL_OBJECTS) \
|
$(PRIVATE_ALL_OBJECTS) \
|
||||||
-Wl,--whole-archive \
|
-Wl,--whole-archive \
|
||||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||||
|
@ -223,9 +223,9 @@ $(TARGET_CXX) \
|
||||||
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$(PRIVATE_LDFLAGS) \
|
$(PRIVATE_LDFLAGS) \
|
||||||
$(TARGET_GLOBAL_LDFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
|
||||||
$(TARGET_FDO_LIB) \
|
$(PRIVATE_TARGET_FDO_LIB) \
|
||||||
$(TARGET_LIBGCC)
|
$(PRIVATE_TARGET_LIBGCC)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define transform-o-to-executable-inner
|
define transform-o-to-executable-inner
|
||||||
|
|
|
@ -116,8 +116,8 @@ $(TARGET_CXX) \
|
||||||
-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/shlelf.xsc \
|
-nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/shlelf.xsc \
|
||||||
-Wl,--gc-sections -Wl,-z,norelro \
|
-Wl,--gc-sections -Wl,-z,norelro \
|
||||||
-Wl,-shared,-Bsymbolic \
|
-Wl,-shared,-Bsymbolic \
|
||||||
$(TARGET_GLOBAL_LD_DIRS) \
|
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
|
||||||
$(TARGET_SOBEGIN) \
|
$(PRIVATE_TARGET_SOBEGIN) \
|
||||||
$(PRIVATE_ALL_OBJECTS) \
|
$(PRIVATE_ALL_OBJECTS) \
|
||||||
-Wl,--whole-archive \
|
-Wl,--whole-archive \
|
||||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||||
|
@ -127,8 +127,8 @@ $(TARGET_CXX) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$(PRIVATE_LDFLAGS) \
|
$(PRIVATE_LDFLAGS) \
|
||||||
$(subst -lrt,, $(subst -lpthread,,$(PRIVATE_LDLIBS))) \
|
$(subst -lrt,, $(subst -lpthread,,$(PRIVATE_LDLIBS))) \
|
||||||
$(TARGET_LIBGCC) \
|
$(PRIVATE_TARGET_LIBGCC) \
|
||||||
$(TARGET_SOEND)
|
$(PRIVATE_TARGET_SOEND)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define transform-o-to-executable-inner
|
define transform-o-to-executable-inner
|
||||||
|
|
|
@ -104,12 +104,12 @@ TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||||
TARGET_CUSTOM_LD_COMMAND := true
|
TARGET_CUSTOM_LD_COMMAND := true
|
||||||
define transform-o-to-shared-lib-inner
|
define transform-o-to-shared-lib-inner
|
||||||
$(TARGET_CXX) \
|
$(TARGET_CXX) \
|
||||||
$(TARGET_GLOBAL_LDFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
|
||||||
-nostdlib -Wl,-soname,$(notdir $@) \
|
-nostdlib -Wl,-soname,$(notdir $@) \
|
||||||
-shared -Bsymbolic \
|
-shared -Bsymbolic \
|
||||||
-fPIC -march=i686 \
|
-fPIC -march=i686 \
|
||||||
$(TARGET_GLOBAL_LD_DIRS) \
|
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
|
||||||
$(TARGET_CRTBEGIN_SO_O) \
|
$(PRIVATE_TARGET_CRTBEGIN_SO_O) \
|
||||||
$(PRIVATE_ALL_OBJECTS) \
|
$(PRIVATE_ALL_OBJECTS) \
|
||||||
-Wl,--whole-archive \
|
-Wl,--whole-archive \
|
||||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||||
|
@ -118,8 +118,8 @@ $(TARGET_CXX) \
|
||||||
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$(PRIVATE_LDFLAGS) \
|
$(PRIVATE_LDFLAGS) \
|
||||||
$(TARGET_LIBGCC) \
|
$(PRIVATE_TARGET_LIBGCC) \
|
||||||
$(TARGET_CRTEND_SO_O)
|
$(PRIVATE_TARGET_CRTEND_SO_O)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -315,6 +315,7 @@ PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)
|
||||||
# ###############################################################
|
# ###############################################################
|
||||||
|
|
||||||
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/sdk
|
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/sdk
|
||||||
|
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/ndk
|
||||||
|
|
||||||
# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
|
# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
|
||||||
# The 'current' version is whatever this source tree is.
|
# The 'current' version is whatever this source tree is.
|
||||||
|
@ -336,4 +337,8 @@ TARGET_AVAILABLE_SDK_VERSIONS := current $(call numerically_sort,\
|
||||||
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
|
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
|
||||||
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
|
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
|
||||||
|
|
||||||
|
TARGET_AVAILABLE_NDK_VERSIONS := $(call numerically_sort,\
|
||||||
|
$(patsubst $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r%,%, \
|
||||||
|
$(wildcard $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r*)))
|
||||||
|
|
||||||
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml
|
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml
|
||||||
|
|
|
@ -767,16 +767,16 @@ $(hide) $(PRIVATE_CXX) \
|
||||||
$(foreach incdir, \
|
$(foreach incdir, \
|
||||||
$(PRIVATE_C_INCLUDES) \
|
$(PRIVATE_C_INCLUDES) \
|
||||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||||
$(TARGET_PROJECT_INCLUDES) \
|
$(PRIVATE_TARGET_PROJECT_INCLUDES) \
|
||||||
$(TARGET_C_INCLUDES) \
|
$(PRIVATE_TARGET_C_INCLUDES) \
|
||||||
) \
|
) \
|
||||||
, \
|
, \
|
||||||
-I $(incdir) \
|
-I $(incdir) \
|
||||||
) \
|
) \
|
||||||
-c \
|
-c \
|
||||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||||
$(TARGET_GLOBAL_CFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_CFLAGS) \
|
||||||
$(TARGET_GLOBAL_CPPFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_CPPFLAGS) \
|
||||||
$(PRIVATE_ARM_CFLAGS) \
|
$(PRIVATE_ARM_CFLAGS) \
|
||||||
) \
|
) \
|
||||||
-fno-rtti \
|
-fno-rtti \
|
||||||
|
@ -799,15 +799,15 @@ $(hide) $(PRIVATE_CC) \
|
||||||
$(foreach incdir, \
|
$(foreach incdir, \
|
||||||
$(PRIVATE_C_INCLUDES) \
|
$(PRIVATE_C_INCLUDES) \
|
||||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||||
$(TARGET_PROJECT_INCLUDES) \
|
$(PRIVATE_TARGET_PROJECT_INCLUDES) \
|
||||||
$(TARGET_C_INCLUDES) \
|
$(PRIVATE_TARGET_C_INCLUDES) \
|
||||||
) \
|
) \
|
||||||
, \
|
, \
|
||||||
-I $(incdir) \
|
-I $(incdir) \
|
||||||
) \
|
) \
|
||||||
-c \
|
-c \
|
||||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||||
$(TARGET_GLOBAL_CFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_CFLAGS) \
|
||||||
$(PRIVATE_ARM_CFLAGS) \
|
$(PRIVATE_ARM_CFLAGS) \
|
||||||
) \
|
) \
|
||||||
$(PRIVATE_CFLAGS) \
|
$(PRIVATE_CFLAGS) \
|
||||||
|
@ -1062,12 +1062,12 @@ endef
|
||||||
ifneq ($(TARGET_CUSTOM_LD_COMMAND),true)
|
ifneq ($(TARGET_CUSTOM_LD_COMMAND),true)
|
||||||
define transform-o-to-shared-lib-inner
|
define transform-o-to-shared-lib-inner
|
||||||
$(TARGET_CXX) \
|
$(TARGET_CXX) \
|
||||||
$(TARGET_GLOBAL_LDFLAGS) \
|
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
|
||||||
-Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
|
-Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
|
||||||
-Wl,-rpath,\$$ORIGIN/../lib \
|
-Wl,-rpath,\$$ORIGIN/../lib \
|
||||||
-shared -Wl,-soname,$(notdir $@) \
|
-shared -Wl,-soname,$(notdir $@) \
|
||||||
$(PRIVATE_LDFLAGS) \
|
$(PRIVATE_LDFLAGS) \
|
||||||
$(TARGET_GLOBAL_LD_DIRS) \
|
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
|
||||||
$(PRIVATE_ALL_OBJECTS) \
|
$(PRIVATE_ALL_OBJECTS) \
|
||||||
-Wl,--whole-archive \
|
-Wl,--whole-archive \
|
||||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||||
|
|
|
@ -7,10 +7,10 @@ include $(BUILD_SYSTEM)/binary.mk
|
||||||
$(LOCAL_BUILT_MODULE) : PRIVATE_ELF_FILE := $(intermediates)/$(PRIVATE_MODULE).elf
|
$(LOCAL_BUILT_MODULE) : PRIVATE_ELF_FILE := $(intermediates)/$(PRIVATE_MODULE).elf
|
||||||
$(LOCAL_BUILT_MODULE) : PRIVATE_LIBS := `$(TARGET_CC) -mthumb-interwork -print-libgcc-file-name`
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIBS := `$(TARGET_CC) -mthumb-interwork -print-libgcc-file-name`
|
||||||
|
|
||||||
$(all_objects) : TARGET_PROJECT_INCLUDES :=
|
$(all_objects) : PRIVATE_TARGET_PROJECT_INCLUDES :=
|
||||||
$(all_objects) : TARGET_C_INCLUDES :=
|
$(all_objects) : PRIVATE_TARGET_C_INCLUDES :=
|
||||||
$(all_objects) : TARGET_GLOBAL_CFLAGS :=
|
$(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
|
||||||
$(all_objects) : TARGET_GLOBAL_CPPFLAGS :=
|
$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
|
$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
|
||||||
@$(mkdir -p $(dir $@)
|
@$(mkdir -p $(dir $@)
|
||||||
|
@ -23,4 +23,3 @@ $(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
|
||||||
--start-group $(PRIVATE_ALL_STATIC_LIBRARIES) --end-group \
|
--start-group $(PRIVATE_ALL_STATIC_LIBRARIES) --end-group \
|
||||||
$(PRIVATE_LIBS)
|
$(PRIVATE_LIBS)
|
||||||
$(hide) $(TARGET_OBJCOPY) -O binary $(PRIVATE_ELF_FILE) $@
|
$(hide) $(TARGET_OBJCOPY) -O binary $(PRIVATE_ELF_FILE) $@
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,29 @@ OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
||||||
|
|
||||||
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
||||||
|
|
||||||
|
# Define PRIVATE_ variables from global vars
|
||||||
|
my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
|
||||||
|
my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
|
||||||
|
my_target_fdo_lib := $(TARGET_FDO_LIB)
|
||||||
|
my_target_libgcc := $(TARGET_LIBGCC)
|
||||||
|
my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
|
||||||
|
my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
|
||||||
|
ifdef LOCAL_NDK_VERSION
|
||||||
|
my_target_global_ld_dirs += -L$(my_ndk_version_root)/usr/lib
|
||||||
|
# The latest ndk does NOT support TARGET_CRTBEGIN_SO_O and TARGET_CRTEND_SO_O yet.
|
||||||
|
# my_target_crtbegin_so_o := $(my_ndk_version_root)/usr/lib/crtbegin_so.o
|
||||||
|
# my_target_crtend_so_o := $(my_ndk_version_root)/usr/lib/crtend_so.o
|
||||||
|
my_target_crtbegin_so_o :=
|
||||||
|
my_target_crtend_so_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_SO_O := $(my_target_crtbegin_so_o)
|
||||||
|
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
|
||||||
|
|
||||||
$(linked_module): $(all_objects) $(all_libraries) \
|
$(linked_module): $(all_objects) $(all_libraries) \
|
||||||
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
|
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
|
||||||
$(TARGET_CRTBEGIN_SO_O) $(TARGET_CRTEND_SO_O)
|
$(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
|
||||||
$(transform-o-to-shared-lib)
|
$(transform-o-to-shared-lib)
|
||||||
|
|
|
@ -19,10 +19,10 @@ include $(BUILD_SYSTEM)/binary.mk
|
||||||
|
|
||||||
ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
|
ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
|
||||||
LOCAL_RAW_STATIC_LIBRARY:=
|
LOCAL_RAW_STATIC_LIBRARY:=
|
||||||
$(all_objects) : TARGET_PROJECT_INCLUDES :=
|
$(all_objects) : PRIVATE_TARGET_PROJECT_INCLUDES :=
|
||||||
$(all_objects) : TARGET_C_INCLUDES :=
|
$(all_objects) : PRIVATE_TARGET_C_INCLUDES :=
|
||||||
$(all_objects) : TARGET_GLOBAL_CFLAGS :=
|
$(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
|
||||||
$(all_objects) : TARGET_GLOBAL_CPPFLAGS :=
|
$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
|
$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
|
||||||
|
|
Loading…
Reference in New Issue