blob: 1c9a4ec9c94498f7370e73b13d4d97f1568ebcfc [file] [log] [blame]
Garfield Tan51060f92017-10-11 10:39:03 -07001// Copyright (C) 2017 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
15genrule {
16 name: "ffi_header",
17 cmd: "$(location gen_ffi_header.sh) < $(in) > $(out)",
18 srcs: ["include/ffi.h.in"],
19 out: ["ffi_gen.h"],
20 tool_files: ["gen_ffi_header.sh"],
21}
22
Garfield Tan51060f92017-10-11 10:39:03 -070023cc_library_static {
24 name: "libffi",
Ivan Lozano60c5e002019-08-05 10:20:26 -070025 host_supported: true,
Ben Linc82cc182018-04-25 10:33:27 -070026 vendor_available: true,
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070027 cflags: [
28 "-Wall",
29 "-Werror",
30 "-Wno-error=incompatible-pointer-types",
Dan Willemsen46504e92019-10-22 17:58:27 -070031 "-Wno-incompatible-pointer-types",
32 "-Wno-null-pointer-arithmetic",
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070033 "-Wno-pointer-arith",
34 "-Wno-sign-compare",
35 "-Wno-unused-parameter",
Dan Willemsen46504e92019-10-22 17:58:27 -070036 "-Wno-unused-result",
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070037 ],
Garfield Tan51060f92017-10-11 10:39:03 -070038 local_include_dirs: ["include"],
39 generated_headers: ["ffi_header"],
40 export_generated_headers: ["ffi_header"],
41 srcs: [
Dan Willemsen46504e92019-10-22 17:58:27 -070042 "src/closures.c",
Garfield Tan51060f92017-10-11 10:39:03 -070043 "src/debug.c",
44 "src/java_raw_api.c",
45 "src/prep_cif.c",
46 "src/raw_api.c",
47 "src/types.c",
48 ],
Garfield Tan51060f92017-10-11 10:39:03 -070049 arch: {
50 arm: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070051 srcs: [
52 "src/arm/sysv.S",
53 "src/arm/ffi.c",
54 ],
Garfield Tan51060f92017-10-11 10:39:03 -070055 export_include_dirs: ["linux-arm"],
56 },
Garfield Tan872ed7e2017-10-17 11:13:15 -070057 arm64: {
58 srcs: [
59 "src/aarch64/sysv.S",
60 "src/aarch64/ffi.c",
61 ],
62 export_include_dirs: ["linux-arm64"],
63 },
Garfield Tan51060f92017-10-11 10:39:03 -070064 x86: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070065 srcs: [
66 "src/x86/ffi.c",
67 "src/x86/sysv.S",
68 "src/x86/win32.S",
69 ],
Garfield Tan51060f92017-10-11 10:39:03 -070070 asflags: [
71 "-DHAVE_AS_X86_PCREL",
72 "-DHAVE_AS_ASCII_PSEUDO_OP",
73 ],
Garfield Tan51060f92017-10-11 10:39:03 -070074 export_include_dirs: ["linux-x86"],
75 },
76 x86_64: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070077 srcs: [
78 "src/x86/ffi64.c",
79 "src/x86/unix64.S",
80 ],
Garfield Tan51060f92017-10-11 10:39:03 -070081 asflags: [
82 "-DHAVE_AS_X86_PCREL",
83 "-DHAVE_AS_ASCII_PSEUDO_OP",
84 ],
Garfield Tan51060f92017-10-11 10:39:03 -070085 export_include_dirs: ["linux-x86_64"],
86 },
87 },
Dan Willemsen46504e92019-10-22 17:58:27 -070088 target: {
89 darwin_x86_64: {
90 exclude_srcs: ["src/x86/unix64.S"],
91 srcs: [
92 "src/x86/darwin.S",
93 "src/x86/darwin64.S",
94 ],
95 },
96 },
Garfield Tan51060f92017-10-11 10:39:03 -070097}