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 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 23cc_library_static { 24 name: "libffi", 25 vendor_available: true, 26 cflags: [ 27 "-Wall", 28 "-Werror", 29 "-Wno-error=incompatible-pointer-types", 30 "-Wno-pointer-arith", 31 "-Wno-sign-compare", 32 "-Wno-unused-parameter", 33 ], 34 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 ], 44 arch: { 45 arm: { 46 srcs: [ 47 "src/arm/sysv.S", 48 "src/arm/ffi.c", 49 ], 50 export_include_dirs: ["linux-arm"], 51 }, 52 arm64: { 53 srcs: [ 54 "src/aarch64/sysv.S", 55 "src/aarch64/ffi.c", 56 ], 57 export_include_dirs: ["linux-arm64"], 58 }, 59 x86: { 60 srcs: [ 61 "src/x86/ffi.c", 62 "src/x86/sysv.S", 63 "src/x86/win32.S", 64 ], 65 asflags: [ 66 "-DHAVE_AS_X86_PCREL", 67 "-DHAVE_AS_ASCII_PSEUDO_OP", 68 ], 69 export_include_dirs: ["linux-x86"], 70 }, 71 x86_64: { 72 srcs: [ 73 "src/x86/ffi64.c", 74 "src/x86/unix64.S", 75 ], 76 asflags: [ 77 "-DHAVE_AS_X86_PCREL", 78 "-DHAVE_AS_ASCII_PSEUDO_OP", 79 ], 80 export_include_dirs: ["linux-x86_64"], 81 }, 82 }, 83} 84