v8: support multilib builds

Allow building for multiple architectures at the same time:
Use $(local-generated-sources-dir) instead of $(local-intermediates-dir)
Set LOCAL_CFLAGS_arch instead of ifeq ($(TARGET_ARCH),arch)
Use LOCAL_MODULE_TARGET_ARCH_WARN to restrict which architectures
attempt to build, and print a warning on the rest.

Change-Id: I66dffb36557aa47c92a1ae158683a27e9ca83e53
diff --git a/Android.mk b/Android.mk
index 148c60e..e6ea8db 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,6 +17,8 @@
 
 BASE_PATH := $(call my-dir)
 
+V8_SUPPORTED_ARCH := arm mips x86
+
 ifeq ($(TARGET_ARCH),arm)
     ifneq ($(strip $(ARCH_ARM_HAVE_ARMV7A)),true)
         $(warning WARNING: Building on ARM with non-ARMv7 variant. On ARM, V8 is well tested only on ARMv7.)
@@ -24,9 +26,15 @@
 endif
 
 # Build libv8 and d8
-ifneq ($(filter $(TARGET_ARCH),x86 arm mips),)
-    ENABLE_V8_SNAPSHOT = true
-    include $(BASE_PATH)/Android.mksnapshot.mk
-    include $(BASE_PATH)/Android.libv8.mk
-    include $(BASE_PATH)/Android.d8.mk
+
+ENABLE_V8_SNAPSHOT = true
+mksnapshot_arch := $(TARGET_ARCH)
+include $(BASE_PATH)/Android.mksnapshot.mk
+
+ifdef TARGET_2ND_ARCH
+mksnapshot_arch := $(TARGET_2ND_ARCH)
+include $(BASE_PATH)/Android.mksnapshot.mk
 endif
+
+include $(BASE_PATH)/Android.libv8.mk
+include $(BASE_PATH)/Android.d8.mk