2014-01-18 01:17:28 +01:00
|
|
|
###########################################################
|
|
|
|
## 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)))
|
2014-02-26 03:26:29 +01:00
|
|
|
include $(BUILD_SYSTEM)/prebuilt_internal.mk
|
2014-01-18 01:17:28 +01:00
|
|
|
skip_build_from_source := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef skip_build_from_source
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
2014-08-15 20:30:23 +02:00
|
|
|
# Check for statically linked libc
|
|
|
|
ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
|
|
|
ifneq ($(filter $(my_static_libraries),libc),)
|
|
|
|
$(error $(LOCAL_PATH): $(LOCAL_MODULE) is statically linking libc to dynamic executable, please remove libc from static libs or set LOCAL_FORCE_STATIC_EXECUTABLE := true)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-01-18 01:17:28 +01:00
|
|
|
# Define PRIVATE_ variables from global vars
|
|
|
|
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
|
2015-01-26 01:20:57 +01:00
|
|
|
my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
|
2014-09-19 23:25:57 +02:00
|
|
|
my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
|
2014-01-18 01:17:28 +01:00
|
|
|
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
|
2014-05-29 11:47:27 +02:00
|
|
|
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
|
2014-01-18 01:17:28 +01:00
|
|
|
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))) \
|
2014-04-26 08:47:10 +02:00
|
|
|
$(my_ndk_sysroot_lib)) \
|
2014-01-18 01:17:28 +01:00
|
|
|
$(my_target_global_ld_dirs)
|
|
|
|
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
|
2014-04-26 08:47:10 +02:00
|
|
|
my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_dynamic.o)
|
|
|
|
my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o)
|
|
|
|
my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
|
2014-01-18 01:17:28 +01:00
|
|
|
endif
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
2015-01-26 01:20:57 +01:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBPROFILE_RT := $(my_target_libprofile_rt)
|
2014-09-19 23:25:57 +02:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov)
|
2014-01-18 01:17:28 +01:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
|
2014-05-29 11:47:27 +02:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
|
2014-01-18 01:17:28 +01:00
|
|
|
$(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)
|
2014-02-22 01:17:05 +01:00
|
|
|
$(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
2014-01-18 01:17:28 +01:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
2014-09-06 00:46:43 +02:00
|
|
|
$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
|
2014-01-18 01:17:28 +01:00
|
|
|
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
|
|
|
|
$(transform-o-to-static-executable)
|
2014-09-06 00:46:43 +02:00
|
|
|
$(PRIVATE_POST_LINK_CMD)
|
2014-01-18 01:17:28 +01:00
|
|
|
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
|