Merge "Revert "Move libclang prebuilt to Android.bp""
diff --git a/tools/Android.bp b/tools/Android.bp
index ba368c2..12df8c1 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -15,23 +15,5 @@
enabled: true,
}
},
-}
-
-cc_prebuilt_shared_library {
- name: "libclang",
- host_supported: true,
- target: {
- linux_x86_64: {
- srcs: ["linux/lib64/libclang.so"],
- },
- darwin_x86_64: {
- srcs: ["darwin/lib64/libclang.dylib"],
- },
- // TODO(ccross): this is necessary because the prebuilt module must have
- // all the variants that are in the source module. Ideally Soong's
- // arch mutator should handle this.
- windows: {
- enabled: true,
- }
- },
+ prefer: false,
}
diff --git a/tools/Android.mk b/tools/Android.mk
index a748ce3..6adc7a3 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -331,4 +331,22 @@
endif # old version of build/ project.
-# libLLVM and libclang are defined in Android.bp
+# Only build Clang/LLVM components when forced to.
+ifneq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
+
+# libLLVM is defined in Android.bp
+
+##################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libclang
+LOCAL_SRC_FILES := $(HOST_OS)/lib64/$(LOCAL_MODULE)$(HOST_SHLIB_SUFFIX)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MULTILIB := 64
+
+include $(BUILD_PREBUILT)
+
+endif #!FORCE_BUILD_LLVM_COMPONENTS