1package { 2 default_applicable_licenses: ["external_clang_license"], 3} 4 5// Added automatically by a large-scale-change that took the approach of 6// 'apply every license found to every target'. While this makes sure we respect 7// every license restriction, it may not be entirely correct. 8// 9// e.g. GPL in an MIT project might only apply to the contrib/ directory. 10// 11// Please consider splitting the single license below into multiple licenses, 12// taking care not to lose any license_kind information, and overriding the 13// default license using the 'licenses: [...]' property on targets as needed. 14// 15// For unused files, consider creating a 'fileGroup' with "//visibility:private" 16// to attach the license to, and including a comment whether the files may be 17// used in the current project. 18// 19// large-scale-change included anything that looked like it might be a license 20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 21// 22// Please consider removing redundant or irrelevant files from 'license_text:'. 23// 24// large-scale-change filtered out the below license kinds as false-positives: 25// SPDX-license-identifier-GPL 26// See: http://go/android-license-faq 27license { 28 name: "external_clang_license", 29 visibility: [":__subpackages__"], 30 license_kinds: [ 31 "SPDX-license-identifier-Apache-2.0", 32 "SPDX-license-identifier-BSD", 33 "SPDX-license-identifier-MIT", 34 "SPDX-license-identifier-NCSA", 35 ], 36 license_text: [ 37 "LICENSE.TXT", 38 "NOTICE", 39 ], 40} 41 42cc_defaults { 43 name: "clang-defaults", 44 defaults: [ 45 "llvm-defaults", 46 ], 47 48 header_libs: ["clang-headers"], 49 50 cflags: [ 51 "-pedantic", 52 "-Wno-cast-qual", 53 "-Wno-long-long", 54 "-Wno-unreachable-code-loop-increment", 55 "-Wno-unused-lambda-capture", 56 "-Wno-unused-private-field", 57 ], 58 59 include_dirs: [ 60 "external/clang/include", 61 "external/clang/lib/CodeGen", 62 ], 63 64 tidy_checks: [ 65 "-google-runtime-member-string-references", 66 ], 67 68 target: { 69 windows: { 70 enabled: true, 71 cflags: [ 72 // This triggers an assertion on cross Windows builds. 73 "-Wno-error=uninitialized", 74 ], 75 }, 76 not_windows: { 77 cflags: [ 78 "-Wno-unused-lambda-capture", 79 ], 80 }, 81 }, 82 83} 84 85clang_generated_headers = [ 86 "clang-gen-options", 87 "clang-gen-attributes", 88 "clang-gen-checkers", 89 "clang-gen-comment-commands", 90 "clang-gen-comment-html-named-character-references", 91 "clang-gen-html-tags", 92 "clang-gen-comment-nodes", 93 "clang-gen-diagnostics", 94 "clang-gen-declnodes", 95 "clang-gen-statnodes", 96 "clang-gen-arm-neon", 97 "clang-version", 98 "llvm-gen-attributes", 99 "llvm-gen-intrinsics", 100] 101 102cc_library_headers { 103 name: "clang-headers", 104 vendor_available: true, 105 product_available: true, 106 host_supported: true, 107 // TODO(b/153609531): remove when no longer needed. 108 native_bridge_supported: true, 109 generated_headers: clang_generated_headers, 110 export_include_dirs: ["include"], 111 export_generated_headers: clang_generated_headers, 112 target: { 113 windows: { 114 enabled: true, 115 }, 116 }, 117} 118 119llvm_tblgen { 120 name: "clang-gen-options", 121 in: "include/clang/Driver/Options.td", 122 outs: ["clang/Driver/Options.inc"], 123} 124 125clang_tblgen { 126 name: "clang-gen-attributes", 127 in: "include/clang/Basic/Attr.td", 128 outs: [ 129 "clang/AST/AttrDump.inc", 130 "clang/AST/AttrImpl.inc", 131 "clang/AST/Attrs.inc", 132 "clang/AST/AttrVisitor.inc", 133 "clang/Basic/AttrHasAttributeImpl.inc", 134 "clang/Basic/AttrList.inc", 135 "clang/Parse/AttrParserStringSwitches.inc", 136 "clang/Sema/AttrParsedAttrImpl.inc", 137 "clang/Sema/AttrParsedAttrKinds.inc", 138 "clang/Sema/AttrParsedAttrList.inc", 139 "clang/Sema/AttrSpellingListIndex.inc", 140 "clang/Sema/AttrTemplateInstantiate.inc", 141 "clang/Serialization/AttrPCHRead.inc", 142 "clang/Serialization/AttrPCHWrite.inc", 143 ], 144} 145 146clang_tblgen { 147 name: "clang-gen-checkers", 148 in: "include/clang/StaticAnalyzer/Checkers/Checkers.td", 149 outs: ["clang/StaticAnalyzer/Checkers/Checkers.inc"], 150} 151 152clang_tblgen { 153 name: "clang-gen-comment-commands", 154 in: "include/clang/AST/CommentCommands.td", 155 outs: [ 156 "clang/AST/CommentCommandInfo.inc", 157 "clang/AST/CommentCommandList.inc", 158 ], 159} 160 161clang_tblgen { 162 name: "clang-gen-comment-html-named-character-references", 163 in: "include/clang/AST/CommentHTMLNamedCharacterReferences.td", 164 outs: ["clang/AST/CommentHTMLNamedCharacterReferences.inc"], 165} 166 167clang_tblgen { 168 name: "clang-gen-html-tags", 169 in: "include/clang/AST/CommentHTMLTags.td", 170 outs: [ 171 "clang/AST/CommentHTMLTagsProperties.inc", 172 "clang/AST/CommentHTMLTags.inc", 173 ], 174} 175 176clang_tblgen { 177 name: "clang-gen-comment-nodes", 178 in: "include/clang/Basic/CommentNodes.td", 179 outs: ["clang/AST/CommentNodes.inc"], 180} 181 182clang_tblgen { 183 name: "clang-gen-diagnostics", 184 in: "include/clang/Basic/Diagnostic.td", 185 outs: [ 186 "clang/Basic/DiagnosticAnalysisKinds.inc", 187 "clang/Basic/DiagnosticASTKinds.inc", 188 "clang/Basic/DiagnosticCommentKinds.inc", 189 "clang/Basic/DiagnosticCommonKinds.inc", 190 "clang/Basic/DiagnosticDriverKinds.inc", 191 "clang/Basic/DiagnosticFrontendKinds.inc", 192 "clang/Basic/DiagnosticLexKinds.inc", 193 "clang/Basic/DiagnosticParseKinds.inc", 194 "clang/Basic/DiagnosticSemaKinds.inc", 195 "clang/Basic/DiagnosticSerializationKinds.inc", 196 "clang/Basic/DiagnosticGroups.inc", 197 "clang/Basic/DiagnosticIndexName.inc", 198 ], 199} 200 201clang_tblgen { 202 name: "clang-gen-declnodes", 203 in: "include/clang/Basic/DeclNodes.td", 204 outs: ["clang/AST/DeclNodes.inc"], 205} 206 207clang_tblgen { 208 name: "clang-gen-statnodes", 209 in: "include/clang/Basic/StmtNodes.td", 210 outs: ["clang/AST/StmtNodes.inc"], 211} 212 213clang_tblgen { 214 name: "clang-gen-arm-neon", 215 in: "include/clang/Basic/arm_neon.td", 216 outs: [ 217 "clang/Basic/arm_neon.inc", 218 "clang/Basic/arm_neon.h", 219 ], 220} 221 222genrule { 223 name: "clang-version", 224 cmd: "$(location) $(in) > $(out)", 225 tool_files: [ 226 "clang-version-inc.py", 227 "version.py", 228 ], 229 srcs: [ 230 "include/clang/Basic/Version.inc.in", 231 ], 232 out: ["clang/Basic/Version.inc"], 233} 234 235cc_library_shared { 236 name: "libclang_android", 237 defaults: [ 238 "clang-defaults", 239 "force_build_llvm_components", 240 ], 241 242 host_supported: true, 243 244 whole_static_libs: [ 245 "libclangAnalysis", 246 "libclangAST", 247 "libclangASTMatchers", 248 "libclangBasic", 249 "libclangCodeGen", 250 "libclangDriver", 251 "libclangEdit", 252 "libclangFormat", 253 "libclangFrontend", 254 "libclangIndex", 255 "libclangLex", 256 "libclangLibclang", 257 "libclangParse", 258 "libclangRewrite", 259 "libclangRewriteFrontend", 260 "libclangSema", 261 "libclangSerialization", 262 "libclangTooling", 263 "libclangToolingCore", 264 ], 265 266 export_shared_lib_headers: ["libLLVM_android"], 267 shared_libs: ["libLLVM_android"], 268 export_header_lib_headers: ["clang-headers"], 269 270 target: { 271 windows: { 272 host_ldlibs: [ 273 "-limagehlp", 274 "-lpsapi", 275 "-lversion", 276 ], 277 }, 278 not_windows: { 279 shared_libs: ["libc++"], 280 }, 281 }, 282 283 product_variables: { 284 unbundled_build: { 285 // Don't build the library in unbundled branches. 286 enabled: false, 287 }, 288 }, 289} 290 291genrule { 292 name: "renderscript-clang-include", 293 visibility: ["//development/build"], 294 tools: ["soong_zip"], 295 cmd: "$(location soong_zip) -o $(out) -P renderscript/clang-include " + 296 "-C $$(dirname $(location LICENSE.TXT))/lib/Headers -D $$(dirname $(location LICENSE.TXT))/lib/Headers " + 297 "-C $$(dirname $(location LICENSE.TXT)) -f $(location LICENSE.TXT)", 298 srcs: [ 299 "lib/Headers/**/*", 300 "LICENSE.TXT", 301 ], 302 out: ["clang-include.zip"], 303} 304