aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-12-08 16:53:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-12-08 16:53:50 +0000
commit518deafd2305a2e14093dd543df63d05c45af2f9 (patch)
treea329c7f3a8394943d14d153b4a1d8c1809f1b925
parent1f7b24f6e36e902a202641e378fb7f9167a5aa81 (diff)
parentcfa1764018407bcb63bb5ee32b8842b8740e90f5 (diff)
downloadclang-518deafd2305a2e14093dd543df63d05c45af2f9.tar.gz
Merge "Convert clang to Android.bp"
-rw-r--r--Android.bp242
-rw-r--r--Android.mk51
-rwxr-xr-xbuild.py5
-rw-r--r--clang-device-build.mk45
-rw-r--r--clang-tblgen-rules.mk8
-rw-r--r--clang-version-inc.mk17
-rw-r--r--clang.mk2
-rw-r--r--lib/ARCMigrate/Android.bp5
-rw-r--r--lib/ARCMigrate/Android.mk64
-rw-r--r--lib/AST/Android.bp5
-rw-r--r--lib/AST/Android.mk109
-rw-r--r--lib/ASTMatchers/Android.bp5
-rw-r--r--lib/ASTMatchers/Android.mk43
-rw-r--r--lib/Analysis/Android.bp5
-rw-r--r--lib/Analysis/Android.mk64
-rw-r--r--lib/Android.bp1
-rw-r--r--lib/Basic/Android.bp5
-rw-r--r--lib/Basic/Android.mk48
-rw-r--r--lib/CodeGen/Android.bp5
-rw-r--r--lib/CodeGen/Android.mk53
-rw-r--r--lib/Driver/Android.bp5
-rw-r--r--lib/Driver/Android.mk55
-rw-r--r--lib/Edit/Android.bp5
-rw-r--r--lib/Edit/Android.mk43
-rw-r--r--lib/Format/Android.bp5
-rw-r--r--lib/Format/Android.mk47
-rw-r--r--lib/Frontend/Android.bp7
-rw-r--r--lib/Frontend/Android.mk84
-rw-r--r--lib/Frontend/Rewrite/Android.bp5
-rw-r--r--lib/Frontend/Rewrite/Android.mk48
-rw-r--r--lib/FrontendTool/Android.bp10
-rw-r--r--lib/FrontendTool/Android.mk31
-rw-r--r--lib/Index/Android.bp5
-rw-r--r--lib/Index/Android.mk41
-rw-r--r--lib/Lex/Android.bp5
-rw-r--r--lib/Lex/Android.mk55
-rw-r--r--lib/Parse/Android.bp5
-rw-r--r--lib/Parse/Android.mk58
-rw-r--r--lib/Rewrite/Android.bp5
-rw-r--r--lib/Rewrite/Android.mk44
-rw-r--r--lib/Sema/Android.bp5
-rw-r--r--lib/Sema/Android.mk96
-rw-r--r--lib/Serialization/Android.bp5
-rw-r--r--lib/Serialization/Android.mk58
-rw-r--r--lib/StaticAnalyzer/Android.bp1
-rw-r--r--lib/StaticAnalyzer/Checkers/Android.bp9
-rw-r--r--lib/StaticAnalyzer/Checkers/Android.mk34
-rw-r--r--lib/StaticAnalyzer/Checkers/MPI-Checker/Android.bp5
-rw-r--r--lib/StaticAnalyzer/Checkers/MPI-Checker/Android.mk40
-rw-r--r--lib/StaticAnalyzer/Core/Android.bp7
-rw-r--r--lib/StaticAnalyzer/Core/Android.mk72
-rw-r--r--lib/StaticAnalyzer/Frontend/Android.bp7
-rw-r--r--lib/StaticAnalyzer/Frontend/Android.mk43
-rw-r--r--lib/Tooling/Android.bp7
-rw-r--r--lib/Tooling/Android.mk41
-rw-r--r--lib/Tooling/Core/Android.bp5
-rw-r--r--lib/Tooling/Core/Android.mk38
-rw-r--r--shared_clang.mk76
-rw-r--r--soong/Android.bp15
-rw-r--r--soong/clang.go57
-rw-r--r--soong/tblgen.go172
-rw-r--r--tools/clang-check/Android.bp109
-rw-r--r--tools/clang-check/Android.mk128
-rw-r--r--tools/clang-format/Android.bp106
-rw-r--r--tools/clang-format/Android.mk121
-rw-r--r--tools/driver/Android.bp109
-rw-r--r--tools/driver/Android.mk129
-rw-r--r--tools/libclang/Android.bp5
-rw-r--r--tools/libclang/Android.mk45
-rw-r--r--utils/TableGen/Android.bp33
-rw-r--r--utils/TableGen/Android.mk33
71 files changed, 991 insertions, 1965 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000000..b0d30b5489
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,242 @@
+cc_defaults {
+ name: "clang-defaults",
+ defaults: [
+ "llvm-defaults",
+ "clang-generated-headers",
+ ],
+ clang: true,
+
+ cflags: [
+ "-pedantic",
+ "-Wcast-qual",
+ "-Wno-long-long",
+ ],
+
+ include_dirs: [
+ "external/clang/include",
+ "external/clang/lib/CodeGen",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ cflags: [
+ // This triggers an assertion on cross Windows builds.
+ "-Wno-error=uninitialized",
+ ],
+ },
+ },
+
+}
+
+cc_defaults {
+ name: "clang-generated-headers",
+ generated_headers: [
+ "clang-gen-options",
+ "clang-gen-attributes",
+ "clang-gen-checkers",
+ "clang-gen-comment-commands",
+ "clang-gen-comment-html-named-character-references",
+ "clang-gen-html-tags",
+ "clang-gen-comment-nodes",
+ "clang-gen-diagnostics",
+ "clang-gen-declnodes",
+ "clang-gen-statnodes",
+ "clang-gen-arm-neon",
+ "clang-version",
+ "llvm-gen-attributes",
+ "llvm-gen-intrinsics",
+ ],
+}
+
+llvm_tblgen {
+ name: "clang-gen-options",
+ in: "include/clang/Driver/Options.td",
+ outs: ["clang/Driver/Options.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-attributes",
+ in: "include/clang/Basic/Attr.td",
+ outs: [
+ "clang/AST/AttrDump.inc",
+ "clang/AST/AttrImpl.inc",
+ "clang/AST/Attrs.inc",
+ "clang/AST/AttrVisitor.inc",
+ "clang/Basic/AttrHasAttributeImpl.inc",
+ "clang/Basic/AttrList.inc",
+ "clang/Parse/AttrParserStringSwitches.inc",
+ "clang/Sema/AttrParsedAttrImpl.inc",
+ "clang/Sema/AttrParsedAttrKinds.inc",
+ "clang/Sema/AttrParsedAttrList.inc",
+ "clang/Sema/AttrSpellingListIndex.inc",
+ "clang/Sema/AttrTemplateInstantiate.inc",
+ "clang/Serialization/AttrPCHRead.inc",
+ "clang/Serialization/AttrPCHWrite.inc",
+ ],
+}
+
+clang_tblgen {
+ name: "clang-gen-checkers",
+ in: "include/clang/StaticAnalyzer/Checkers/Checkers.td",
+ outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-comment-commands",
+ in: "include/clang/AST/CommentCommands.td",
+ outs: [
+ "clang/AST/CommentCommandInfo.inc",
+ "clang/AST/CommentCommandList.inc",
+ ],
+}
+
+clang_tblgen {
+ name: "clang-gen-comment-html-named-character-references",
+ in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td",
+ outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-html-tags",
+ in: "include/clang/AST/CommentHTMLTags.td",
+ outs: [
+ "clang/AST/CommentHTMLTagsProperties.inc",
+ "clang/AST/CommentHTMLTags.inc",
+ ],
+}
+
+clang_tblgen {
+ name: "clang-gen-comment-nodes",
+ in: "include/clang/Basic/CommentNodes.td",
+ outs: ["clang/AST/CommentNodes.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-diagnostics",
+ in: "include/clang/Basic/Diagnostic.td",
+ outs: [
+ "clang/Basic/DiagnosticAnalysisKinds.inc",
+ "clang/Basic/DiagnosticASTKinds.inc",
+ "clang/Basic/DiagnosticCommentKinds.inc",
+ "clang/Basic/DiagnosticCommonKinds.inc",
+ "clang/Basic/DiagnosticDriverKinds.inc",
+ "clang/Basic/DiagnosticFrontendKinds.inc",
+ "clang/Basic/DiagnosticLexKinds.inc",
+ "clang/Basic/DiagnosticParseKinds.inc",
+ "clang/Basic/DiagnosticSemaKinds.inc",
+ "clang/Basic/DiagnosticSerializationKinds.inc",
+ "clang/Basic/DiagnosticGroups.inc",
+ "clang/Basic/DiagnosticIndexName.inc",
+ ],
+}
+
+clang_tblgen {
+ name: "clang-gen-declnodes",
+ in: "include/clang/Basic/DeclNodes.td",
+ outs: ["clang/AST/DeclNodes.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-statnodes",
+ in: "include/clang/Basic/StmtNodes.td",
+ outs: ["clang/AST/StmtNodes.inc"],
+}
+
+clang_tblgen {
+ name: "clang-gen-arm-neon",
+ in: "include/clang/Basic/arm_neon.td",
+ outs: [
+ "clang/Basic/arm_neon.inc",
+ "clang/Basic/arm_neon.h",
+ ],
+}
+
+genrule {
+ name: "clang-version",
+ cmd: "$(location) $(in) > $(out)",
+ tool_files: [
+ "clang-version-inc.py",
+ "version.py",
+ ],
+ srcs: [
+ "include/clang/Basic/Version.inc.in",
+ ],
+ out: ["clang/Basic/Version.inc"],
+}
+
+llvm_cc_library_shared {
+ name: "libclang",
+ defaults: ["clang-defaults"],
+
+ host_supported: true,
+
+ whole_static_libs: [
+ "libclangAnalysis",
+ "libclangAST",
+ "libclangASTMatchers",
+ "libclangBasic",
+ "libclangCodeGen",
+ "libclangDriver",
+ "libclangEdit",
+ "libclangFormat",
+ "libclangFrontend",
+ "libclangIndex",
+ "libclangLex",
+ "libclangLibclang",
+ "libclangParse",
+ "libclangRewrite",
+ "libclangRewriteFrontend",
+ "libclangSema",
+ "libclangSerialization",
+ "libclangTooling",
+ "libclangToolingCore",
+ ],
+
+ export_include_dirs: ["include"],
+ export_shared_lib_headers: ["libLLVM"],
+ shared_libs: ["libLLVM"],
+
+ target: {
+ windows: {
+ host_ldlibs: [
+ "-limagehlp",
+ "-lpsapi",
+ "-lversion",
+ ],
+ },
+ darwin: {
+ shared_libs: ["libc++"],
+
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ },
+ linux: {
+ shared_libs: ["libc++"],
+
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ },
+ },
+
+ product_variables: {
+ unbundled_build: {
+ // Don't build the library in unbundled branches.
+ enabled: false,
+ },
+ },
+}
+
+subdirs = [
+ "lib",
+ "soong",
+ "utils/TableGen",
+ "tools/clang-check",
+ "tools/clang-format",
+ "tools/driver",
+ "tools/libclang",
+]
diff --git a/Android.mk b/Android.mk
index 590e1a16d7..d26c7058ba 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,18 +1,6 @@
LOCAL_PATH := $(call my-dir)
CLANG_ROOT_PATH := $(LOCAL_PATH)
-FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
-# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
-ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10"
- $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset)
-endif
-
-FORCE_BUILD_LLVM_DEBUG ?= false
-# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
-ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10"
- $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset)
-endif
-
.PHONY: clang-toolchain-minimal clang-toolchain-full llvm-tools
clang-toolchain-minimal: \
clang
@@ -107,42 +95,3 @@ clang-toolchain-minimal: \
$(UBSAN_RUNTIME_LIBRARY)
endif
-
-include $(CLEAR_VARS)
-
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
- lib/Analysis \
- lib/AST \
- lib/ASTMatchers \
- lib/ARCMigrate \
- lib/Basic \
- lib/CodeGen \
- lib/Driver \
- lib/Edit \
- lib/Format \
- lib/Frontend \
- lib/Frontend/Rewrite \
- lib/FrontendTool \
- lib/Index \
- lib/Lex \
- lib/Parse \
- lib/Rewrite \
- lib/Sema \
- lib/Serialization \
- lib/StaticAnalyzer/Checkers \
- lib/StaticAnalyzer/Checkers/MPI-Checker \
- lib/StaticAnalyzer/Core \
- lib/StaticAnalyzer/Frontend \
- lib/Tooling \
- lib/Tooling/Core \
- tools/clang-check \
- tools/clang-format \
- tools/driver \
- tools/libclang \
- utils/TableGen \
- ))
-
-include $(LOCAL_PATH)/clang.mk
-include $(LOCAL_PATH)/shared_clang.mk
-
-include $(subdirs)
diff --git a/build.py b/build.py
index 7f288e9329..c16eee97eb 100755
--- a/build.py
+++ b/build.py
@@ -378,11 +378,10 @@ def install_headers(build_dir, install_dir, host):
install_file(android_path('bionic/libc/include/stdatomic.h'), headers_dst)
- # arm_neon.h gets produced as part of external/clang/lib/Basic/Android.mk.
+ # arm_neon.h gets produced as part of external/clang/Android.bp.
# We must bundle the resulting file as part of the official Clang headers.
arm_neon_h = os.path.join(
- build_dir, 'host', host, 'obj/STATIC_LIBRARIES/'
- 'libclangBasic_intermediates/include/clang/Basic/arm_neon.h')
+ build_dir, 'soong/.intermediates/external/clang/clang-gen-arm-neon/gen/clang/Basic/arm_neon.h')
install_file(arm_neon_h, headers_dst)
symlink(short_version(),
diff --git a/clang-device-build.mk b/clang-device-build.mk
deleted file mode 100644
index 4d30ed831a..0000000000
--- a/clang-device-build.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-LOCAL_CFLAGS := \
- -pedantic \
- -Wcast-qual \
- -Wno-long-long \
- $(LOCAL_CFLAGS)
-
-LOCAL_CPPFLAGS := \
- -Wno-sign-promo \
- $(LOCAL_CPPFLAGS)
-
-ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
-LOCAL_CFLAGS := \
- $(LOCAL_CFLAGS) \
- -D_DEBUG \
- -UNDEBUG
-endif
-
-# Make sure bionic is first so we can include system headers.
-LOCAL_C_INCLUDES := \
- $(CLANG_ROOT_PATH)/include \
- $(CLANG_ROOT_PATH)/lib/CodeGen \
- $(LOCAL_C_INCLUDES)
-
-LLVM_ROOT_PATH := external/llvm
-include $(LLVM_ROOT_PATH)/llvm.mk
-
-ifneq ($(LLVM_DEVICE_BUILD_MK),)
-include $(LLVM_DEVICE_BUILD_MK)
-endif
-
-###########################################################
-## Commands for running tblgen to compile a td file
-###########################################################
-define transform-device-clang-td-to-out
-@mkdir -p $(dir $@)
-@echo "Device Clang TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<"
-$(hide) $(CLANG_TBLGEN) \
- -I $(dir $<) \
- -I $(LLVM_ROOT_PATH)/include \
- -I $(LLVM_ROOT_PATH)/device/include \
- -I $(LLVM_ROOT_PATH)/lib/Target \
- $(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,) \
- -gen-$(strip $(1)) \
- -d $@.d -o $@ $<
-endef
diff --git a/clang-tblgen-rules.mk b/clang-tblgen-rules.mk
index 51abf52417..ea5ab5433c 100644
--- a/clang-tblgen-rules.mk
+++ b/clang-tblgen-rules.mk
@@ -2,9 +2,7 @@
## Commands for running LLVM tblgen to compile a td file
##########################################################
define transform-llvm-td-to-out
-$(if $(LOCAL_IS_HOST_MODULE), \
- $(call transform-host-td-to-out,$(1)), \
- $(call transform-device-td-to-out,$(1)))
+ $(call transform-host-td-to-out,$(1))
endef
# $(1): an output file
@@ -29,9 +27,7 @@ endif
ifneq ($(strip $(TBLGEN_TABLES)),)
define transform-clang-td-to-out
-$(if $(LOCAL_IS_HOST_MODULE), \
- $(call transform-host-clang-td-to-out,$(1)), \
- $(call transform-device-clang-td-to-out,$(1)))
+ $(call transform-host-clang-td-to-out,$(1))
endef
# $(1): an output file
diff --git a/clang-version-inc.mk b/clang-version-inc.mk
deleted file mode 100644
index cdf87a3d91..0000000000
--- a/clang-version-inc.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-###########################################################
-## Generate clang/Basic/Version.inc
-###########################################################
-ifeq ($(LOCAL_MODULE_CLASS),)
- LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-
-intermediates := $(call local-generated-sources-dir)
-
-# Compute the Clang version from the LLVM version, unless specified explicitly.
-# (from include/clang/Basic/Makefile)
-LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/Version.inc
-$(intermediates)/include/clang/Basic/Version.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Version.inc.in \
- $(CLANG_ROOT_PATH)/clang-version-inc.py $(CLANG_ROOT_PATH)/version.py
- @echo "Updating Clang version info."
- @mkdir -p $(dir $@)
- $(hide) $(CLANG_ROOT_PATH)/clang-version-inc.py $< >$@
diff --git a/clang.mk b/clang.mk
index f184616ac5..24dbb9b94e 100644
--- a/clang.mk
+++ b/clang.mk
@@ -1,6 +1,4 @@
CLANG_ROOT_PATH := external/clang
CLANG_HOST_BUILD_MK := $(CLANG_ROOT_PATH)/clang-host-build.mk
-CLANG_DEVICE_BUILD_MK := $(CLANG_ROOT_PATH)/clang-device-build.mk
CLANG_TBLGEN_RULES_MK := $(CLANG_ROOT_PATH)/clang-tblgen-rules.mk
-CLANG_VERSION_INC_MK := $(CLANG_ROOT_PATH)/clang-version-inc.mk
diff --git a/lib/ARCMigrate/Android.bp b/lib/ARCMigrate/Android.bp
new file mode 100644
index 0000000000..3a799aed6e
--- /dev/null
+++ b/lib/ARCMigrate/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangARCMigrate",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/ARCMigrate/Android.mk b/lib/ARCMigrate/Android.mk
deleted file mode 100644
index 2a4607adaf..0000000000
--- a/lib/ARCMigrate/Android.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- Attrs.inc \
- AttrList.inc \
- AttrParsedAttrList.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticGroups.inc \
- DiagnosticSemaKinds.inc \
- StmtNodes.inc
-
-clang_arc_migrate_SRC_FILES := \
- ARCMT.cpp \
- ARCMTActions.cpp \
- FileRemapper.cpp \
- ObjCMT.cpp \
- PlistReporter.cpp \
- TransAPIUses.cpp \
- TransARCAssign.cpp \
- TransAutoreleasePool.cpp \
- TransBlockObjCVariable.cpp \
- TransEmptyStatementsAndDealloc.cpp \
- TransformActions.cpp \
- Transforms.cpp \
- TransGCAttrs.cpp \
- TransGCCalls.cpp \
- TransProperties.cpp \
- TransProtectedScope.cpp \
- TransRetainReleaseDealloc.cpp \
- TransUnbridgedCasts.cpp \
- TransUnusedInitDelegate.cpp \
- TransZeroOutPropsInDealloc.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_arc_migrate_SRC_FILES)
-LOCAL_MODULE := libclangARCMigrate
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# ============================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_arc_migrate_SRC_FILES)
-LOCAL_MODULE := libclangARCMigrate
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/AST/Android.bp b/lib/AST/Android.bp
new file mode 100644
index 0000000000..5579bb5a2e
--- /dev/null
+++ b/lib/AST/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangAST",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/AST/Android.mk b/lib/AST/Android.mk
deleted file mode 100644
index 59bfc1c236..0000000000
--- a/lib/AST/Android.mk
+++ /dev/null
@@ -1,109 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrDump.inc \
- AttrImpl.inc \
- AttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandInfo.inc \
- CommentCommandList.inc \
- CommentHTMLNamedCharacterReferences.inc \
- CommentHTMLTags.inc \
- CommentHTMLTagsProperties.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticASTKinds.inc \
- DiagnosticCommentKinds.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticSemaKinds.inc \
- StmtNodes.inc
-
-clang_ast_SRC_FILES := \
- APValue.cpp \
- ASTConsumer.cpp \
- ASTContext.cpp \
- ASTDiagnostic.cpp \
- ASTDumper.cpp \
- ASTImporter.cpp \
- ASTTypeTraits.cpp \
- AttrImpl.cpp \
- CommentBriefParser.cpp \
- CommentCommandTraits.cpp \
- Comment.cpp \
- CommentLexer.cpp \
- CommentParser.cpp \
- CommentSema.cpp \
- CXXInheritance.cpp \
- DeclarationName.cpp \
- DeclBase.cpp \
- Decl.cpp \
- DeclCXX.cpp \
- DeclFriend.cpp \
- DeclGroup.cpp \
- DeclObjC.cpp \
- DeclOpenMP.cpp \
- DeclPrinter.cpp \
- DeclTemplate.cpp \
- ExprClassification.cpp \
- ExprConstant.cpp \
- Expr.cpp \
- ExprCXX.cpp \
- ExprObjC.cpp \
- ExternalASTSource.cpp \
- InheritViz.cpp \
- ItaniumCXXABI.cpp \
- ItaniumMangle.cpp \
- Mangle.cpp \
- MicrosoftCXXABI.cpp \
- MicrosoftMangle.cpp \
- NestedNameSpecifier.cpp \
- NSAPI.cpp \
- OpenMPClause.cpp \
- ParentMap.cpp \
- RawCommentList.cpp \
- RecordLayoutBuilder.cpp \
- RecordLayout.cpp \
- SelectorLocationsKind.cpp \
- Stmt.cpp \
- StmtCXX.cpp \
- StmtIterator.cpp \
- StmtObjC.cpp \
- StmtOpenMP.cpp \
- StmtPrinter.cpp \
- StmtProfile.cpp \
- StmtViz.cpp \
- TemplateBase.cpp \
- TemplateName.cpp \
- Type.cpp \
- TypeLoc.cpp \
- TypePrinter.cpp \
- VTableBuilder.cpp \
- VTTBuilder.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_ast_SRC_FILES)
-LOCAL_MODULE:= libclangAST
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_ast_SRC_FILES)
-LOCAL_MODULE:= libclangAST
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/ASTMatchers/Android.bp b/lib/ASTMatchers/Android.bp
new file mode 100644
index 0000000000..dbdf173628
--- /dev/null
+++ b/lib/ASTMatchers/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangASTMatchers",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/ASTMatchers/Android.mk b/lib/ASTMatchers/Android.mk
deleted file mode 100644
index 25395f10ab..0000000000
--- a/lib/ASTMatchers/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc \
-
-clang_astmatchers_SRC_FILES := \
- ASTMatchFinder.cpp \
- ASTMatchersInternal.cpp
-
-# For the host
-# =====================================================
-#
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_astmatchers_SRC_FILES)
-LOCAL_MODULE:= libclangASTMatchers
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(clang_astmatchers_SRC_FILES)
-LOCAL_MODULE:= libclangASTMatchers
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Analysis/Android.bp b/lib/Analysis/Android.bp
new file mode 100644
index 0000000000..cb9300ce0f
--- /dev/null
+++ b/lib/Analysis/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangAnalysis",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Analysis/Android.mk b/lib/Analysis/Android.mk
deleted file mode 100644
index 4c6cc512b3..0000000000
--- a/lib/Analysis/Android.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticAnalysisKinds.inc \
- StmtNodes.inc
-
-clang_analysis_SRC_FILES := \
- AnalysisDeclContext.cpp \
- BodyFarm.cpp \
- CallGraph.cpp \
- CFG.cpp \
- CFGReachabilityAnalysis.cpp \
- CFGStmtMap.cpp \
- CocoaConventions.cpp \
- CodeInjector.cpp \
- Consumed.cpp \
- Dominators.cpp \
- FormatString.cpp \
- LiveVariables.cpp \
- ObjCNoReturn.cpp \
- PostOrderCFGView.cpp \
- PrintfFormatString.cpp \
- ProgramPoint.cpp \
- PseudoConstantAnalysis.cpp \
- ReachableCode.cpp \
- ScanfFormatString.cpp \
- ThreadSafetyCommon.cpp \
- ThreadSafety.cpp \
- ThreadSafetyLogical.cpp \
- ThreadSafetyTIL.cpp \
- UninitializedValues.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_analysis_SRC_FILES)
-LOCAL_MODULE:= libclangAnalysis
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_analysis_SRC_FILES)
-LOCAL_MODULE:= libclangAnalysis
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Android.bp b/lib/Android.bp
new file mode 100644
index 0000000000..b44c296012
--- /dev/null
+++ b/lib/Android.bp
@@ -0,0 +1 @@
+subdirs = ["*"]
diff --git a/lib/Basic/Android.bp b/lib/Basic/Android.bp
new file mode 100644
index 0000000000..e2318a1ed3
--- /dev/null
+++ b/lib/Basic/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangBasic",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Basic/Android.mk b/lib/Basic/Android.mk
deleted file mode 100644
index e345624b13..0000000000
--- a/lib/Basic/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrHasAttributeImpl.inc \
- DiagnosticASTKinds.inc \
- DiagnosticAnalysisKinds.inc \
- DiagnosticCommentKinds.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticGroups.inc \
- DiagnosticIndexName.inc \
- DiagnosticLexKinds.inc \
- DiagnosticParseKinds.inc \
- DiagnosticSemaKinds.inc \
- DiagnosticSerializationKinds.inc \
- arm_neon.h \
- arm_neon.inc
-
-clang_basic_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_basic_SRC_FILES)
-LOCAL_MODULE:= libclangBasic
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_basic_SRC_FILES)
-LOCAL_MODULE:= libclangBasic
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/CodeGen/Android.bp b/lib/CodeGen/Android.bp
new file mode 100644
index 0000000000..ca1bce03ae
--- /dev/null
+++ b/lib/CodeGen/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangCodeGen",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/CodeGen/Android.mk b/lib/CodeGen/Android.mk
deleted file mode 100644
index 95d5ae7ad5..0000000000
--- a/lib/CodeGen/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-clang_codegen_TBLGEN_TABLES := \
- AttrList.inc \
- AttrParsedAttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticSemaKinds.inc \
- StmtNodes.inc \
- arm_neon.inc
-
-clang_codegen_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libclangCodeGen
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(clang_codegen_SRC_FILES)
-TBLGEN_TABLES := $(clang_codegen_TBLGEN_TABLES)
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libclangCodeGen
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(clang_codegen_SRC_FILES)
-TBLGEN_TABLES := $(clang_codegen_TBLGEN_TABLES)
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Driver/Android.bp b/lib/Driver/Android.bp
new file mode 100644
index 0000000000..5e6858d184
--- /dev/null
+++ b/lib/Driver/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangDriver",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Driver/Android.mk b/lib/Driver/Android.mk
deleted file mode 100644
index 5e1c464a72..0000000000
--- a/lib/Driver/Android.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrVisitor.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticSemaKinds.inc \
- Options.inc \
- CC1Options.inc
-
-clang_driver_SRC_FILES := \
- Action.cpp \
- Compilation.cpp \
- CrossWindowsToolChain.cpp \
- Driver.cpp \
- DriverOptions.cpp \
- Job.cpp \
- MinGWToolChain.cpp \
- MSVCToolChain.cpp \
- Multilib.cpp \
- Phases.cpp \
- SanitizerArgs.cpp \
- ToolChain.cpp \
- ToolChains.cpp \
- Tool.cpp \
- Tools.cpp \
- Types.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_driver_SRC_FILES)
-LOCAL_MODULE := libclangDriver
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_driver_SRC_FILES)
-LOCAL_MODULE := libclangDriver
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Edit/Android.bp b/lib/Edit/Android.bp
new file mode 100644
index 0000000000..ec7e358c6c
--- /dev/null
+++ b/lib/Edit/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangEdit",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Edit/Android.mk b/lib/Edit/Android.mk
deleted file mode 100644
index ff6ecdc853..0000000000
--- a/lib/Edit/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-clang_edit_SRC_FILES := \
- Commit.cpp \
- EditedSource.cpp \
- RewriteObjCFoundationAPI.cpp
-
-TBLGEN_TABLES := \
- Attrs.inc \
- AttrList.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_edit_SRC_FILES)
-LOCAL_MODULE:= libclangEdit
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_edit_SRC_FILES)
-LOCAL_MODULE:= libclangEdit
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Format/Android.bp b/lib/Format/Android.bp
new file mode 100644
index 0000000000..c61e5bb22a
--- /dev/null
+++ b/lib/Format/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangFormat",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Format/Android.mk b/lib/Format/Android.mk
deleted file mode 100644
index 99592abddb..0000000000
--- a/lib/Format/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrHasAttributeImpl.inc \
- DiagnosticASTKinds.inc \
- DiagnosticAnalysisKinds.inc \
- DiagnosticCommentKinds.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticGroups.inc \
- DiagnosticIndexName.inc \
- DiagnosticLexKinds.inc \
- DiagnosticParseKinds.inc \
- DiagnosticSemaKinds.inc \
- DiagnosticSerializationKinds.inc \
- arm_neon.inc
-
-clang_format_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_format_SRC_FILES)
-LOCAL_MODULE:= libclangFormat
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_format_SRC_FILES)
-LOCAL_MODULE:= libclangFormat
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Frontend/Android.bp b/lib/Frontend/Android.bp
new file mode 100644
index 0000000000..ab539cfdf8
--- /dev/null
+++ b/lib/Frontend/Android.bp
@@ -0,0 +1,7 @@
+cc_library_static {
+ name: "libclangFrontend",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
+
+subdirs = ["Rewrite"]
diff --git a/lib/Frontend/Android.mk b/lib/Frontend/Android.mk
deleted file mode 100644
index aae042d9d0..0000000000
--- a/lib/Frontend/Android.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrParsedAttrList.inc \
- AttrVisitor.inc \
- CC1Options.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DiagnosticASTKinds.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticLexKinds.inc \
- DiagnosticSemaKinds.inc \
- DeclNodes.inc \
- Options.inc \
- StmtNodes.inc
-
-clang_frontend_SRC_FILES := \
- ASTConsumers.cpp \
- ASTMerge.cpp \
- ASTUnit.cpp \
- CacheTokens.cpp \
- ChainedDiagnosticConsumer.cpp \
- ChainedIncludesSource.cpp \
- CodeGenOptions.cpp \
- CompilerInstance.cpp \
- CompilerInvocation.cpp \
- CreateInvocationFromCommandLine.cpp \
- DependencyFile.cpp \
- DependencyGraph.cpp \
- DiagnosticRenderer.cpp \
- FrontendAction.cpp \
- FrontendActions.cpp \
- FrontendOptions.cpp \
- HeaderIncludeGen.cpp \
- InitHeaderSearch.cpp \
- InitPreprocessor.cpp \
- LangStandards.cpp \
- LayoutOverrideSource.cpp \
- LogDiagnosticPrinter.cpp \
- ModuleDependencyCollector.cpp \
- MultiplexConsumer.cpp \
- PCHContainerOperations.cpp \
- PrintPreprocessedOutput.cpp \
- SerializedDiagnosticPrinter.cpp \
- SerializedDiagnosticReader.cpp \
- TestModuleFileExtension.cpp \
- TextDiagnosticBuffer.cpp \
- TextDiagnostic.cpp \
- TextDiagnosticPrinter.cpp \
- VerifyDiagnosticConsumer.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_frontend_SRC_FILES)
-LOCAL_MODULE:= libclangFrontend
-LOCAL_MODULE_TAGS:= optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_frontend_SRC_FILES)
-LOCAL_MODULE:= libclangFrontend
-LOCAL_MODULE_TAGS:= optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Frontend/Rewrite/Android.bp b/lib/Frontend/Rewrite/Android.bp
new file mode 100644
index 0000000000..6508a125bb
--- /dev/null
+++ b/lib/Frontend/Rewrite/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangRewriteFrontend",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Frontend/Rewrite/Android.mk b/lib/Frontend/Rewrite/Android.mk
deleted file mode 100644
index f23e7467d0..0000000000
--- a/lib/Frontend/Rewrite/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrParsedAttrList.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- StmtNodes.inc
-
-clang_rewrite_frontend_SRC_FILES := \
- FixItRewriter.cpp \
- FrontendActions.cpp \
- HTMLPrint.cpp \
- InclusionRewriter.cpp \
- RewriteMacros.cpp \
- RewriteModernObjC.cpp \
- RewriteObjC.cpp \
- RewriteTest.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_rewrite_frontend_SRC_FILES)
-LOCAL_MODULE:= libclangRewriteFrontend
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_rewrite_frontend_SRC_FILES)
-LOCAL_MODULE:= libclangRewriteFrontend
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/FrontendTool/Android.bp b/lib/FrontendTool/Android.bp
new file mode 100644
index 0000000000..4d63425864
--- /dev/null
+++ b/lib/FrontendTool/Android.bp
@@ -0,0 +1,10 @@
+cc_library_host_static {
+ name: "libclangFrontendTool",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+
+ cflags: [
+ "-DCLANG_ENABLE_STATIC_ANALYZER",
+ "-DCLANG_ENABLE_REWRITER",
+ ],
+}
diff --git a/lib/FrontendTool/Android.mk b/lib/FrontendTool/Android.mk
deleted file mode 100644
index 37830dbfc0..0000000000
--- a/lib/FrontendTool/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-LOCAL_MODULE:= libclangFrontendTool
-
-LOCAL_MODULE_TAGS := optional
-
-TBLGEN_TABLES := \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- CC1Options.inc \
- CommentCommandList.inc \
- Options.inc \
- StmtNodes.inc
-
-clang_frontend_tool_SRC_FILES := \
- ExecuteCompilerInvocation.cpp
-
-LOCAL_CFLAGS += -DCLANG_ENABLE_STATIC_ANALYZER
-LOCAL_CFLAGS += -DCLANG_ENABLE_REWRITER
-
-LOCAL_SRC_FILES := $(clang_frontend_tool_SRC_FILES)
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Index/Android.bp b/lib/Index/Android.bp
new file mode 100644
index 0000000000..b1e93064bd
--- /dev/null
+++ b/lib/Index/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangIndex",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Index/Android.mk b/lib/Index/Android.mk
deleted file mode 100644
index 9f63a132d0..0000000000
--- a/lib/Index/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc
-
-clang_index_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_index_SRC_FILES)
-LOCAL_MODULE:= libclangIndex
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_index_SRC_FILES)
-LOCAL_MODULE:= libclangIndex
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Lex/Android.bp b/lib/Lex/Android.bp
new file mode 100644
index 0000000000..c8a8bd87c5
--- /dev/null
+++ b/lib/Lex/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangLex",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Lex/Android.mk b/lib/Lex/Android.mk
deleted file mode 100644
index 239998d011..0000000000
--- a/lib/Lex/Android.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- DiagnosticLexKinds.inc \
- DiagnosticCommonKinds.inc
-
-clang_lex_SRC_FILES := \
- HeaderMap.cpp \
- HeaderSearch.cpp \
- Lexer.cpp \
- LiteralSupport.cpp \
- MacroArgs.cpp \
- MacroInfo.cpp \
- ModuleMap.cpp \
- PPCaching.cpp \
- PPCallbacks.cpp \
- PPConditionalDirectiveRecord.cpp \
- PPDirectives.cpp \
- PPExpressions.cpp \
- PPLexerChange.cpp \
- PPMacroExpansion.cpp \
- PTHLexer.cpp \
- Pragma.cpp \
- PreprocessingRecord.cpp \
- Preprocessor.cpp \
- PreprocessorLexer.cpp \
- ScratchBuffer.cpp \
- TokenConcatenation.cpp \
- TokenLexer.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_lex_SRC_FILES)
-LOCAL_MODULE:= libclangLex
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_lex_SRC_FILES)
-LOCAL_MODULE:= libclangLex
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Parse/Android.bp b/lib/Parse/Android.bp
new file mode 100644
index 0000000000..4bc2b7cfee
--- /dev/null
+++ b/lib/Parse/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangParse",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Parse/Android.mk b/lib/Parse/Android.mk
deleted file mode 100644
index cb248c47ca..0000000000
--- a/lib/Parse/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- AttrParsedAttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- AttrParserStringSwitches.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticParseKinds.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticSemaKinds.inc \
- StmtNodes.inc
-
-clang_parse_SRC_FILES := \
- ParseAST.cpp \
- ParseCXXInlineMethods.cpp \
- ParseDecl.cpp \
- ParseDeclCXX.cpp \
- ParseExpr.cpp \
- ParseExprCXX.cpp \
- ParseInit.cpp \
- ParseObjc.cpp \
- ParseOpenMP.cpp \
- ParsePragma.cpp \
- ParseStmt.cpp \
- ParseStmtAsm.cpp \
- ParseTemplate.cpp \
- ParseTentative.cpp \
- Parser.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_parse_SRC_FILES)
-LOCAL_MODULE:= libclangParse
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_parse_SRC_FILES)
-LOCAL_MODULE:= libclangParse
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Rewrite/Android.bp b/lib/Rewrite/Android.bp
new file mode 100644
index 0000000000..ea657e2f54
--- /dev/null
+++ b/lib/Rewrite/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangRewrite",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Rewrite/Android.mk b/lib/Rewrite/Android.mk
deleted file mode 100644
index 817f31b603..0000000000
--- a/lib/Rewrite/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrParsedAttrList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- StmtNodes.inc
-
-clang_rewrite_SRC_FILES := \
- DeltaTree.cpp \
- HTMLRewrite.cpp \
- RewriteRope.cpp \
- Rewriter.cpp \
- TokenRewriter.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_rewrite_SRC_FILES)
-LOCAL_MODULE:= libclangRewrite
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_rewrite_SRC_FILES)
-LOCAL_MODULE:= libclangRewrite
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Sema/Android.bp b/lib/Sema/Android.bp
new file mode 100644
index 0000000000..02c0dda209
--- /dev/null
+++ b/lib/Sema/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangSema",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Sema/Android.mk b/lib/Sema/Android.mk
deleted file mode 100644
index 015d1af89f..0000000000
--- a/lib/Sema/Android.mk
+++ /dev/null
@@ -1,96 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrParsedAttrKinds.inc \
- AttrParsedAttrImpl.inc \
- AttrParsedAttrList.inc \
- AttrSpellingListIndex.inc \
- AttrTemplateInstantiate.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticASTKinds.inc \
- DiagnosticSemaKinds.inc \
- DiagnosticParseKinds.inc \
- DiagnosticCommentKinds.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc \
- arm_neon.inc
-
-clang_sema_SRC_FILES := \
- AnalysisBasedWarnings.cpp \
- AttributeList.cpp \
- CodeCompleteConsumer.cpp \
- DeclSpec.cpp \
- DelayedDiagnostic.cpp \
- IdentifierResolver.cpp \
- JumpDiagnostics.cpp \
- MultiplexExternalSemaSource.cpp \
- Scope.cpp \
- ScopeInfo.cpp \
- SemaAccess.cpp \
- SemaAttr.cpp \
- SemaCast.cpp \
- SemaChecking.cpp \
- SemaCodeComplete.cpp \
- SemaConsumer.cpp \
- Sema.cpp \
- SemaCoroutine.cpp \
- SemaCUDA.cpp \
- SemaCXXScopeSpec.cpp \
- SemaDeclAttr.cpp \
- SemaDecl.cpp \
- SemaDeclCXX.cpp \
- SemaDeclObjC.cpp \
- SemaExceptionSpec.cpp \
- SemaExpr.cpp \
- SemaExprCXX.cpp \
- SemaExprMember.cpp \
- SemaExprObjC.cpp \
- SemaFixItUtils.cpp \
- SemaInit.cpp \
- SemaLambda.cpp \
- SemaLookup.cpp \
- SemaObjCProperty.cpp \
- SemaOpenMP.cpp \
- SemaOverload.cpp \
- SemaPseudoObject.cpp \
- SemaStmtAsm.cpp \
- SemaStmtAttr.cpp \
- SemaStmt.cpp \
- SemaTemplate.cpp \
- SemaTemplateDeduction.cpp \
- SemaTemplateInstantiate.cpp \
- SemaTemplateInstantiateDecl.cpp \
- SemaTemplateVariadic.cpp \
- SemaType.cpp \
- TypeLocBuilder.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_sema_SRC_FILES)
-LOCAL_MODULE:= libclangSema
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_sema_SRC_FILES)
-LOCAL_MODULE:= libclangSema
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Serialization/Android.bp b/lib/Serialization/Android.bp
new file mode 100644
index 0000000000..5f3762faa8
--- /dev/null
+++ b/lib/Serialization/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangSerialization",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Serialization/Android.mk b/lib/Serialization/Android.mk
deleted file mode 100644
index fb3a919821..0000000000
--- a/lib/Serialization/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- AttrParsedAttrList.inc \
- AttrPCHRead.inc \
- AttrPCHWrite.inc \
- Attrs.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticSemaKinds.inc \
- DiagnosticSerializationKinds.inc \
- StmtNodes.inc
-
-clang_serialization_SRC_FILES :=\
- ASTCommon.cpp \
- ASTReader.cpp \
- ASTReaderDecl.cpp \
- ASTReaderStmt.cpp \
- ASTWriter.cpp \
- ASTWriterDecl.cpp \
- ASTWriterStmt.cpp \
- GeneratePCH.cpp \
- GlobalModuleIndex.cpp \
- Module.cpp \
- ModuleFileExtension.cpp \
- ModuleManager.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_serialization_SRC_FILES)
-LOCAL_MODULE:= libclangSerialization
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_serialization_SRC_FILES)
-LOCAL_MODULE:= libclangSerialization
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Android.bp b/lib/StaticAnalyzer/Android.bp
new file mode 100644
index 0000000000..b44c296012
--- /dev/null
+++ b/lib/StaticAnalyzer/Android.bp
@@ -0,0 +1 @@
+subdirs = ["*"]
diff --git a/lib/StaticAnalyzer/Checkers/Android.bp b/lib/StaticAnalyzer/Checkers/Android.bp
new file mode 100644
index 0000000000..42136154b9
--- /dev/null
+++ b/lib/StaticAnalyzer/Checkers/Android.bp
@@ -0,0 +1,9 @@
+cc_library_host_static {
+ name: "libclangStaticAnalyzerCheckers",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+
+ export_include_dirs: ["."],
+}
+
+subdirs = ["MPI-Checker"]
diff --git a/lib/StaticAnalyzer/Checkers/Android.mk b/lib/StaticAnalyzer/Checkers/Android.mk
deleted file mode 100644
index 1204c586a8..0000000000
--- a/lib/StaticAnalyzer/Checkers/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-clang_static_analyzer_checkers_TBLGEN_TABLES := \
- AttrKinds.inc \
- AttrList.inc \
- AttrParsedAttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- Checkers.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc
-
-clang_static_analyzer_checkers_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := $(clang_static_analyzer_checkers_TBLGEN_TABLES)
-
-LOCAL_SRC_FILES := $(clang_static_analyzer_checkers_SRC_FILES)
-
-LOCAL_MODULE:= libclangStaticAnalyzerCheckers
-
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.bp b/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.bp
new file mode 100644
index 0000000000..1e0a78def2
--- /dev/null
+++ b/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangStaticAnalyzerMPIChecker",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.mk b/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.mk
deleted file mode 100644
index 6025f98a04..0000000000
--- a/lib/StaticAnalyzer/Checkers/MPI-Checker/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- Checkers.inc \
- CommentCommandList.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- StmtNodes.inc
-
-mpichecker_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(mpichecker_SRC_FILES)
-LOCAL_MODULE:= libclangStaticAnalyzerMPIChecker
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(mpichecker_SRC_FILES)
-LOCAL_MODULE:= libclangStaticAnalyzerMPIChecker
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Core/Android.bp b/lib/StaticAnalyzer/Core/Android.bp
new file mode 100644
index 0000000000..80f391202a
--- /dev/null
+++ b/lib/StaticAnalyzer/Core/Android.bp
@@ -0,0 +1,7 @@
+cc_library_host_static {
+ name: "libclangStaticAnalyzerCore",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+
+ export_include_dirs: ["."],
+}
diff --git a/lib/StaticAnalyzer/Core/Android.mk b/lib/StaticAnalyzer/Core/Android.mk
deleted file mode 100644
index 070337acb8..0000000000
--- a/lib/StaticAnalyzer/Core/Android.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-clang_static_analyzer_core_TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- StmtNodes.inc
-
-clang_static_analyzer_core_SRC_FILES := \
- AnalysisManager.cpp \
- AnalyzerOptions.cpp \
- APSIntType.cpp \
- BasicValueFactory.cpp \
- BlockCounter.cpp \
- BugReporter.cpp \
- BugReporterVisitors.cpp \
- CallEvent.cpp \
- CheckerContext.cpp \
- Checker.cpp \
- CheckerHelpers.cpp \
- CheckerManager.cpp \
- CheckerRegistry.cpp \
- CommonBugCategories.cpp \
- ConstraintManager.cpp \
- CoreEngine.cpp \
- DynamicTypeMap.cpp \
- Environment.cpp \
- ExplodedGraph.cpp \
- ExprEngineCallAndReturn.cpp \
- ExprEngineC.cpp \
- ExprEngine.cpp \
- ExprEngineCXX.cpp \
- ExprEngineObjC.cpp \
- FunctionSummary.cpp \
- HTMLDiagnostics.cpp \
- IssueHash.cpp \
- LoopWidening.cpp \
- MemRegion.cpp \
- PathDiagnostic.cpp \
- PlistDiagnostics.cpp \
- ProgramState.cpp \
- RangeConstraintManager.cpp \
- RegionStore.cpp \
- SimpleConstraintManager.cpp \
- SimpleSValBuilder.cpp \
- Store.cpp \
- SubEngine.cpp \
- SValBuilder.cpp \
- SVals.cpp \
- SymbolManager.cpp
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := $(clang_static_analyzer_core_TBLGEN_TABLES)
-
-LOCAL_SRC_FILES := $(clang_static_analyzer_core_SRC_FILES)
-
-LOCAL_MODULE:= libclangStaticAnalyzerCore
-
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Frontend/Android.bp b/lib/StaticAnalyzer/Frontend/Android.bp
new file mode 100644
index 0000000000..975d3a4f92
--- /dev/null
+++ b/lib/StaticAnalyzer/Frontend/Android.bp
@@ -0,0 +1,7 @@
+cc_library_host_static {
+ name: "libclangStaticAnalyzerFrontend",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+
+ static_libs: ["libclangStaticAnalyzerCheckers"],
+}
diff --git a/lib/StaticAnalyzer/Frontend/Android.mk b/lib/StaticAnalyzer/Frontend/Android.mk
deleted file mode 100644
index 79947ec5c2..0000000000
--- a/lib/StaticAnalyzer/Frontend/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-clang_static_analyzer_frontend_C_INCLUDES := \
- $(CLANG_ROOT_PATH)/lib/StaticAnalyzer/Checkers
-
-clang_static_analyzer_frontend_TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- AttrParsedAttrList.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- StmtNodes.inc
-
-clang_static_analyzer_frontend_SRC_FILES := \
- AnalysisConsumer.cpp \
- CheckerRegistration.cpp \
- FrontendActions.cpp \
- ModelConsumer.cpp \
- ModelInjector.cpp
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := $(clang_static_analyzer_frontend_TBLGEN_TABLES)
-
-LOCAL_SRC_FILES := $(clang_static_analyzer_frontend_SRC_FILES)
-
-LOCAL_C_INCLUDES := $(clang_static_analyzer_frontend_C_INCLUDES)
-
-LOCAL_MODULE:= libclangStaticAnalyzerFrontend
-
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Tooling/Android.bp b/lib/Tooling/Android.bp
new file mode 100644
index 0000000000..118eece702
--- /dev/null
+++ b/lib/Tooling/Android.bp
@@ -0,0 +1,7 @@
+cc_library_static {
+ name: "libclangTooling",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
+
+subdirs = ["Core"]
diff --git a/lib/Tooling/Android.mk b/lib/Tooling/Android.mk
deleted file mode 100644
index 5c388dd104..0000000000
--- a/lib/Tooling/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- Attrs.inc \
- CommentCommandList.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- StmtNodes.inc \
-
-clang_tooling_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_tooling_SRC_FILES)
-LOCAL_MODULE:= libclangTooling
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_tooling_SRC_FILES)
-LOCAL_MODULE:= libclangTooling
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Tooling/Core/Android.bp b/lib/Tooling/Core/Android.bp
new file mode 100644
index 0000000000..517b9bbc99
--- /dev/null
+++ b/lib/Tooling/Core/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangToolingCore",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/lib/Tooling/Core/Android.mk b/lib/Tooling/Core/Android.mk
deleted file mode 100644
index 2dbf91c817..0000000000
--- a/lib/Tooling/Core/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
-
-clang_tooling_core_SRC_FILES := \
- Lookup.cpp \
- Replacement.cpp \
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_tooling_core_SRC_FILES)
-LOCAL_MODULE:= libclangToolingCore
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_tooling_core_SRC_FILES)
-LOCAL_MODULE:= libclangToolingCore
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/shared_clang.mk b/shared_clang.mk
deleted file mode 100644
index b6fea102ca..0000000000
--- a/shared_clang.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-# Don't build the library in unbundled branches.
-ifeq (,$(TARGET_BUILD_APPS))
-
-LOCAL_PATH:= $(call my-dir)
-
-clang_whole_static_libraries := \
- libclangAnalysis \
- libclangAST \
- libclangASTMatchers \
- libclangBasic \
- libclangCodeGen \
- libclangDriver \
- libclangEdit \
- libclangFormat \
- libclangFrontend \
- libclangIndex \
- libclangLex \
- libclangLibclang \
- libclangParse \
- libclangRewrite \
- libclangRewriteFrontend \
- libclangSema \
- libclangSerialization \
- libclangTooling \
- libclangToolingCore
-
-# host
-include $(CLEAR_VARS)
-
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE:= libclang
-LOCAL_MODULE_TAGS := optional
-LOCAL_WHOLE_STATIC_LIBRARIES := $(clang_whole_static_libraries)
-LOCAL_EXPORT_C_INCLUDE_DIRS += \
- $(LOCAL_PATH)/include \
- external/llvm/include \
- external/llvm/device/include
-
-LOCAL_SHARED_LIBRARIES := libLLVM
-
-LOCAL_LDLIBS_windows := -limagehlp -lpsapi -lversion
-
-LOCAL_SHARED_LIBRARIES_darwin := libc++
-LOCAL_SHARED_LIBRARIES_linux := libc++
-LOCAL_LDLIBS_darwin := -ldl -lpthread
-LOCAL_LDLIBS_linux := -ldl -lpthread
-
-include $(CLANG_HOST_BUILD_MK)
-
-# Don't build the library unless forced to. We don't
-# have prebuilts for windows.
-ifneq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-LOCAL_MODULE_HOST_OS := windows
-else
-LOCAL_MODULE_HOST_OS := darwin linux windows
-endif
-
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-# Don't build the library unless forced to.
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-# 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 unless forced to
-
-endif # don't build in unbundled branches
diff --git a/soong/Android.bp b/soong/Android.bp
new file mode 100644
index 0000000000..5af41d7f08
--- /dev/null
+++ b/soong/Android.bp
@@ -0,0 +1,15 @@
+bootstrap_go_package {
+ name: "soong-clang",
+ pkgPath: "android/soong/external/clang",
+ deps: [
+ "blueprint",
+ "soong-android",
+ "soong-cc",
+ "soong-genrule",
+ ],
+ srcs: [
+ "clang.go",
+ "tblgen.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/soong/clang.go b/soong/clang.go
new file mode 100644
index 0000000000..f57086645d
--- /dev/null
+++ b/soong/clang.go
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package clang
+
+import (
+ "android/soong/android"
+ "android/soong/cc"
+
+ "github.com/google/blueprint"
+)
+
+// Clang binaries (clang, clang-check, clang-format) need to be compiled for both 32-bit and 64-bit,
+// but only when FORCE_BUILD_LLVM_COMPONENTS is set
+
+func init() {
+ android.RegisterModuleType("clang_binary_host", clangBinaryHostFactory)
+}
+
+func clangForceBuildLlvmComponents(ctx android.LoadHookContext) {
+ if ctx.AConfig().IsEnvTrue("FORCE_BUILD_LLVM_COMPONENTS") {
+ type props struct {
+ Target struct {
+ Host struct {
+ Compile_multilib string
+ }
+ }
+ Multilib struct {
+ Lib32 struct {
+ Suffix string
+ }
+ }
+ }
+ p := &props{}
+ p.Target.Host.Compile_multilib = "both"
+ p.Multilib.Lib32.Suffix = "_32"
+ ctx.AppendProperties(p)
+ }
+}
+
+func clangBinaryHostFactory() (blueprint.Module, []interface{}) {
+ module, _ := cc.NewBinary(android.HostSupported)
+ android.AddLoadHook(module, clangForceBuildLlvmComponents)
+
+ return module.Init()
+}
diff --git a/soong/tblgen.go b/soong/tblgen.go
new file mode 100644
index 0000000000..4ebe70d944
--- /dev/null
+++ b/soong/tblgen.go
@@ -0,0 +1,172 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package clang
+
+import (
+ "path/filepath"
+ "strings"
+
+ "android/soong/android"
+ "android/soong/genrule"
+
+ "github.com/google/blueprint"
+)
+
+func init() {
+ android.RegisterModuleType("clang_tblgen", clangTblgenFactory)
+}
+
+var (
+ pctx = android.NewPackageContext("android/soong/clang")
+
+ clangTblgen = pctx.HostBinToolVariable("clangTblgen", "clang-tblgen")
+
+ tblgenRule = pctx.StaticRule("tblgenRule", blueprint.RuleParams{
+ Depfile: "${out}.d",
+ Deps: blueprint.DepsGCC,
+ Command: "${clangTblgen} ${includes} ${generator} -d ${depfile} -o ${out} ${in}",
+ CommandDeps: []string{"${clangTblgen}"},
+ Description: "Clang TableGen $in => $out",
+ }, "includes", "depfile", "generator")
+)
+
+type tblgenProperties struct {
+ In string
+ Outs []string
+}
+
+type tblgen struct {
+ android.ModuleBase
+
+ properties tblgenProperties
+
+ exportedHeaderDirs android.Paths
+ generatedHeaders android.Paths
+}
+
+var _ genrule.SourceFileGenerator = (*tblgen)(nil)
+
+func (t *tblgen) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ in := android.PathForModuleSrc(ctx, t.properties.In)
+
+ includes := []string{
+ "-I " + ctx.ModuleDir(),
+ "-I external/llvm/include",
+ "-I external/llvm/lib/Target",
+ "-I external/clang/include",
+ "-I " + filepath.Dir(in.String()),
+ }
+
+ for _, o := range t.properties.Outs {
+ out := android.PathForModuleGen(ctx, o)
+ generator := outToGenerator(ctx, o)
+
+ ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+ Rule: tblgenRule,
+ Input: in,
+ Output: out,
+ Args: map[string]string{
+ "includes": strings.Join(includes, " "),
+ "generator": generator,
+ },
+ })
+ t.generatedHeaders = append(t.generatedHeaders, out)
+ }
+
+ t.exportedHeaderDirs = append(t.exportedHeaderDirs, android.PathForModuleGen(ctx, ""))
+}
+
+func outToGenerator(ctx android.ModuleContext, out string) string {
+ out = filepath.Base(out)
+ switch {
+ case out == "AttrDump.inc":
+ return "-gen-clang-attr-dump"
+ case out == "AttrImpl.inc":
+ return "-gen-clang-attr-impl"
+ case out == "AttrHasAttributeImpl.inc":
+ return "-gen-clang-attr-has-attribute-impl"
+ case out == "AttrList.inc":
+ return "-gen-clang-attr-list"
+ case out == "AttrSpellingListIndex.inc":
+ return "-gen-clang-attr-spelling-index"
+ case out == "AttrPCHRead.inc":
+ return "-gen-clang-attr-pch-read"
+ case out == "AttrPCHWrite.inc":
+ return "-gen-clang-attr-pch-write"
+ case out == "Attrs.inc":
+ return "-gen-clang-attr-classes"
+ case out == "AttrParserStringSwitches.inc":
+ return "-gen-clang-attr-parser-string-switches"
+ case out == "AttrVisitor.inc":
+ return "-gen-clang-attr-ast-visitor"
+ case out == "AttrParsedAttrKinds.inc":
+ return "-gen-clang-attr-parsed-attr-kinds"
+ case out == "AttrParsedAttrImpl.inc":
+ return "-gen-clang-attr-parsed-attr-impl"
+ case out == "AttrParsedAttrList.inc":
+ return "-gen-clang-attr-parsed-attr-list"
+ case out == "AttrTemplateInstantiate.inc":
+ return "-gen-clang-attr-template-instantiate"
+ case out == "Checkers.inc":
+ return "-gen-clang-sa-checkers"
+ case out == "CommentCommandInfo.inc":
+ return "-gen-clang-comment-command-info"
+ case out == "CommentCommandList.inc":
+ return "-gen-clang-comment-command-list"
+ case out == "CommentHTMLNamedCharacterReferences.inc":
+ return "-gen-clang-comment-html-named-character-references"
+ case out == "CommentHTMLTagsProperties.inc":
+ return "-gen-clang-comment-html-tags-properties"
+ case out == "CommentHTMLTags.inc":
+ return "-gen-clang-comment-html-tags"
+ case out == "CommentNodes.inc":
+ return "-gen-clang-comment-nodes"
+ case strings.HasPrefix(out, "Diagnostic") && strings.HasSuffix(out, "Kinds.inc"):
+ component := strings.TrimPrefix(strings.TrimSuffix(out, "Kinds.inc"), "Diagnostic")
+ return "-gen-clang-diags-defs -clang-component=" + component
+ case out == "DiagnosticGroups.inc":
+ return "-gen-clang-diag-groups"
+ case out == "DiagnosticIndexName.inc":
+ return "-gen-clang-diag-groups"
+ case out == "DeclNodes.inc":
+ return "-gen-clang-decl-nodes"
+ case out == "StmtNodes.inc":
+ return "-gen-clang-stmt-nodes"
+ case out == "arm_neon.inc":
+ return "-gen-arm-neon-sema"
+ case out == "arm_neon.h":
+ return "-gen-arm-neon"
+ }
+
+ ctx.ModuleErrorf("couldn't map output file %q to a generator", out)
+ return ""
+}
+
+func (t *tblgen) DepsMutator(ctx android.BottomUpMutatorContext) {
+}
+
+func (t *tblgen) GeneratedHeaderDirs() android.Paths {
+ return t.exportedHeaderDirs
+}
+
+func (t *tblgen) GeneratedSourceFiles() android.Paths {
+ return t.generatedHeaders
+}
+
+func clangTblgenFactory() (blueprint.Module, []interface{}) {
+ t := &tblgen{}
+
+ return android.InitAndroidModule(t, &t.properties)
+}
diff --git a/tools/clang-check/Android.bp b/tools/clang-check/Android.bp
new file mode 100644
index 0000000000..f23c21ffe1
--- /dev/null
+++ b/tools/clang-check/Android.bp
@@ -0,0 +1,109 @@
+// For the host only
+// =====================================================
+clang_binary_host {
+ name: "clang-check",
+ defaults: ["clang-defaults"],
+ srcs: ["ClangCheck.cpp"],
+
+ group_static_libs: true,
+ static_libs: [
+ "libclangFormat",
+ "libclangFrontendTool",
+ "libclangFrontend",
+ "libclangARCMigrate",
+ "libclangDriver",
+ "libclangSerialization",
+ "libclangCodeGen",
+ "libclangRewriteFrontend",
+ "libclangRewrite",
+ "libclangTooling",
+ "libclangParse",
+ "libclangSema",
+ "libclangStaticAnalyzerFrontend",
+ "libclangStaticAnalyzerCheckers",
+ "libclangStaticAnalyzerMPIChecker",
+ "libclangStaticAnalyzerCore",
+ "libclangAnalysis",
+ "libclangEdit",
+ "libclangAST",
+ "libclangLex",
+ "libclangBasic",
+ "libLLVMARMAsmParser",
+ "libLLVMARMCodeGen",
+ "libLLVMARMAsmPrinter",
+ "libLLVMARMDisassembler",
+ "libLLVMARMDesc",
+ "libLLVMARMInfo",
+ "libLLVMMipsAsmParser",
+ "libLLVMMipsCodeGen",
+ "libLLVMMipsDisassembler",
+ "libLLVMMipsAsmPrinter",
+ "libLLVMMipsDesc",
+ "libLLVMMipsInfo",
+ "libLLVMX86Info",
+ "libLLVMX86AsmParser",
+ "libLLVMX86CodeGen",
+ "libLLVMX86Disassembler",
+ "libLLVMX86Desc",
+ "libLLVMX86AsmPrinter",
+ "libLLVMX86Utils",
+ "libLLVMAArch64Info",
+ "libLLVMAArch64AsmParser",
+ "libLLVMAArch64CodeGen",
+ "libLLVMAArch64Disassembler",
+ "libLLVMAArch64Desc",
+ "libLLVMAArch64AsmPrinter",
+ "libLLVMAArch64Utils",
+ "libLLVMIRReader",
+ "libLLVMGlobalISel",
+ "libLLVMDebugInfoCodeView",
+ "libLLVMAsmParser",
+ "libLLVMAsmPrinter",
+ "libLLVMBitReader",
+ "libLLVMBitWriter",
+ "libLLVMSelectionDAG",
+ "libLLVMipo",
+ "libLLVMInstCombine",
+ "libLLVMInstrumentation",
+ "libLLVMCodeGen",
+ "libLLVMObject",
+ "libLLVMLinker",
+ "libLLVMMC",
+ "libLLVMMCParser",
+ "libLLVMScalarOpts",
+ "libLLVMTransformObjCARC",
+ "libLLVMTransformUtils",
+ "libLLVMVectorize",
+ "libLLVMAnalysis",
+ "libLLVMCore",
+ "libLLVMOption",
+ "libLLVMTarget",
+ "libLLVMProfileData",
+ "libLLVMObject",
+ "libLLVMMCDisassembler",
+ "libLLVMSupport",
+ ],
+
+ target: {
+ windows: {
+ host_ldlibs: [
+ "-limagehlp",
+ "-lversion",
+ ],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ linux: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ },
+}
diff --git a/tools/clang-check/Android.mk b/tools/clang-check/Android.mk
deleted file mode 100644
index a32c380e11..0000000000
--- a/tools/clang-check/Android.mk
+++ /dev/null
@@ -1,128 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-LOCAL_MODULE := clang-check
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-TBLGEN_TABLES := \
- CommentCommandList.inc \
- DeclNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- CC1Options.inc \
- CC1AsOptions.inc \
- Options.inc \
- StmtNodes.inc
-
-clang_check_SRC_FILES := \
- ClangCheck.cpp
-
-LOCAL_SRC_FILES := $(clang_check_SRC_FILES)
-
-clang_check_STATIC_LIBRARIES := \
- libclangFormat \
- libclangFrontendTool \
- libclangFrontend \
- libclangARCMigrate \
- libclangDriver \
- libclangSerialization \
- libclangCodeGen \
- libclangRewriteFrontend \
- libclangRewrite \
- libclangTooling \
- libclangParse \
- libclangSema \
- libclangStaticAnalyzerFrontend \
- libclangStaticAnalyzerCheckers \
- libclangStaticAnalyzerMPIChecker \
- libclangStaticAnalyzerCore \
- libclangAnalysis \
- libclangEdit \
- libclangAST \
- libclangLex \
- libclangBasic \
- libLLVMARMAsmParser \
- libLLVMARMCodeGen \
- libLLVMARMAsmPrinter \
- libLLVMARMDisassembler \
- libLLVMARMDesc \
- libLLVMARMInfo \
- libLLVMMipsAsmParser \
- libLLVMMipsCodeGen \
- libLLVMMipsDisassembler \
- libLLVMMipsAsmPrinter \
- libLLVMMipsDesc \
- libLLVMMipsInfo \
- libLLVMX86Info \
- libLLVMX86AsmParser \
- libLLVMX86CodeGen \
- libLLVMX86Disassembler \
- libLLVMX86Desc \
- libLLVMX86AsmPrinter \
- libLLVMX86Utils \
- libLLVMAArch64Info \
- libLLVMAArch64AsmParser \
- libLLVMAArch64CodeGen \
- libLLVMAArch64Disassembler \
- libLLVMAArch64Desc \
- libLLVMAArch64AsmPrinter \
- libLLVMAArch64Utils \
- libLLVMIRReader \
- libLLVMGlobalISel \
- libLLVMDebugInfoCodeView \
- libLLVMAsmParser \
- libLLVMAsmPrinter \
- libLLVMBitReader \
- libLLVMBitWriter \
- libLLVMSelectionDAG \
- libLLVMipo \
- libLLVMInstCombine \
- libLLVMInstrumentation \
- libLLVMCodeGen \
- libLLVMObject \
- libLLVMLinker \
- libLLVMMC \
- libLLVMMCParser \
- libLLVMScalarOpts \
- libLLVMTransformObjCARC \
- libLLVMTransformUtils \
- libLLVMVectorize \
- libLLVMAnalysis \
- libLLVMCore \
- libLLVMOption \
- libLLVMTarget \
- libLLVMProfileData \
- libLLVMObject \
- libLLVMMCDisassembler \
- libLLVMSupport
-
-LOCAL_STATIC_LIBRARIES := $(clang_check_STATIC_LIBRARIES) $(clang_check_STATIC_LIBRARIES)
-
-LOCAL_LDLIBS += -lm
-LOCAL_LDLIBS_windows := -limagehlp -lversion
-LOCAL_LDLIBS_darwin := -lpthread -ldl
-LOCAL_LDLIBS_linux := -lpthread -ldl
-
-# remove when we can use PIE binaries in all places again
-LOCAL_NO_FPIE := true
-
-include $(CLANG_HOST_BUILD_MK)
-#include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-
-# Don't build both versions by default (to speed up local builds).
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)_32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)
-endif
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/clang-format/Android.bp b/tools/clang-format/Android.bp
new file mode 100644
index 0000000000..b618e140f4
--- /dev/null
+++ b/tools/clang-format/Android.bp
@@ -0,0 +1,106 @@
+// For the host only
+// =====================================================
+clang_binary_host {
+ name: "clang-format",
+ defaults: ["clang-defaults"],
+ srcs: ["ClangFormat.cpp"],
+
+ static_libs: [
+ "libclangFormat",
+ "libclangFrontendTool",
+ "libclangFrontend",
+ "libclangARCMigrate",
+ "libclangDriver",
+ "libclangSerialization",
+ "libclangCodeGen",
+ "libclangRewriteFrontend",
+ "libclangRewrite",
+ "libclangToolingCore",
+ "libclangParse",
+ "libclangSema",
+ "libclangStaticAnalyzerFrontend",
+ "libclangStaticAnalyzerCheckers",
+ "libclangStaticAnalyzerMPIChecker",
+ "libclangStaticAnalyzerCore",
+ "libclangAnalysis",
+ "libclangEdit",
+ "libclangAST",
+ "libclangLex",
+ "libclangBasic",
+ "libLLVMARMAsmParser",
+ "libLLVMARMCodeGen",
+ "libLLVMARMAsmPrinter",
+ "libLLVMARMDisassembler",
+ "libLLVMARMDesc",
+ "libLLVMARMInfo",
+ "libLLVMMipsAsmParser",
+ "libLLVMMipsCodeGen",
+ "libLLVMMipsDisassembler",
+ "libLLVMMipsAsmPrinter",
+ "libLLVMMipsDesc",
+ "libLLVMMipsInfo",
+ "libLLVMX86Info",
+ "libLLVMX86AsmParser",
+ "libLLVMX86CodeGen",
+ "libLLVMX86Disassembler",
+ "libLLVMX86Desc",
+ "libLLVMX86AsmPrinter",
+ "libLLVMX86Utils",
+ "libLLVMAArch64Info",
+ "libLLVMAArch64AsmParser",
+ "libLLVMAArch64CodeGen",
+ "libLLVMAArch64Disassembler",
+ "libLLVMAArch64Desc",
+ "libLLVMAArch64AsmPrinter",
+ "libLLVMAArch64Utils",
+ "libLLVMIRReader",
+ "libLLVMAsmParser",
+ "libLLVMAsmPrinter",
+ "libLLVMBitReader",
+ "libLLVMBitWriter",
+ "libLLVMSelectionDAG",
+ "libLLVMipo",
+ "libLLVMInstCombine",
+ "libLLVMInstrumentation",
+ "libLLVMCodeGen",
+ "libLLVMObject",
+ "libLLVMLinker",
+ "libLLVMMC",
+ "libLLVMMCParser",
+ "libLLVMScalarOpts",
+ "libLLVMTransformObjCARC",
+ "libLLVMTransformUtils",
+ "libLLVMVectorize",
+ "libLLVMAnalysis",
+ "libLLVMCore",
+ "libLLVMOption",
+ "libLLVMTarget",
+ "libLLVMProfileData",
+ "libLLVMObject",
+ "libLLVMMCDisassembler",
+ "libLLVMSupport",
+ ],
+
+ target: {
+ windows: {
+ host_ldlibs: [
+ "-limagehlp",
+ "-lversion",
+ ],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ linux: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ },
+}
diff --git a/tools/clang-format/Android.mk b/tools/clang-format/Android.mk
deleted file mode 100644
index 9ded25fbaf..0000000000
--- a/tools/clang-format/Android.mk
+++ /dev/null
@@ -1,121 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-LOCAL_MODULE := clang-format
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-TBLGEN_TABLES := \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- CC1Options.inc \
- CC1AsOptions.inc \
- Options.inc
-
-clang_format_SRC_FILES := \
- ClangFormat.cpp
-
-LOCAL_SRC_FILES := $(clang_format_SRC_FILES)
-
-LOCAL_STATIC_LIBRARIES := \
- libclangFormat \
- libclangFrontendTool \
- libclangFrontend \
- libclangARCMigrate \
- libclangDriver \
- libclangSerialization \
- libclangCodeGen \
- libclangRewriteFrontend \
- libclangRewrite \
- libclangToolingCore \
- libclangParse \
- libclangSema \
- libclangStaticAnalyzerFrontend \
- libclangStaticAnalyzerCheckers \
- libclangStaticAnalyzerMPIChecker \
- libclangStaticAnalyzerCore \
- libclangAnalysis \
- libclangEdit \
- libclangAST \
- libclangLex \
- libclangBasic \
- libLLVMARMAsmParser \
- libLLVMARMCodeGen \
- libLLVMARMAsmPrinter \
- libLLVMARMDisassembler \
- libLLVMARMDesc \
- libLLVMARMInfo \
- libLLVMMipsAsmParser \
- libLLVMMipsCodeGen \
- libLLVMMipsDisassembler \
- libLLVMMipsAsmPrinter \
- libLLVMMipsDesc \
- libLLVMMipsInfo \
- libLLVMX86Info \
- libLLVMX86AsmParser \
- libLLVMX86CodeGen \
- libLLVMX86Disassembler \
- libLLVMX86Desc \
- libLLVMX86AsmPrinter \
- libLLVMX86Utils \
- libLLVMAArch64Info \
- libLLVMAArch64AsmParser \
- libLLVMAArch64CodeGen \
- libLLVMAArch64Disassembler \
- libLLVMAArch64Desc \
- libLLVMAArch64AsmPrinter \
- libLLVMAArch64Utils \
- libLLVMIRReader \
- libLLVMAsmParser \
- libLLVMAsmPrinter \
- libLLVMBitReader \
- libLLVMBitWriter \
- libLLVMSelectionDAG \
- libLLVMipo \
- libLLVMInstCombine \
- libLLVMInstrumentation \
- libLLVMCodeGen \
- libLLVMObject \
- libLLVMLinker \
- libLLVMMC \
- libLLVMMCParser \
- libLLVMScalarOpts \
- libLLVMTransformObjCARC \
- libLLVMTransformUtils \
- libLLVMVectorize \
- libLLVMAnalysis \
- libLLVMCore \
- libLLVMOption \
- libLLVMTarget \
- libLLVMProfileData \
- libLLVMObject \
- libLLVMMCDisassembler \
- libLLVMSupport
-
-LOCAL_LDLIBS += -lm
-LOCAL_LDLIBS_windows := -limagehlp -lversion
-LOCAL_LDLIBS_darwin := -lpthread -ldl
-LOCAL_LDLIBS_linux := -lpthread -ldl
-
-# remove when we can use PIE binaries in all places again
-LOCAL_NO_FPIE := true
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-
-# Don't build both versions by default (to speed up local builds).
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)_32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)
-endif
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/driver/Android.bp b/tools/driver/Android.bp
new file mode 100644
index 0000000000..17ab1e5bce
--- /dev/null
+++ b/tools/driver/Android.bp
@@ -0,0 +1,109 @@
+// For the host only
+// =====================================================
+clang_binary_host {
+ name: "clang",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+
+ static_libs: [
+ "libclangFrontendTool",
+ "libclangFrontend",
+ "libclangARCMigrate",
+ "libclangDriver",
+ "libclangSerialization",
+ "libclangCodeGen",
+ "libclangRewriteFrontend",
+ "libclangRewrite",
+ "libclangParse",
+ "libclangSema",
+ "libclangStaticAnalyzerFrontend",
+ "libclangStaticAnalyzerCheckers",
+ "libclangStaticAnalyzerMPIChecker",
+ "libclangStaticAnalyzerCore",
+ "libclangAnalysis",
+ "libclangEdit",
+ "libclangAST",
+ "libclangLex",
+ "libclangBasic",
+ "libLLVMARMAsmParser",
+ "libLLVMARMCodeGen",
+ "libLLVMARMAsmPrinter",
+ "libLLVMARMDisassembler",
+ "libLLVMARMDesc",
+ "libLLVMARMInfo",
+ "libLLVMMipsAsmParser",
+ "libLLVMMipsCodeGen",
+ "libLLVMMipsDisassembler",
+ "libLLVMMipsAsmPrinter",
+ "libLLVMMipsDesc",
+ "libLLVMMipsInfo",
+ "libLLVMX86Info",
+ "libLLVMX86AsmParser",
+ "libLLVMX86CodeGen",
+ "libLLVMX86Disassembler",
+ "libLLVMX86Desc",
+ "libLLVMX86AsmPrinter",
+ "libLLVMX86Utils",
+ "libLLVMAArch64Info",
+ "libLLVMAArch64AsmParser",
+ "libLLVMAArch64CodeGen",
+ "libLLVMAArch64Disassembler",
+ "libLLVMAArch64Desc",
+ "libLLVMAArch64AsmPrinter",
+ "libLLVMAArch64Utils",
+ "libLLVMIRReader",
+ "libLLVMAsmParser",
+ "libLLVMAsmPrinter",
+ "libLLVMBitReader",
+ "libLLVMBitWriter",
+ "libLLVMSelectionDAG",
+ "libLLVMipo",
+ "libLLVMInstCombine",
+ "libLLVMInstrumentation",
+ "libLLVMCodeGen",
+ "libLLVMDebugInfoCodeView",
+ "libLLVMObject",
+ "libLLVMLinker",
+ "libLLVMMC",
+ "libLLVMMCParser",
+ "libLLVMScalarOpts",
+ "libLLVMTransformObjCARC",
+ "libLLVMTransformUtils",
+ "libLLVMVectorize",
+ "libLLVMAnalysis",
+ "libLLVMCore",
+ "libLLVMOption",
+ "libLLVMTarget",
+ "libLLVMGlobalISel",
+ "libLLVMProfileData",
+ "libLLVMProfileDataCoverage",
+ "libLLVMObject",
+ "libLLVMMCDisassembler",
+ "libLLVMSupport",
+ ],
+
+ target: {
+ windows: {
+ host_ldlibs: [
+ "-limagehlp",
+ "-lversion",
+ ],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ linux: {
+ host_ldlibs: [
+ "-lm",
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ },
+
+ symlinks: ["clang++"],
+}
diff --git a/tools/driver/Android.mk b/tools/driver/Android.mk
deleted file mode 100644
index 72ff8bdacc..0000000000
--- a/tools/driver/Android.mk
+++ /dev/null
@@ -1,129 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-LOCAL_MODULE := clang
-
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-TBLGEN_TABLES := \
- DiagnosticCommonKinds.inc \
- DiagnosticDriverKinds.inc \
- DiagnosticFrontendKinds.inc \
- CC1Options.inc \
- CC1AsOptions.inc \
- Options.inc
-
-clang_SRC_FILES := \
- cc1_main.cpp \
- cc1as_main.cpp \
- driver.cpp
-
-LOCAL_SRC_FILES := $(clang_SRC_FILES)
-
-LOCAL_STATIC_LIBRARIES := \
- libclangFrontendTool \
- libclangFrontend \
- libclangARCMigrate \
- libclangDriver \
- libclangSerialization \
- libclangCodeGen \
- libclangRewriteFrontend \
- libclangRewrite \
- libclangParse \
- libclangSema \
- libclangStaticAnalyzerFrontend \
- libclangStaticAnalyzerCheckers \
- libclangStaticAnalyzerMPIChecker \
- libclangStaticAnalyzerCore \
- libclangAnalysis \
- libclangEdit \
- libclangAST \
- libclangLex \
- libclangBasic \
- libLLVMARMAsmParser \
- libLLVMARMCodeGen \
- libLLVMARMAsmPrinter \
- libLLVMARMDisassembler \
- libLLVMARMDesc \
- libLLVMARMInfo \
- libLLVMMipsAsmParser \
- libLLVMMipsCodeGen \
- libLLVMMipsDisassembler \
- libLLVMMipsAsmPrinter \
- libLLVMMipsDesc \
- libLLVMMipsInfo \
- libLLVMX86Info \
- libLLVMX86AsmParser \
- libLLVMX86CodeGen \
- libLLVMX86Disassembler \
- libLLVMX86Desc \
- libLLVMX86AsmPrinter \
- libLLVMX86Utils \
- libLLVMAArch64Info \
- libLLVMAArch64AsmParser \
- libLLVMAArch64CodeGen \
- libLLVMAArch64Disassembler \
- libLLVMAArch64Desc \
- libLLVMAArch64AsmPrinter \
- libLLVMAArch64Utils \
- libLLVMIRReader \
- libLLVMAsmParser \
- libLLVMAsmPrinter \
- libLLVMBitReader \
- libLLVMBitWriter \
- libLLVMSelectionDAG \
- libLLVMipo \
- libLLVMInstCombine \
- libLLVMInstrumentation \
- libLLVMCodeGen \
- libLLVMDebugInfoCodeView \
- libLLVMObject \
- libLLVMLinker \
- libLLVMMC \
- libLLVMMCParser \
- libLLVMScalarOpts \
- libLLVMTransformObjCARC \
- libLLVMTransformUtils \
- libLLVMVectorize \
- libLLVMAnalysis \
- libLLVMCore \
- libLLVMOption \
- libLLVMTarget \
- libLLVMGlobalISel \
- libLLVMProfileData \
- libLLVMProfileDataCoverage \
- libLLVMObject \
- libLLVMMCDisassembler \
- libLLVMSupport
-
-LOCAL_LDLIBS += -lm
-LOCAL_LDLIBS_windows := -limagehlp -lversion
-LOCAL_LDLIBS_darwin := -lpthread -ldl
-LOCAL_LDLIBS_linux := -lpthread -ldl
-
-# remove when we can use PIE binaries in all places again
-LOCAL_NO_FPIE := true
-
-# Create symlink clang++ pointing to clang.
-# Use "=" (instead of ":=") to defer the evaluation.
-LOCAL_POST_INSTALL_CMD = \
- $(hide) ln -sf clang$(LOCAL_MODULE_SUFFIX) \
- $(dir $(LOCAL_INSTALLED_MODULE))clang++$(LOCAL_MODULE_SUFFIX)
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-
-# Don't build both versions by default (to speed up local builds).
-ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)_32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)
-endif
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/tools/libclang/Android.bp b/tools/libclang/Android.bp
new file mode 100644
index 0000000000..a55cbcf691
--- /dev/null
+++ b/tools/libclang/Android.bp
@@ -0,0 +1,5 @@
+cc_library_static {
+ name: "libclangLibclang",
+ defaults: ["clang-defaults"],
+ srcs: ["*.cpp"],
+}
diff --git a/tools/libclang/Android.mk b/tools/libclang/Android.mk
deleted file mode 100644
index ff7307bf61..0000000000
--- a/tools/libclang/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
- AttrList.inc \
- AttrParsedAttrList.inc \
- Attrs.inc \
- AttrVisitor.inc \
- CommentCommandList.inc \
- CommentNodes.inc \
- DiagnosticCommonKinds.inc \
- DiagnosticFrontendKinds.inc \
- DiagnosticGroups.inc \
- DiagnosticSerializationKinds.inc \
- DeclNodes.inc \
- StmtNodes.inc \
-
-clang_libclang_SRC_FILES := $(sort $(notdir $(wildcard $(LOCAL_PATH)/*.cpp)))
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_libclang_SRC_FILES)
-LOCAL_MODULE := libclangLibclang
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_HOST_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the target
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(clang_libclang_SRC_FILES)
-LOCAL_MODULE := libclangLibclang
-LOCAL_MODULE_TAGS := optional
-
-include $(CLANG_DEVICE_BUILD_MK)
-include $(CLANG_VERSION_INC_MK)
-include $(CLANG_TBLGEN_RULES_MK)
-include $(BUILD_STATIC_LIBRARY)
diff --git a/utils/TableGen/Android.bp b/utils/TableGen/Android.bp
new file mode 100644
index 0000000000..4f93d60b18
--- /dev/null
+++ b/utils/TableGen/Android.bp
@@ -0,0 +1,33 @@
+cc_binary_host {
+ name: "clang-tblgen",
+ defaults: ["llvm-defaults"],
+ srcs: ["*.cpp"],
+
+ static_libs: [
+ "libLLVMTableGen",
+ "libLLVMSupport",
+ ],
+
+ host_ldlibs: ["-lm"],
+ target: {
+ windows: {
+ host_ldlibs: [
+ "-limagehlp",
+ "-lpsapi",
+ "-lversion",
+ ],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ linux: {
+ host_ldlibs: [
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ },
+}
diff --git a/utils/TableGen/Android.mk b/utils/TableGen/Android.mk
deleted file mode 100644
index 96ef36409d..0000000000
--- a/utils/TableGen/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-clang_tablegen_SRC_FILES := \
- ClangASTNodesEmitter.cpp \
- ClangAttrEmitter.cpp \
- ClangCommentCommandInfoEmitter.cpp \
- ClangCommentHTMLNamedCharacterReferenceEmitter.cpp \
- ClangCommentHTMLTagsEmitter.cpp \
- ClangDiagnosticsEmitter.cpp \
- ClangSACheckersEmitter.cpp \
- NeonEmitter.cpp \
- TableGen.cpp
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := clang-tblgen
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(clang_tablegen_SRC_FILES)
-
-REQUIRES_EH := 1
-REQUIRES_RTTI := 1
-
-LOCAL_STATIC_LIBRARIES := \
- libLLVMTableGen \
- libLLVMSupport
-
-LOCAL_LDLIBS += -lm
-LOCAL_LDLIBS_windows := -limagehlp -lpsapi -lversion
-LOCAL_LDLIBS_darwin := -lpthread -ldl
-LOCAL_LDLIBS_linux := -lpthread -ldl
-
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_EXECUTABLE)