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    -D_GNU_SOURCE \
14    -DHAVE_IPV6 \
15    -DHAVE_LINUX \
16    -DNOT_HAVE_SA_LEN \
17    -DPLATFORM_NO_RLIMIT \
18    -DTARGET_OS_LINUX \
19    -DUSES_NETLINK \
20    -DMDNS_DEBUGMSGS=0 \
21    -DMDNS_UDS_SERVERPATH=\"/dev/socket/mdnsd\" \
22    -DMDNS_USERNAME=\"mdnsr\" \
23    -W \
24    -Wall \
25    -Wextra \
26    -Wno-array-bounds \
27    -Wno-pointer-sign \
28    -Wno-unused \
29    -Wno-unused-but-set-variable \
30    -Wno-unused-parameter \
31    -Werror=implicit-function-declaration \
32
33#########################
34
35include $(CLEAR_VARS)
36LOCAL_SRC_FILES :=  mDNSPosix/PosixDaemon.c    \
37                    mDNSPosix/mDNSPosix.c      \
38                    mDNSPosix/mDNSUNP.c        \
39                    mDNSCore/mDNS.c            \
40                    mDNSCore/DNSDigest.c       \
41                    mDNSCore/uDNS.c            \
42                    mDNSCore/DNSCommon.c       \
43                    mDNSShared/uds_daemon.c    \
44                    mDNSShared/mDNSDebug.c     \
45                    mDNSShared/dnssd_ipc.c     \
46                    mDNSShared/GenLinkedList.c \
47                    mDNSShared/PlatformCommon.c
48
49LOCAL_MODULE := mdnsd
50LOCAL_MODULE_TAGS := optional
51
52LOCAL_C_INCLUDES := external/mdnsresponder/mDNSPosix \
53                    external/mdnsresponder/mDNSCore  \
54                    external/mdnsresponder/mDNSShared
55
56LOCAL_CFLAGS := $(commonFlags)
57
58LOCAL_STATIC_LIBRARIES := $(commonLibs) libc
59LOCAL_FORCE_STATIC_EXECUTABLE := true
60include $(BUILD_EXECUTABLE)
61
62##########################
63
64include $(CLEAR_VARS)
65LOCAL_SRC_FILES := $(commonSources)
66LOCAL_MODULE := libmdnssd
67LOCAL_MODULE_TAGS := optional
68LOCAL_CFLAGS := $(commonFlags)
69LOCAL_SYSTEM_SHARED_LIBRARIES := libc
70LOCAL_SHARED_LIBRARIES := $(commonLibs)
71LOCAL_EXPORT_C_INCLUDE_DIRS := external/mdnsresponder/mDNSShared
72include $(BUILD_SHARED_LIBRARY)
73
74include $(CLEAR_VARS)
75LOCAL_SRC_FILES := $(commonSources)
76LOCAL_MODULE := libmdnssd
77LOCAL_MODULE_TAGS := optional
78LOCAL_CFLAGS := $(commonFlags)
79LOCAL_STATIC_LIBRARIES := $(commonLibs)
80LOCAL_EXPORT_C_INCLUDE_DIRS := external/mdnsresponder/mDNSShared
81include $(BUILD_STATIC_LIBRARY)
82
83############################
84
85include $(CLEAR_VARS)
86LOCAL_SRC_FILES := Clients/dns-sd.c Clients/ClientCommon.c
87LOCAL_MODULE := dnssd
88LOCAL_MODULE_TAGS := optional
89LOCAL_CFLAGS := $(commonFlags)
90LOCAL_SYSTEM_SHARED_LIBRARIES := libc
91LOCAL_SHARED_LIBRARIES := libmdnssd libcutils liblog
92include $(BUILD_EXECUTABLE)
93
94############################
95# This builds an mDns that is embeddable within GmsCore for the nearby connections API
96
97### STATIC LIB ###
98include $(CLEAR_VARS)
99
100LOCAL_SDK_VERSION := 8
101LOCAL_MODULE    := libmdns_jni_static
102LOCAL_SRC_FILES :=  /mDNSCore/mDNS.c \
103                    /mDNSCore/DNSDigest.c \
104                    /mDNSCore/uDNS.c \
105                    /mDNSCore/DNSCommon.c \
106                    /mDNSPosix/mDNSPosix.c \
107                    /mDNSPosix/mDNSUNP.c \
108                    /mDNSShared/mDNSDebug.c \
109                    /mDNSShared/dnssd_clientlib.c \
110                    /mDNSShared/dnssd_clientshim.c \
111                    /mDNSShared/dnssd_ipc.c \
112                    /mDNSShared/GenLinkedList.c \
113                    /mDNSShared/PlatformCommon.c
114
115LOCAL_C_INCLUDES := external/mdnsresponder/mDNSPosix \
116                    external/mdnsresponder/mDNSCore  \
117                    external/mdnsresponder/mDNSShared
118
119LOCAL_CFLAGS += -Os -fvisibility=hidden
120LOCAL_CFLAGS += $(commonFlags) \
121                -UMDNS_DEBUGMSGS \
122                -DMDNS_DEBUGMSGS=0 \
123                -DSO_REUSEADDR \
124                -DUNICAST_DISABLED
125
126ifeq ($(TARGET_BUILD_TYPE),debug)
127  LOCAL_CFLAGS += -O0 -UNDEBUG -fno-omit-frame-pointer
128endif
129
130include $(BUILD_STATIC_LIBRARY)
131