blob: 1d21c2409f397fe98e7b91f9bd38fc6a00561697 [file] [log] [blame]
Lorenzo Colittieb92f482019-01-04 14:59:11 +09001cc_defaults {
2 name: "clatd_defaults",
Dan Willemsen1e562182018-11-16 12:52:08 -08003
4 cflags: [
5 "-Wall",
6 "-Werror",
7 "-Wunused-parameter",
8
9 // Bug: http://b/33566695
10 "-Wno-address-of-packed-member",
11 ],
12
Lorenzo Colittieb92f482019-01-04 14:59:11 +090013 // For NETID_UNSET and MARK_UNSET.
Dan Willemsen1e562182018-11-16 12:52:08 -080014 include_dirs: ["bionic/libc/dns/include"],
Lorenzo Colittieb92f482019-01-04 14:59:11 +090015
16 // For NETID_USE_LOCAL_NAMESERVERS.
Dan Willemsen1e562182018-11-16 12:52:08 -080017 header_libs: ["libnetd_client_headers"],
Lorenzo Colittieb92f482019-01-04 14:59:11 +090018}
19
20// Code used both by the daemon and by unit tests.
21filegroup {
22 name: "clatd_common",
23 srcs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +090024 "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",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090038 "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 ],
Dan Willemsen1e562182018-11-16 12:52:08 -080050 static_libs: ["libnl"],
51 shared_libs: [
52 "libcutils",
53 "liblog",
54 "libnetutils",
55 ],
Lorenzo Colitti6a095df2019-04-10 23:22:30 +090056
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 ],
Dan Willemsen1e562182018-11-16 12:52:08 -080070}
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",
Lorenzo Colittieb92f482019-01-04 14:59:11 +090081 defaults: ["clatd_defaults"],
Dan Willemsen1e562182018-11-16 12:52:08 -080082 srcs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +090083 ":clatd_common",
84 "clatd_test.cpp"
Dan Willemsen1e562182018-11-16 12:52:08 -080085 ],
Lorenzo Colittieb92f482019-01-04 14:59:11 +090086 static_libs: [
87 "libbase",
88 "libnetd_test_tun_interface",
89 "libnl",
90 ],
Dan Willemsen1e562182018-11-16 12:52:08 -080091 shared_libs: [
Lorenzo Colittieb92f482019-01-04 14:59:11 +090092 "libcutils",
Dan Willemsen1e562182018-11-16 12:52:08 -080093 "liblog",
94 "libnetutils",
95 ],
Lorenzo Colitti33351932019-01-04 19:36:51 +090096 test_suites: ["device-tests"],
Maciej Żenczykowski76f4b742019-09-19 14:38:34 -070097 require_root: true,
Dan Willemsen1e562182018-11-16 12:52:08 -080098}
99
100// Microbenchmark.
101cc_test {
102 name: "clatd_microbenchmark",
Lorenzo Colittieb92f482019-01-04 14:59:11 +0900103 defaults: ["clatd_defaults"],
Dan Willemsen1e562182018-11-16 12:52:08 -0800104 srcs: [
105 "clatd_microbenchmark.c",
Dan Willemsen1e562182018-11-16 12:52:08 -0800106 "tun.c",
107 ],
Lorenzo Colitti98de5952019-01-20 11:45:03 +0900108 shared_libs: [
109 "libnetutils",
110 ],
Dan Willemsen1e562182018-11-16 12:52:08 -0800111}