OSDN Git Service

Convert Android.mk to Android.bp.
[android-x86/external-libffi.git] / Android.bp
1 // 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
15 genrule {
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
23 arm_srcs = [
24     "src/arm/sysv.S",
25     "src/arm/ffi.c",
26 ]
27
28 x86_srcs = [
29     "src/x86/ffi.c",
30     "src/x86/sysv.S",
31     "src/x86/win32.S",
32 ]
33
34 x86_64_srcs = [
35     "src/x86/ffi64.c",
36     "src/x86/unix64.S",
37 ]
38
39 cc_library_static {
40     name: "libffi",
41     cflags: ["-Wno-unused-parameter", "-Wno-sign-compare"],
42     local_include_dirs: ["include"],
43     generated_headers: ["ffi_header"],
44     export_generated_headers: ["ffi_header"],
45     srcs: [
46         "src/debug.c",
47         "src/java_raw_api.c",
48         "src/prep_cif.c",
49         "src/raw_api.c",
50         "src/types.c",
51     ],
52     multilib: {
53         lib64: {
54             srcs: x86_64_srcs,
55         },
56         lib32: {
57             srcs: arm_srcs + x86_srcs,
58         },
59     },
60     arch: {
61         arm: {
62             exclude_srcs: x86_srcs + x86_64_srcs,
63             local_include_dirs: ["linux-arm"],
64             export_include_dirs: ["linux-arm"],
65         },
66         x86: {
67             exclude_srcs: arm_srcs,
68             asflags: [
69                 "-DHAVE_AS_X86_PCREL",
70                 "-DHAVE_AS_ASCII_PSEUDO_OP",
71             ],
72             local_include_dirs: ["linux-x86"],
73             export_include_dirs: ["linux-x86"],
74         },
75         x86_64: {
76             exclude_srcs: arm_srcs,
77             asflags: [
78                 "-DHAVE_AS_X86_PCREL",
79                 "-DHAVE_AS_ASCII_PSEUDO_OP",
80             ],
81             local_include_dirs: ["linux-x86_64"],
82             export_include_dirs: ["linux-x86_64"],
83         },
84     },
85 }