1cc_defaults {
2    name: "clatd_defaults",
3
4    cflags: [
5        "-Wall",
6        "-Werror",
7        "-Wunused-parameter",
8
9        // Bug: http://b/33566695
10        "-Wno-address-of-packed-member",
11    ],
12
13    // For NETID_UNSET and MARK_UNSET.
14    include_dirs: ["bionic/libc/dns/include"],
15
16    // For NETID_USE_LOCAL_NAMESERVERS.
17    header_libs: ["libnetd_client_headers"],
18}
19
20// Code used both by the daemon and by unit tests.
21filegroup {
22    name: "clatd_common",
23    srcs: [
24        "config.c",
25        "clatd.c",
26        "dns64.c",
27        "dump.c",
28        "getaddr.c",
29        "icmp.c",
30        "ipv4.c",
31        "ipv6.c",
32        "logging.c",
33        "mtu.c",
34        "netlink_callbacks.c",
35        "netlink_msg.c",
36        "ring.c",
37        "setif.c",
38        "translate.c",
39    ],
40}
41
42// The clat daemon.
43cc_binary {
44    name: "clatd",
45    defaults: ["clatd_defaults"],
46    srcs: [
47        ":clatd_common",
48        "main.c"
49    ],
50    static_libs: ["libnl"],
51    shared_libs: [
52        "libcutils",
53        "liblog",
54        "libnetutils",
55    ],
56
57    // Only enable clang-tidy for the daemon, not the tests, because enabling it for the
58    // tests substantially increases build/compile cycle times and doesn't really provide a
59    // security benefit.
60    tidy: true,
61    tidy_checks: [
62        "-*",
63        "cert-*",
64        "clang-analyzer-security*",
65        "android-*",
66    ],
67    tidy_flags: [
68        "-warnings-as-errors=clang-analyzer-security*,cert-*,android-*",
69    ],
70}
71
72// The configuration file.
73prebuilt_etc {
74    name: "clatd.conf",
75    src: "clatd.conf",
76}
77
78// Unit tests.
79cc_test {
80    name: "clatd_test",
81    defaults: ["clatd_defaults"],
82    srcs: [
83        ":clatd_common",
84        "clatd_test.cpp"
85    ],
86    static_libs: [
87        "libbase",
88        "libnetd_test_tun_interface",
89        "libnl",
90    ],
91    shared_libs: [
92        "libcutils",
93        "liblog",
94        "libnetutils",
95    ],
96    test_suites: ["device-tests"],
97}
98
99// Microbenchmark.
100cc_test {
101    name: "clatd_microbenchmark",
102    defaults: ["clatd_defaults"],
103    srcs: [
104        "clatd_microbenchmark.c",
105        "tun.c",
106    ],
107    shared_libs: [
108        "libnetutils",
109    ],
110}
111