Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 1 | // Copyright (C) 2018 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 | cc_defaults { |
| 16 | name: "libpcap_defaults", |
| 17 | cflags: [ |
| 18 | "-D_BSD_SOURCE", |
| 19 | "-DHAVE_CONFIG_H", |
| 20 | "-Dlint", |
| 21 | "-D_U_=__attribute__((__unused__))", |
| 22 | "-Wall", |
| 23 | "-Werror", |
| 24 | "-Wno-macro-redefined", |
| 25 | "-Wno-pointer-arith", |
| 26 | "-Wno-sign-compare", |
| 27 | "-Wno-unused-parameter", |
| 28 | "-Wno-unused-result", |
| 29 | "-Wno-tautological-compare", |
| 30 | ], |
| 31 | } |
| 32 | |
| 33 | cc_library { |
| 34 | name: "libpcap", |
Aaron Huang | e7597b8 | 2018-11-16 20:18:03 +0800 | [diff] [blame] | 35 | host_supported: true, |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 36 | vendor_available: true, |
Lorenzo Colitti | 738c96f | 2020-02-03 12:34:27 +0900 | [diff] [blame] | 37 | // Build against the NDK 29 because it's used by the network stack mainline module tests, which |
| 38 | // need to support Q. |
| 39 | // TODO(b/148792341): stop hardcoding sdk_version integers in libraries all over the tree and |
| 40 | // define a min_apex_sdk_version property that all module code can use. |
| 41 | sdk_version: "29", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 42 | defaults: ["libpcap_defaults"], |
| 43 | |
| 44 | // (Matches order in libpcap's Makefile.) |
| 45 | srcs: [ |
| 46 | "pcap-linux.c", |
| 47 | "pcap-usb-linux.c", |
| 48 | "pcap-netfilter-linux-android.c", |
| 49 | "fad-getad.c", |
| 50 | "pcap.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 51 | "gencode.c", |
| 52 | "optimize.c", |
| 53 | "nametoaddr.c", |
| 54 | "etherent.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 55 | "fmtutils.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 56 | "savefile.c", |
| 57 | "sf-pcap.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 58 | "sf-pcapng.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 59 | "pcap-common.c", |
| 60 | "bpf_image.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 61 | "bpf_filter.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 62 | "bpf_dump.c", |
| 63 | "scanner.c", |
| 64 | "grammar.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 65 | ], |
| 66 | |
Aaron Huang | e7597b8 | 2018-11-16 20:18:03 +0800 | [diff] [blame] | 67 | target: { |
| 68 | darwin: { |
| 69 | enabled: false, |
| 70 | }, |
| 71 | }, |
| 72 | |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 73 | export_include_dirs: ["."], |
| 74 | } |
| 75 | |
| 76 | // |
| 77 | // Tests. |
| 78 | // |
| 79 | |
| 80 | cc_test { |
| 81 | name: "libpcap_test", |
| 82 | defaults: ["libpcap_defaults"], |
| 83 | gtest: false, |
| 84 | // (Matches order in libpcap's Makefile.) |
| 85 | srcs: [ |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 86 | "testprogs/can_set_rfmon_test.c", |
| 87 | "testprogs/capturetest.c", |
| 88 | "testprogs/filtertest.c", |
| 89 | "testprogs/findalldevstest.c", |
| 90 | "testprogs/opentest.c", |
| 91 | "testprogs/reactivatetest.c", |
| 92 | "testprogs/selpolltest.c", |
| 93 | "testprogs/threadsignaltest.c", |
| 94 | "testprogs/valgrindtest.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 95 | ], |
| 96 | static_libs: ["libpcap"], |
| 97 | test_per_src: true, |
| 98 | } |