blob: 361a7ee41a208278a95239b87e8164b4056a5f12 [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",
31 "-Wno-pointer-arith",
32 "-Wno-sign-compare",
33 "-Wno-unused-parameter",
34 ],
Garfield Tan51060f92017-10-11 10:39:03 -070035 local_include_dirs: ["include"],
36 generated_headers: ["ffi_header"],
37 export_generated_headers: ["ffi_header"],
38 srcs: [
39 "src/debug.c",
40 "src/java_raw_api.c",
41 "src/prep_cif.c",
42 "src/raw_api.c",
43 "src/types.c",
44 ],
Garfield Tan51060f92017-10-11 10:39:03 -070045 arch: {
46 arm: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070047 srcs: [
48 "src/arm/sysv.S",
49 "src/arm/ffi.c",
50 ],
Garfield Tan51060f92017-10-11 10:39:03 -070051 export_include_dirs: ["linux-arm"],
52 },
Garfield Tan872ed7e2017-10-17 11:13:15 -070053 arm64: {
54 srcs: [
55 "src/aarch64/sysv.S",
56 "src/aarch64/ffi.c",
57 ],
58 export_include_dirs: ["linux-arm64"],
59 },
Garfield Tan51060f92017-10-11 10:39:03 -070060 x86: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070061 srcs: [
62 "src/x86/ffi.c",
63 "src/x86/sysv.S",
64 "src/x86/win32.S",
65 ],
Garfield Tan51060f92017-10-11 10:39:03 -070066 asflags: [
67 "-DHAVE_AS_X86_PCREL",
68 "-DHAVE_AS_ASCII_PSEUDO_OP",
69 ],
Garfield Tan51060f92017-10-11 10:39:03 -070070 export_include_dirs: ["linux-x86"],
71 },
72 x86_64: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070073 srcs: [
74 "src/x86/ffi64.c",
75 "src/x86/unix64.S",
76 ],
Garfield Tan51060f92017-10-11 10:39:03 -070077 asflags: [
78 "-DHAVE_AS_X86_PCREL",
79 "-DHAVE_AS_ASCII_PSEUDO_OP",
80 ],
Garfield Tan51060f92017-10-11 10:39:03 -070081 export_include_dirs: ["linux-x86_64"],
82 },
83 },
84}