blob: eb0ea103e330c682626a2e2f71fff5e5dfb256b5 [file] [log] [blame]
Elliott Hughes22ad79b2018-04-10 22:44:35 -07001// 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
15cc_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
33cc_library {
34 name: "libpcap",
Aaron Huange7597b82018-11-16 20:18:03 +080035 host_supported: true,
Elliott Hughes22ad79b2018-04-10 22:44:35 -070036 vendor_available: true,
Lorenzo Colitti738c96f2020-02-03 12:34:27 +090037 // 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 Hughes22ad79b2018-04-10 22:44:35 -070042 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 Hughes22ad79b2018-04-10 22:44:35 -070051 "gencode.c",
52 "optimize.c",
53 "nametoaddr.c",
54 "etherent.c",
Haibo Huang165065a2018-07-23 17:26:52 -070055 "fmtutils.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070056 "savefile.c",
57 "sf-pcap.c",
Haibo Huang165065a2018-07-23 17:26:52 -070058 "sf-pcapng.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070059 "pcap-common.c",
60 "bpf_image.c",
Haibo Huang165065a2018-07-23 17:26:52 -070061 "bpf_filter.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070062 "bpf_dump.c",
63 "scanner.c",
64 "grammar.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070065 ],
66
Aaron Huange7597b82018-11-16 20:18:03 +080067 target: {
68 darwin: {
69 enabled: false,
70 },
71 },
72
Elliott Hughes22ad79b2018-04-10 22:44:35 -070073 export_include_dirs: ["."],
74}
75
76//
77// Tests.
78//
79
80cc_test {
81 name: "libpcap_test",
82 defaults: ["libpcap_defaults"],
83 gtest: false,
84 // (Matches order in libpcap's Makefile.)
85 srcs: [
Haibo Huang165065a2018-07-23 17:26:52 -070086 "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 Hughes22ad79b2018-04-10 22:44:35 -070095 ],
96 static_libs: ["libpcap"],
97 test_per_src: true,
98}