Fix the LLVM build. Separate out libart-compiler-llvm.so.

After this refactoring:
If (!USE_LLVM_COMPILER), I pass the test-art and boot the phone alright.
The behavior is the same for non-LLVM builds as before. Multi-target
art-compiler shared libraries are generated as before.
If (USE_LLVM_COMPILER), I generate libart-compiler-llvm.so successfully.

Note that the ideal refactoring for the next step will be to always build
art-compiler and LLVM-[arm|mips|x86] shared libraries. Currently, we
haven't removed all the ifdefs for libart.so yet, so this is not ideal yet.
Reason for not-done-yet is that the next step requires discussions.
I can remove all the ifdefs today, but then the (!USE_LLVM_COMPILER)
build will incur extra fields and overhead.

This refactoring allows us to restore the LLVM build situation to be before
the breakage yesterday, so we can continue making forward progress again.

One difficulty in the refactoring is that LLVM is not a method compiler
in default, unlike (!USE_LLVM_COMPILER). LLVM actually compiles an LLVM module
at a time normally. So we need to do more call backs and tell
libart-compiler-llvm.so in each invocation where we are in terms of
OatCompilationUnit.

Another difficulty is that currently our LLVM compiler is not
multithreaded and requires locking, unlike (!USE_LLVM_COMPILER). So more
callbacks are needed. This will be fixed when we fix the multithreading
issue.

Change-Id: I93bce21b6d673254188f2a60b1a7f91b508e497f
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index c44a5e3..c85b170 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -19,6 +19,11 @@
 ART_HOST_TEST_TARGETS :=
 ART_TARGET_TEST_TARGETS :=
 
+ART_TEST_CFLAGS :=
+ifeq ($(ART_USE_LLVM_COMPILER),true)
+  ART_TEST_CFLAGS += -DART_USE_LLVM_COMPILER=1
+endif
+
 # $(1): target or host
 # $(2): file name
 define build-art-test
@@ -61,8 +66,9 @@
     LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClass_bar -Wl,-u,Java_MyClass_sbar
   endif
 
+  LOCAL_CFLAGS := $(ART_TEST_CFLAGS)
   ifeq ($$(art_target_or_host),target)
-    LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS)
+    LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS)
     LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libstlport libz
     LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
     LOCAL_MODULE_PATH := $(ART_NATIVETEST_OUT)
@@ -70,7 +76,7 @@
     art_gtest_exe := $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE)
     ART_TARGET_TEST_EXECUTABLES += $$(art_gtest_exe)
   else # host
-    LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
+    LOCAL_CFLAGS += $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
     LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host
     # glibc complains about double frees if you include both libraries, but Mac OS
     # complains about unresolved symbols if you don't!