FP2-1555: add FP2_USE_PREBUILT_LIBART[_COMPILER]

Add build support for cleaned up binary blobs

FPIIM-921

Change-Id: I1218f27970b8f13b2e6e4da6c4251a60775044e6
diff --git a/compiler/Android.mk b/compiler/Android.mk
index c38ad20..01f6f0b 100644
--- a/compiler/Android.mk
+++ b/compiler/Android.mk
@@ -296,8 +296,27 @@
   $(eval $(call build-libart-compiler,host,debug))
 endif
 ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
+ifneq ($(FP2_USE_PREBUILT_LIBART_COMPILTER),true)
   $(eval $(call build-libart-compiler,target,ndebug))
 endif
+endif
 ifeq ($(ART_BUILD_TARGET_DEBUG),true)
+ifneq ($(FP2_USE_PREBUILT_LIBART_COMPILTER),true)
   $(eval $(call build-libart-compiler,target,debug))
 endif
+endif
+
+# Rule to build /system/lib/libcompiler_rt.a
+# Usually static libraries are not installed on the device.
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ifeq ($(ART_BUILD_TARGET),true)
+# TODO: Move to external/compiler_rt
+$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler_rt,,)/libcompiler_rt.a, $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler_rt.a))
+ifdef TARGET_2ND_ARCH
+$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler_rt,,,t)/libcompiler_rt.a, $(2ND_TARGET_OUT_SHARED_LIBRARIES)/libcompiler_rt.a))
+endif
+
+$(DEX2OAT): $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler_rt.a
+
+endif
+endif
diff --git a/runtime/Android.mk b/runtime/Android.mk
index e0afd3e..9f40ada 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -522,11 +522,15 @@
 
 ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
 #  $(error $(call build-libart,target,ndebug))
+ifneq ($(FP2_USE_PREBUILT_LIBART),true)
   $(eval $(call build-libart,target,ndebug))
 endif
+endif
 ifeq ($(ART_BUILD_TARGET_DEBUG),true)
+ifneq ($(FP2_USE_PREBUILT_LIBART),true)
   $(eval $(call build-libart,target,debug))
 endif
+endif
 
 # Clear locally defined variables.
 LOCAL_PATH :=