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
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",
35    host_supported: true,
36    vendor_available: true,
37    defaults: ["libpcap_defaults"],
38
39    // (Matches order in libpcap's Makefile.)
40    srcs: [
41        "pcap-linux.c",
42        "pcap-usb-linux.c",
43        "pcap-netfilter-linux-android.c",
44        "fad-getad.c",
45        "pcap.c",
46        "gencode.c",
47        "optimize.c",
48        "nametoaddr.c",
49        "etherent.c",
50        "fmtutils.c",
51        "savefile.c",
52        "sf-pcap.c",
53        "sf-pcapng.c",
54        "pcap-common.c",
55        "bpf_image.c",
56        "bpf_filter.c",
57        "bpf_dump.c",
58        "scanner.c",
59        "grammar.c",
60    ],
61
62    target: {
63        darwin: {
64            enabled: false,
65        },
66    },
67
68    export_include_dirs: ["."],
69}
70
71//
72// Tests.
73//
74
75cc_test {
76    name: "libpcap_test",
77    defaults: ["libpcap_defaults"],
78    gtest: false,
79    // (Matches order in libpcap's Makefile.)
80    srcs: [
81        "testprogs/can_set_rfmon_test.c",
82        "testprogs/capturetest.c",
83        "testprogs/filtertest.c",
84        "testprogs/findalldevstest.c",
85        "testprogs/opentest.c",
86        "testprogs/reactivatetest.c",
87        "testprogs/selpolltest.c",
88        "testprogs/threadsignaltest.c",
89        "testprogs/valgrindtest.c",
90    ],
91    static_libs: ["libpcap"],
92    test_per_src: true,
93}
94