Support to switch between prebuilt and buiding from source

For target shared library and executable.

Change-Id: I40a4e4e0c971811ac60e9bd04206f2422387d3d0
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 97442f7..10012df 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -20,6 +20,17 @@
 $(error $(LOCAL_PATH): Cannot set module stem for a library)
 endif
 
+$(call target-shared-library-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
 ####################################################
 ## Add profiling libraries if aprof is turned
 ####################################################
@@ -68,3 +79,5 @@
                   $(LOCAL_ADDITIONAL_DEPENDENCIES) \
                   $(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
 	$(transform-o-to-shared-lib)
+
+endif  # skip_build_from_source