1LOCAL_PATH := $(call my-dir) 2 3commonSources := \ 4 mDNSShared/dnssd_clientlib.c \ 5 mDNSShared/dnssd_clientstub.c \ 6 mDNSShared/dnssd_ipc.c 7 8commonLibs := libcutils liblog 9 10commonFlags := \ 11 -O2 -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 32daemonSources := mDNSCore/mDNS.c \ 33 mDNSCore/DNSDigest.c \ 34 mDNSCore/uDNS.c \ 35 mDNSCore/DNSCommon.c \ 36 mDNSShared/uds_daemon.c \ 37 mDNSShared/mDNSDebug.c \ 38 mDNSShared/dnssd_ipc.c \ 39 mDNSShared/GenLinkedList.c \ 40 mDNSShared/PlatformCommon.c \ 41 mDNSPosix/PosixDaemon.c \ 42 mDNSPosix/mDNSPosix.c \ 43 mDNSPosix/mDNSUNP.c 44 45daemonIncludes := external/mdnsresponder/mDNSCore \ 46 external/mdnsresponder/mDNSShared \ 47 external/mdnsresponder/mDNSPosix 48 49######################### 50 51include $(CLEAR_VARS) 52LOCAL_SRC_FILES := $(daemonSources) 53LOCAL_MODULE := mdnsd 54LOCAL_MODULE_TAGS := optional 55 56LOCAL_C_INCLUDES := $(daemonIncludes) 57 58LOCAL_CFLAGS := \ 59 $(commonFlags) \ 60 -DTARGET_OS_LINUX \ 61 -DMDNS_VERSIONSTR_NODTS=1 \ 62 -DHAVE_LINUX \ 63 -DUSES_NETLINK \ 64 65LOCAL_STATIC_LIBRARIES := $(commonLibs) libc 66LOCAL_FORCE_STATIC_EXECUTABLE := true 67LOCAL_INIT_RC := mdnsd.rc 68include $(BUILD_EXECUTABLE) 69 70include $(CLEAR_VARS) 71LOCAL_SRC_FILES := $(daemonSources) 72LOCAL_MODULE := mdnsd 73LOCAL_MODULE_TAGS := optional 74 75LOCAL_C_INCLUDES := $(daemonIncludes) 76 77LOCAL_CFLAGS := \ 78 $(commonFlags) \ 79 -DMDNS_VERSIONSTR_NODTS=1 \ 80 81LOCAL_CFLAGS_linux := -DTARGET_OS_LINUX -DHAVE_LINUX -DUSES_NETLINK 82LOCAL_CFLAGS_darwin := -DTARGET_OS_MAC 83 84LOCAL_STATIC_LIBRARIES := $(commonLibs) 85include $(BUILD_HOST_EXECUTABLE) 86 87include $(CLEAR_VARS) 88LOCAL_SRC_FILES := \ 89 mDNSWindows/SystemService/main.c \ 90 mDNSWindows/SystemService/Service.c \ 91 mDNSWindows/Secret.c \ 92 mDNSWindows/mDNSWin32.c \ 93 mDNSShared/dnssd_ipc.c \ 94 mDNSShared/uds_daemon.c \ 95 mDNSShared/mDNSDebug.c \ 96 mDNSShared/GenLinkedList.c \ 97 mDNSShared/DebugServices.c \ 98 mDNSCore/DNSDigest.c \ 99 mDNSCore/DNSCommon.c \ 100 mDNSCore/uDNS.c \ 101 mDNSCore/mDNS.c \ 102 android/windows_firewall_dummy.c 103 104LOCAL_MODULE := mdnsd 105LOCAL_MODULE_TAGS := optional 106LOCAL_MODULE_CLASS := EXECUTABLES 107 108mdnsd_generated_sources := $(call local-generated-sources-dir) 109event_log_h := $(mdnsd_generated_sources)/EventLog.h 110event_log_o := $(mdnsd_generated_sources)/EventLog.o 111event_log_rc := $(mdnsd_generated_sources)/EventLog.rc 112 113event_log_mc := external/mdnsresponder/mDNSWindows/SystemService/EventLog.mc 114mingw_bin := prebuilts/gcc/$(HOST_PREBUILT_TAG)/host/x86_64-w64-mingw32-4.8/bin 115windmc := $(mingw_bin)/x86_64-w64-mingw32-windmc 116windres := $(mingw_bin)/x86_64-w64-mingw32-windres 117 118$(event_log_h) $(event_log_o): $(event_log_mc) 119 @echo "Generating EventLog messages" 120 @mkdir -p $(mdnsd_generated_sources) 121 @$(windmc) -r$(mdnsd_generated_sources) -h$(mdnsd_generated_sources) $< 122 @$(windres) -F pe-i386 -I$(mdnsd_generated_sources) $(event_log_rc) $(event_log_o) 123 124LOCAL_GENERATED_SOURCES := \ 125 $(mdnsd_generated_sources)/EventLog.h \ 126 $(mdnsd_generated_sources)/EventLog.o 127 128LOCAL_C_INCLUDES := \ 129 external/mdnsresponder/mDNSShared \ 130 external/mdnsresponder/mDNSCore \ 131 external/mdnsresponder/mDNSWindows/SystemService \ 132 external/mdnsresponder/mDNSWindows \ 133 external/mdnsresponder/android/caseMapping \ 134 $(mdnsd_generated_sources) 135 136LOCAL_CFLAGS := $(commonFlags) \ 137 -DMDNS_VERSIONSTR_NODTS=1 \ 138 -DTARGET_OS_WINDOWS \ 139 -DTARGET_OS_WIN32 \ 140 -DWIN32 \ 141 -DNDEBUG \ 142 -D_CONSOLE \ 143 -D_WIN32_LEAN_AND_MEAN \ 144 -DUSE_TCP_LOOPBACK \ 145 -DPLATFORM_NO_STRSEP \ 146 -DPLATFORM_NO_EPIPE \ 147 -DPLATFORM_NO_RLIMIT \ 148 -DPID_FILE='""' \ 149 -DUNICODE \ 150 -D_UNICODE \ 151 -D_CRT_SECURE_NO_DEPRECATE \ 152 -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 \ 153 -D_LEGACY_NAT_TRAVERSAL \ 154 -include stdint.h \ 155 -include winsock2.h \ 156 -include ws2ipdef.h \ 157 -include wincrypt.h \ 158 -include netioapi.h \ 159 -Wno-sign-compare \ 160 -Wno-empty-body 161 162LOCAL_LDFLAGS := -lws2_32 -liphlpapi -lpowrprof -lnetapi32 -municode 163 164 165LOCAL_MODULE_HOST_OS := windows 166 167LOCAL_STATIC_LIBRARIES := $(commonLibs) 168include $(BUILD_HOST_EXECUTABLE) 169########################## 170 171include $(CLEAR_VARS) 172LOCAL_SRC_FILES := $(commonSources) 173LOCAL_MODULE := libmdnssd 174LOCAL_MODULE_TAGS := optional 175LOCAL_CFLAGS := $(commonFlags) -DTARGET_OS_LINUX -DHAVE_LINUX -DUSES_NETLINK 176LOCAL_SYSTEM_SHARED_LIBRARIES := libc 177LOCAL_SHARED_LIBRARIES := $(commonLibs) 178LOCAL_EXPORT_C_INCLUDE_DIRS := external/mdnsresponder/mDNSShared 179include $(BUILD_SHARED_LIBRARY) 180 181include $(CLEAR_VARS) 182LOCAL_SRC_FILES := $(commonSources) 183LOCAL_MODULE := libmdnssd 184LOCAL_MODULE_TAGS := optional 185LOCAL_CFLAGS := $(commonFlags) -DTARGET_OS_LINUX -DHAVE_LINUX -DUSES_NETLINK 186LOCAL_STATIC_LIBRARIES := $(commonLibs) 187LOCAL_EXPORT_C_INCLUDE_DIRS := external/mdnsresponder/mDNSShared 188include $(BUILD_STATIC_LIBRARY) 189 190include $(CLEAR_VARS) 191LOCAL_SRC_FILES := $(commonSources) 192LOCAL_SRC_FILES_windows := mDNSWindows/DLL/dllmain.c 193LOCAL_MODULE := libmdnssd 194LOCAL_MODULE_TAGS := optional 195LOCAL_CFLAGS := $(commonFlags) 196LOCAL_CFLAGS_windows := \ 197 -DTARGET_OS_WINDOWS \ 198 -DWIN32 \ 199 -DNDEBUG \ 200 -D_WINDOWS \ 201 -D_USERDLL \ 202 -D_MDNS_DEBUGMSGS=0 \ 203 -D_WIN32_LEAN_AND_MEAN \ 204 -D_SSIZE_T \ 205 -DUSE_TCP_LOOPBACK \ 206 -D_CRT_SECURE_NO_DEPRECATE \ 207 -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 \ 208 -DNOT_HAVE_SA_LENGTH \ 209 -Wno-unknown-pragmas \ 210 -Wno-sign-compare \ 211 -Wno-overflow \ 212 -include stdint.h \ 213 -include winsock2.h \ 214 -include ws2ipdef.h \ 215 -include wincrypt.h \ 216 -include iphlpapi.h \ 217 -include netioapi.h \ 218 -include stdlib.h \ 219 -include stdio.h 220 221LOCAL_CFLAGS_linux := -DTARGET_OS_LINUX -DHAVE_LINUX -DUSES_NETLINK 222LOCAL_CFLAGS_darwin := -DTARGET_OS_MAC 223LOCAL_STATIC_LIBRARIES := $(commonLibs) 224LOCAL_EXPORT_C_INCLUDE_DIRS := external/mdnsresponder/mDNSShared 225LOCAL_C_INCLUDES_windows := external/mdnsresponder/mDNSShared external/mdnsresponder/mDNSWindows 226LOCAL_C_INCLUDES_windows += external/mdnsresponder/android/caseMapping 227LOCAL_MODULE_HOST_OS := darwin linux windows 228include $(BUILD_HOST_STATIC_LIBRARY) 229 230############################ 231 232include $(CLEAR_VARS) 233LOCAL_SRC_FILES := Clients/dns-sd.c Clients/ClientCommon.c 234LOCAL_MODULE := dnssd 235LOCAL_MODULE_TAGS := optional 236LOCAL_CFLAGS := $(commonFlags) -DTARGET_OS_LINUX -DHAVE_LINUX -DUSES_NETLINK 237LOCAL_SYSTEM_SHARED_LIBRARIES := libc 238LOCAL_SHARED_LIBRARIES := libmdnssd libcutils liblog 239include $(BUILD_EXECUTABLE) 240 241############################ 242# This builds an mDns that is embeddable within GmsCore for the nearby connections API 243 244### STATIC LIB ### 245include $(CLEAR_VARS) 246 247LOCAL_SDK_VERSION := 8 248LOCAL_MODULE := libmdns_jni_static 249LOCAL_SRC_FILES := /mDNSCore/mDNS.c \ 250 /mDNSCore/DNSDigest.c \ 251 /mDNSCore/uDNS.c \ 252 /mDNSCore/DNSCommon.c \ 253 /mDNSPosix/mDNSPosix.c \ 254 /mDNSPosix/mDNSUNP.c \ 255 /mDNSShared/mDNSDebug.c \ 256 /mDNSShared/dnssd_clientlib.c \ 257 /mDNSShared/dnssd_clientshim.c \ 258 /mDNSShared/dnssd_ipc.c \ 259 /mDNSShared/GenLinkedList.c \ 260 /mDNSShared/PlatformCommon.c 261 262LOCAL_C_INCLUDES := external/mdnsresponder/mDNSPosix \ 263 external/mdnsresponder/mDNSCore \ 264 external/mdnsresponder/mDNSShared 265 266LOCAL_CFLAGS += -Os -fvisibility=hidden 267LOCAL_CFLAGS += $(commonFlags) \ 268 -UMDNS_DEBUGMSGS \ 269 -DMDNS_DEBUGMSGS=0 \ 270 -DSO_REUSEADDR \ 271 -DUNICAST_DISABLED \ 272 -DTARGET_OS_LINUX \ 273 -DHAVE_LINUX \ 274 -DUSES_NETLINK 275 276ifeq ($(TARGET_BUILD_TYPE),debug) 277 LOCAL_CFLAGS += -O0 -UNDEBUG -fno-omit-frame-pointer 278endif 279 280include $(BUILD_STATIC_LIBRARY) 281