Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 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 | |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 23 | cc_library_static { |
| 24 | name: "libffi", |
Ivan Lozano | 60c5e00 | 2019-08-05 10:20:26 -0700 | [diff] [blame] | 25 | host_supported: true, |
Ben Lin | c82cc18 | 2018-04-25 10:33:27 -0700 | [diff] [blame] | 26 | vendor_available: true, |
Chih-Hung Hsieh | a051dfe | 2017-10-30 10:24:17 -0700 | [diff] [blame] | 27 | cflags: [ |
| 28 | "-Wall", |
| 29 | "-Werror", |
| 30 | "-Wno-error=incompatible-pointer-types", |
Dan Willemsen | 46504e9 | 2019-10-22 17:58:27 -0700 | [diff] [blame] | 31 | "-Wno-incompatible-pointer-types", |
| 32 | "-Wno-null-pointer-arithmetic", |
Chih-Hung Hsieh | a051dfe | 2017-10-30 10:24:17 -0700 | [diff] [blame] | 33 | "-Wno-pointer-arith", |
| 34 | "-Wno-sign-compare", |
| 35 | "-Wno-unused-parameter", |
Dan Willemsen | 46504e9 | 2019-10-22 17:58:27 -0700 | [diff] [blame] | 36 | "-Wno-unused-result", |
Chih-Hung Hsieh | a051dfe | 2017-10-30 10:24:17 -0700 | [diff] [blame] | 37 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 38 | local_include_dirs: ["include"], |
| 39 | generated_headers: ["ffi_header"], |
| 40 | export_generated_headers: ["ffi_header"], |
| 41 | srcs: [ |
Dan Willemsen | 46504e9 | 2019-10-22 17:58:27 -0700 | [diff] [blame] | 42 | "src/closures.c", |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 43 | "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 Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 49 | arch: { |
| 50 | arm: { |
Garfield Tan | 872ed7e | 2017-10-17 11:13:15 -0700 | [diff] [blame] | 51 | srcs: [ |
| 52 | "src/arm/sysv.S", |
| 53 | "src/arm/ffi.c", |
| 54 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 55 | export_include_dirs: ["linux-arm"], |
| 56 | }, |
Garfield Tan | 872ed7e | 2017-10-17 11:13:15 -0700 | [diff] [blame] | 57 | arm64: { |
| 58 | srcs: [ |
| 59 | "src/aarch64/sysv.S", |
| 60 | "src/aarch64/ffi.c", |
| 61 | ], |
| 62 | export_include_dirs: ["linux-arm64"], |
| 63 | }, |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 64 | x86: { |
Garfield Tan | 872ed7e | 2017-10-17 11:13:15 -0700 | [diff] [blame] | 65 | srcs: [ |
| 66 | "src/x86/ffi.c", |
| 67 | "src/x86/sysv.S", |
| 68 | "src/x86/win32.S", |
| 69 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 70 | asflags: [ |
| 71 | "-DHAVE_AS_X86_PCREL", |
| 72 | "-DHAVE_AS_ASCII_PSEUDO_OP", |
| 73 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 74 | export_include_dirs: ["linux-x86"], |
| 75 | }, |
| 76 | x86_64: { |
Garfield Tan | 872ed7e | 2017-10-17 11:13:15 -0700 | [diff] [blame] | 77 | srcs: [ |
| 78 | "src/x86/ffi64.c", |
| 79 | "src/x86/unix64.S", |
| 80 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 81 | asflags: [ |
| 82 | "-DHAVE_AS_X86_PCREL", |
| 83 | "-DHAVE_AS_ASCII_PSEUDO_OP", |
| 84 | ], |
Garfield Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 85 | export_include_dirs: ["linux-x86_64"], |
| 86 | }, |
| 87 | }, |
Dan Willemsen | 46504e9 | 2019-10-22 17:58:27 -0700 | [diff] [blame] | 88 | 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 Tan | 51060f9 | 2017-10-11 10:39:03 -0700 | [diff] [blame] | 97 | } |