Add libclang for target.

Change-Id: I3dc5de6c1a4e7f5ba64196dd8ee0965ef10d4e8b
diff --git a/shared_clang.mk b/shared_clang.mk
new file mode 100644
index 0000000..604067b
--- /dev/null
+++ b/shared_clang.mk
@@ -0,0 +1,56 @@
+# Don't build the library unless forced to.
+ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
+# Don't build the library in unbundled branches.
+ifeq (,$(TARGET_BUILD_APPS))
+
+LOCAL_PATH:= $(call my-dir)
+
+clang_whole_static_libraries := \
+	libclangDriver \
+	libclangParse \
+	libclangSema \
+	libclangAnalysis \
+	libclangCodeGen \
+	libclangAST \
+	libclangEdit \
+	libclangLex \
+	libclangFrontend \
+	libclangBasic \
+	libclangRewriteFrontend \
+	libclangRewriteCore \
+	libclangSerialization
+
+# host
+include $(CLEAR_VARS)
+
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE:= libclang
+LOCAL_MODULE_TAGS := optional
+LOCAL_WHOLE_STATIC_LIBRARIES := $(clang_whole_static_libraries)
+
+ifeq ($(HOST_OS),windows)
+  LOCAL_SHARED_LIBRARIES := libLLVM
+  LOCAL_LDLIBS := -limagehlp -lpsapi
+else
+  LOCAL_SHARED_LIBRARIES := libLLVM libc++
+  LOCAL_LDLIBS := -ldl -lpthread
+endif
+
+include $(CLANG_HOST_BUILD_MK)
+include $(BUILD_HOST_SHARED_LIBRARY)
+
+# device
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= libclang
+LOCAL_MODULE_TAGS := optional
+LOCAL_WHOLE_STATIC_LIBRARIES := $(clang_whole_static_libraries)
+
+LOCAL_SHARED_LIBRARIES := libLLVM libc++
+LOCAL_LDLIBS := -ldl
+
+include $(CLANG_DEVICE_BUILD_MK)
+include $(BUILD_SHARED_LIBRARY)
+
+endif # don't build in unbundled branches
+endif # don't build unless forced to