blob: 68a795932ce3a2dd11ca1627be49db1313118806 [file] [log] [blame]
Dan Willemsen0554d4e2017-09-09 13:04:09 -07001commonLibs = [
2 "libcutils",
3 "liblog",
4]
5
6cc_defaults {
7 name: "mdnsresponder_default_cflags",
8
9 cflags: [
10 "-O2",
11 "-g",
12 "-fno-strict-aliasing",
13 "-fwrapv",
14 "-D_GNU_SOURCE",
15 "-DHAVE_IPV6",
16 "-DNOT_HAVE_SA_LEN",
17 "-DPLATFORM_NO_RLIMIT",
18 "-DMDNS_DEBUGMSGS=0",
19 "-DMDNS_UDS_SERVERPATH=\"/dev/socket/mdnsd\"",
20 "-DMDNS_USERNAME=\"mdnsr\"",
21 "-W",
22 "-Wall",
23 "-Wextra",
24 "-Wno-address-of-packed-member",
25 "-Wno-array-bounds",
26 "-Wno-pointer-sign",
27 "-Wno-unused",
28 "-Wno-unused-but-set-variable",
29 "-Wno-unused-parameter",
30 "-Werror=implicit-function-declaration",
31 ],
32 target: {
Dan Willemsenee691b02017-10-03 14:16:44 -070033 linux: {
Dan Willemsen0554d4e2017-09-09 13:04:09 -070034 cflags: [
35 "-DTARGET_OS_LINUX",
36 "-DHAVE_LINUX",
37 "-DUSES_NETLINK",
Chih-Hung Hsiehc4dfad22017-09-28 15:35:05 -070038 "-Werror",
Dan Willemsen0554d4e2017-09-09 13:04:09 -070039 ],
40 },
41 darwin: {
Chih-Hung Hsieh56a3eeb2017-11-20 16:20:14 -080042 cflags: [
43 "-DTARGET_OS_MAC",
44 "-Wno-error",
45 ],
Dan Willemsen0554d4e2017-09-09 13:04:09 -070046 },
47 windows: {
48 enabled: true,
49 cflags: [
50 "-DTARGET_OS_WINDOWS",
51 "-DWIN32",
52 "-DNDEBUG",
53 "-D_WIN32_LEAN_AND_MEAN",
54 "-DUSE_TCP_LOOPBACK",
55 "-D_CRT_SECURE_NO_DEPRECATE",
56 "-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1",
Chih-Hung Hsieh56a3eeb2017-11-20 16:20:14 -080057 "-Wno-error",
Dan Willemsen0554d4e2017-09-09 13:04:09 -070058 "-Wno-sign-compare",
59 "-include stdint.h",
60 "-include winsock2.h",
61 "-include ws2ipdef.h",
62 "-include wincrypt.h",
63 "-include netioapi.h",
64 ],
65 local_include_dirs: [
66 "mDNSWindows",
67 "android/caseMapping",
68 ],
69 },
70 },
71}
72
73cc_binary {
74 name: "mdnsd",
75 defaults: ["mdnsresponder_default_cflags"],
76 host_supported: true,
77 srcs: [
78 "mDNSCore/mDNS.c",
79 "mDNSCore/DNSDigest.c",
80 "mDNSCore/uDNS.c",
81 "mDNSCore/DNSCommon.c",
82 "mDNSShared/uds_daemon.c",
83 "mDNSShared/mDNSDebug.c",
84 "mDNSShared/dnssd_ipc.c",
85 "mDNSShared/GenLinkedList.c",
86 ],
87
88 local_include_dirs: [
89 "mDNSCore",
90 "mDNSShared",
91 ],
92 init_rc: ["mdnsd.rc"],
93
94 cflags: ["-DMDNS_VERSIONSTR_NODTS=1"],
95
96 target: {
97 android: {
98 static_executable: true,
99 local_include_dirs: ["mDNSPosix"],
100 srcs: [
101 "mDNSShared/PlatformCommon.c",
102 "mDNSPosix/PosixDaemon.c",
103 "mDNSPosix/mDNSPosix.c",
104 "mDNSPosix/mDNSUNP.c",
105 ],
106 },
107 not_windows: {
108 local_include_dirs: ["mDNSPosix"],
109 srcs: [
110 "mDNSShared/PlatformCommon.c",
111 "mDNSPosix/PosixDaemon.c",
112 "mDNSPosix/mDNSPosix.c",
113 "mDNSPosix/mDNSUNP.c",
114 ],
115 },
116 windows: {
117 cflags: [
118 "-DTARGET_OS_WIN32",
119 "-D_CONSOLE",
120 "-DPLATFORM_NO_STRSEP",
121 "-DPLATFORM_NO_EPIPE",
122 "-DPLATFORM_NO_RLIMIT",
123 "-DPID_FILE=\"\"",
124 "-DUNICODE",
125 "-D_UNICODE",
126 "-D_LEGACY_NAT_TRAVERSAL",
127 "-Wno-empty-body",
128 ],
129
130 ldflags: ["-municode"],
131 host_ldlibs: [
132 "-lws2_32",
133 "-liphlpapi",
134 "-lpowrprof",
135 "-lnetapi32",
136 ],
137
138 srcs: [
139 "mDNSWindows/SystemService/main.c",
140 "mDNSWindows/SystemService/Service.c",
141 "mDNSWindows/SystemService/EventLog.mc",
142 "mDNSWindows/Secret.c",
143 "mDNSWindows/mDNSWin32.c",
144 "mDNSShared/DebugServices.c",
145 "android/windows_firewall_dummy.c",
146 ],
147
148 local_include_dirs: [
149 "mDNSWindows/SystemService",
150 ],
151 },
152 },
153
154 static_libs: commonLibs,
155}
156
157//#########################
158
159cc_library {
160 name: "libmdnssd",
161 defaults: ["mdnsresponder_default_cflags"],
162 host_supported: true,
163 srcs: [
164 "mDNSShared/dnssd_clientlib.c",
165 "mDNSShared/dnssd_clientstub.c",
166 "mDNSShared/dnssd_ipc.c",
167 ],
168
169 target: {
170 host: {
171 shared: {
172 enabled: false,
173 },
174 },
175 windows: {
176 srcs: ["mDNSWindows/DLL/dllmain.c"],
177
178 cflags: [
179 "-D_WINDOWS",
180 "-D_USERDLL",
181 "-D_MDNS_DEBUGMSGS=0",
182 "-D_SSIZE_T",
183 "-DNOT_HAVE_SA_LENGTH",
184 "-Wno-unknown-pragmas",
185 "-Wno-overflow",
186 "-include iphlpapi.h",
187 "-include stdlib.h",
188 "-include stdio.h",
189 ],
190 },
191 },
192
193 export_include_dirs: ["mDNSShared"],
194
195 static_libs: commonLibs,
196}
197
198//###########################
199
200cc_binary {
201 name: "dnssd",
202 defaults: ["mdnsresponder_default_cflags"],
203 srcs: [
204 "Clients/dns-sd.c",
205 "Clients/ClientCommon.c",
206 ],
207
Dan Willemsenc58b76f2017-09-11 19:30:04 -0700208 system_shared_libs: ["libc", "libdl"],
Dan Willemsen0554d4e2017-09-09 13:04:09 -0700209 shared_libs: [
210 "libmdnssd",
211 "libcutils",
212 "liblog",
213 ],
214}