blob: 3cec5649a2f0497db764f6acb8a552088612c5d5 [file] [log] [blame]
Dan Willemsen1f906bf2018-10-24 23:07:53 -07001// Copyright 2018, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Include generated Android.bp files
16build = [
Rubin Xu9a27c7f2021-02-10 00:04:48 +000017 "Android.libbase.bp",
18 "Android.libplatform.bp",
19 "Android.libsampler.bp",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070020 "Android.base.bp",
Rubin Xu9a27c7f2021-02-10 00:04:48 +000021 "Android.initializers.bp",
22 "Android.torque.bp",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070023]
24
25cc_defaults {
26 name: "v8_defaults",
27
28 cflags: [
29 "-Wall",
30 "-Werror",
31 "-Wno-endif-labels",
32 "-Wno-implicit-fallthrough",
33 "-Wno-import",
34 "-Wno-format",
Rubin Xu2894c6a2019-02-07 16:01:35 +000035 "-Wno-unused-variable",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070036 "-Wno-unused-parameter",
37 "-Wno-unused-private-field",
38 "-Wno-sign-compare",
39 "-Wno-missing-field-initializers",
40 "-Wno-ignored-qualifiers",
41 "-Wno-undefined-var-template",
Rubin Xu9a27c7f2021-02-10 00:04:48 +000042// "-Wno-null-pointer-arithmetic",
Rubin Xu2894c6a2019-02-07 16:01:35 +000043 "-Wno-non-virtual-dtor",
44 "-Wno-user-defined-warnings",
45 "-Wno-unused-lambda-capture",
Rubin Xu9a27c7f2021-02-10 00:04:48 +000046 "-Wno-missing-braces",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070047 "-fno-exceptions",
48 "-fvisibility=hidden",
Rubin Xu9a27c7f2021-02-10 00:04:48 +000049 "-fno-rtti",
50 "-g0",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070051 "-Os",
Rubin Xu9a27c7f2021-02-10 00:04:48 +000052 "-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64",
53 "-DV8_ATOMIC_OBJECT_FIELD_WRITES",
54 "-DV8_ATOMIC_MARKING_STATE",
55 "-DV8_ENABLE_LAZY_SOURCE_POSITIONS",
56 "-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH",
57 "-DV8_SNAPSHOT_COMPRESSION",
58 "-DV8_NO_ARGUMENTS_ADAPTOR",
59 "-DDISABLE_UNTRUSTED_CODE_MITIGATIONS",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070060 ],
Rubin Xu9a27c7f2021-02-10 00:04:48 +000061 cpp_std: "gnu++14",
Dan Willemsen1f906bf2018-10-24 23:07:53 -070062 arch: {
63 arm: {
Rubin Xu9a27c7f2021-02-10 00:04:48 +000064 cflags: [
65 "-DV8_TARGET_ARCH_ARM",
66 "-DV8_SHARED_RO_HEAP",
67 ],
Dan Willemsen1f906bf2018-10-24 23:07:53 -070068 },
69 arm64: {
70 cflags: ["-DV8_TARGET_ARCH_ARM64"],
71 },
Dan Willemsen1f906bf2018-10-24 23:07:53 -070072 x86: {
73 cflags: ["-DV8_TARGET_ARCH_IA32"],
74 },
75 x86_64: {
76 cflags: ["-DV8_TARGET_ARCH_X64"],
77 },
78 },
79}
80
Dan Willemsen1f906bf2018-10-24 23:07:53 -070081cc_library_static {
Rubin Xu9a27c7f2021-02-10 00:04:48 +000082 name: "libv8",
83 defaults: [
84 "v8_defaults",
85 "v8_snapshot"
86 ],
87 whole_static_libs: [
88 "v8_base",
89 "v8_libbase",
90 "v8_libplatform",
91 "v8_libsampler",
92 "v8_zlib",
93 ],
94 local_include_dirs: [
95 "third_party/zlib"
96 ],
97 generated_headers: [
98 "v8_generate_bytecode_builtins_list"
99 ],
100
101 export_include_dirs: ["include"],
102}
103
104cc_binary {
105 name: "v8_mksnapshot_32",
106 defaults: ["v8_mksnapshot_base"],
107 compile_multilib: "32",
108}
109
110cc_binary {
111 name: "v8_mksnapshot_64",
112 defaults: ["v8_mksnapshot_base"],
113 compile_multilib: "64",
114}
115
116cc_defaults {
117 name: "v8_mksnapshot_base",
118 defaults: [
119 "v8_defaults",
120 "v8_torque_headers"
121 ],
122 srcs: [
123 "src/snapshot/embedded/embedded-empty.cc",
124 "src/snapshot/embedded/embedded-file-writer.cc",
125 "src/snapshot/embedded/platform-embedded-file-writer-aix.cc",
126 "src/snapshot/embedded/platform-embedded-file-writer-base.cc",
127 "src/snapshot/embedded/platform-embedded-file-writer-generic.cc",
128 "src/snapshot/embedded/platform-embedded-file-writer-mac.cc",
129 "src/snapshot/embedded/platform-embedded-file-writer-win.cc",
130 "src/snapshot/mksnapshot.cc",
131 "src/snapshot/snapshot-empty.cc",
132 ":v8_init",
133 ],
134 // From v8_initializers
135 arch: {
136 arm: {
137 srcs: [
138 "src/builtins/arm/builtins-arm.cc",
139 ],
140 },
141 arm64: {
142 srcs: [
143 "src/builtins/arm64/builtins-arm64.cc",
144 ],
145 },
146 x86: {
147 srcs: [
148 "src/builtins/ia32/builtins-ia32.cc",
149 ],
150 },
151 x86_64: {
152 srcs: [
153 "src/builtins/x64/builtins-x64.cc",
154 ],
155 },
156 },
157 generated_headers: [
158 "v8_generate_bytecode_builtins_list"
159 ],
160
161 static_libs: [
162 "v8_base",
163 "v8_libplatform",
164 "v8_libsampler",
165 "v8_libbase",
166 "v8_zlib",
167 ],
168 shared_libs: [
169 "liblog",
170 ],
171 local_include_dirs: ["include"],
172}
173
174cc_binary_host {
175 name: "v8_bytecode_builtins_list_generator",
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700176 defaults: ["v8_defaults"],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000177 host_ldlibs: ["-lrt"],
178 srcs: [
179 "src/builtins/generate-bytecodes-builtins-list.cc",
180 "src/interpreter/bytecode-operands.cc",
181 "src/interpreter/bytecodes.cc",
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700182 ],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000183 static_libs: [
184 "v8_libbase",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000185 ],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000186}
187
188genrule {
189 name: "v8_generate_bytecode_builtins_list",
190 tools: ["v8_bytecode_builtins_list_generator"],
191 srcs: [],
192 cmd: "mkdir -p $(genDir)/builtins-generated/ && $(location v8_bytecode_builtins_list_generator) $(out)",
193 out: [
194 "builtins-generated/bytecodes-builtins-list.h"
195 ],
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700196}
197
Rubin Xu2894c6a2019-02-07 16:01:35 +0000198cc_binary_host {
199 name: "v8_torque",
200 defaults: ["v8_defaults"],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000201 cflags: [
202 "-fexceptions",
203 "-frtti",
204 ],
205 host_ldlibs: ["-lrt"],
Rubin Xu2894c6a2019-02-07 16:01:35 +0000206 srcs: [
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000207 "src/torque/cc-generator.cc",
208 "src/torque/cfg.cc",
209 "src/torque/class-debug-reader-generator.cc",
210 "src/torque/csa-generator.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000211 "src/torque/declarable.cc",
212 "src/torque/declaration-visitor.cc",
213 "src/torque/declarations.cc",
214 "src/torque/earley-parser.cc",
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000215 "src/torque/global-context.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000216 "src/torque/implementation-visitor.cc",
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000217 "src/torque/instance-type-generator.cc",
218 "src/torque/instructions.cc",
219 "src/torque/server-data.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000220 "src/torque/source-positions.cc",
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000221 "src/torque/torque-code-generator.cc",
222 "src/torque/torque-compiler.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000223 "src/torque/torque-parser.cc",
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000224 "src/torque/type-inference.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000225 "src/torque/type-oracle.cc",
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000226 "src/torque/type-visitor.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000227 "src/torque/types.cc",
228 "src/torque/utils.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000229 "src/torque/torque.cc",
230 ],
231 static_libs: [
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000232 "v8_libbase",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000233 ],
234}
235
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000236cc_defaults {
237 name: "v8_snapshot",
238 defaults: ["v8_torque_headers"],
Rubin Xu2894c6a2019-02-07 16:01:35 +0000239 srcs: [
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000240 "src/init/setup-isolate-deserialize.cc",
Rubin Xu2894c6a2019-02-07 16:01:35 +0000241 ],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000242 arch: {
243 arm: {
244 srcs: [
245 "snapshot/embedded-arm.S",
246 "snapshot/snapshot-arm.cc",
247 ],
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700248 },
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000249 arm64: {
250 srcs: [
251 "snapshot/embedded-arm64.S",
252 "snapshot/snapshot-arm64.cc",
253 ],
254 },
255 x86: {
256 srcs: [
257 "snapshot/embedded-x86.S",
258 "snapshot/snapshot-x86.cc",
259 ],
260 },
261 x86_64: {
262 srcs: [
263 "snapshot/embedded-x86_64.S",
264 "snapshot/snapshot-x86_64.cc",
265 ],
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700266 },
267 },
268}
269
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000270cc_defaults {
271 name: "v8_torque_headers",
272 arch: {
273 arm: {
274 generated_headers: [
275 "v8_torque_file_32",
276 ],
277 },
278 arm64: {
279 generated_headers: [
280 "v8_torque_file",
281 ],
282 },
283 x86: {
284 generated_headers: [
285 "v8_torque_file_32",
286 ],
287 },
288 x86_64: {
289 generated_headers: [
290 "v8_torque_file",
291 ],
292 },
293 },
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700294}
295
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000296filegroup {
297 name: "v8_init",
298 srcs: [
299 "src/init/setup-isolate-full.cc",
300 ":v8_initializers",
301 ]
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700302}
303
304cc_library_static {
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000305 name: "v8_zlib",
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700306 defaults: ["v8_defaults"],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000307 cflags: ["-Wno-error"],
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700308 srcs: [
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000309 "third_party/zlib/adler32.c",
310 "third_party/zlib/compress.c",
311 "third_party/zlib/cpu_features.c",
312 "third_party/zlib/crc32.c",
313 "third_party/zlib/deflate.c",
314 "third_party/zlib/gzclose.c",
315 "third_party/zlib/gzlib.c",
316 "third_party/zlib/gzread.c",
317 "third_party/zlib/gzwrite.c",
318 "third_party/zlib/infback.c",
319 "third_party/zlib/inffast.c",
320 "third_party/zlib/inftrees.c",
321 "third_party/zlib/trees.c",
322 "third_party/zlib/uncompr.c",
323 "third_party/zlib/zutil.c",
324 "third_party/zlib/inflate.c",
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700325 ],
Rubin Xu9a27c7f2021-02-10 00:04:48 +0000326 host_supported: true,
327 local_include_dirs: ["third_party/zlib"],
Dan Willemsen1f906bf2018-10-24 23:07:53 -0700328}