blob: 923cb10cdb48e0a1c70b5eb1d6a5c1e0ca55d8db [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",
Ben Linc82cc182018-04-25 10:33:27 -070025 vendor_available: true,
Chih-Hung Hsieha051dfe2017-10-30 10:24:17 -070026 cflags: [
27 "-Wall",
28 "-Werror",
29 "-Wno-error=incompatible-pointer-types",
30 "-Wno-pointer-arith",
31 "-Wno-sign-compare",
32 "-Wno-unused-parameter",
33 ],
Garfield Tan51060f92017-10-11 10:39:03 -070034 local_include_dirs: ["include"],
35 generated_headers: ["ffi_header"],
36 export_generated_headers: ["ffi_header"],
37 srcs: [
38 "src/debug.c",
39 "src/java_raw_api.c",
40 "src/prep_cif.c",
41 "src/raw_api.c",
42 "src/types.c",
43 ],
Garfield Tan51060f92017-10-11 10:39:03 -070044 arch: {
45 arm: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070046 srcs: [
47 "src/arm/sysv.S",
48 "src/arm/ffi.c",
49 ],
Garfield Tan51060f92017-10-11 10:39:03 -070050 export_include_dirs: ["linux-arm"],
51 },
Garfield Tan872ed7e2017-10-17 11:13:15 -070052 arm64: {
53 srcs: [
54 "src/aarch64/sysv.S",
55 "src/aarch64/ffi.c",
56 ],
57 export_include_dirs: ["linux-arm64"],
58 },
Garfield Tan51060f92017-10-11 10:39:03 -070059 x86: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070060 srcs: [
61 "src/x86/ffi.c",
62 "src/x86/sysv.S",
63 "src/x86/win32.S",
64 ],
Garfield Tan51060f92017-10-11 10:39:03 -070065 asflags: [
66 "-DHAVE_AS_X86_PCREL",
67 "-DHAVE_AS_ASCII_PSEUDO_OP",
68 ],
Garfield Tan51060f92017-10-11 10:39:03 -070069 export_include_dirs: ["linux-x86"],
70 },
71 x86_64: {
Garfield Tan872ed7e2017-10-17 11:13:15 -070072 srcs: [
73 "src/x86/ffi64.c",
74 "src/x86/unix64.S",
75 ],
Garfield Tan51060f92017-10-11 10:39:03 -070076 asflags: [
77 "-DHAVE_AS_X86_PCREL",
78 "-DHAVE_AS_ASCII_PSEUDO_OP",
79 ],
Garfield Tan51060f92017-10-11 10:39:03 -070080 export_include_dirs: ["linux-x86_64"],
81 },
82 },
83}