3 GENKEY=\"/usr/local/bin/mbedtls_gen_key\"
4 CERTWRITE=\"/usr/local/bin/mbedtls_cert_write\"
7 SYSTEM := $(shell uname -s)
8 ifeq ($(SYSTEM), Darwin)
10 else ifeq ($(SYSTEM), Linux)
11 os_id := $(shell sed -n -e 's/^ID=//p' < /etc/os-release)
12 ifeq ($(os_id), raspbian)
21 INSTALL_PREFIX=$(INSTBASE)
23 INSTALL_PREFIX=$(DESTDIR)/usr
29 SRPCFLAGS = -O0 -g -Wall -Werror -I../mDNSCore -I/usr/local/include -I. -I../mDNSShared -I../DSO -MMD -MF .depfile-${notdir $<} -DUSE_KQUEUE -DHAVE_SOCKADDR_DL -DGENKEY_PROGRAM=$(GENKEY) -DCERTWRITE_PROGRAM=$(CERTWRITE) -DEXCLUDE_TLS -D__APPLE_USE_RFC_3542 -DIOLOOP_MACOS
30 SRPLDOPTS = -framework CoreServices -framework Security -framework CoreFoundation -framework Network
31 HMACOBJS = $(OBJDIR)/hmac-macos.o
32 SIGNOBJS = $(OBJDIR)/sign-macos.o
33 VERIFYOBJS = $(OBJDIR)/verify-macos.o
35 IOOBJS = $(OBJDIR)/macos-ioloop.o $(OBJDIR)/posix.o
36 IOWOTLSOBJS = $(OBJDIR)/macos-ioloop.o $(OBJDIR)/posix.o
37 else ifeq ($(os), linux)
38 SRPCFLAGS = -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -O0 -g -Wall -Werror -DSTANDALONE -I../mDNSCore -I/usr/local/include -I. -I../mDNSShared -I../DSO -MMD -MF .depfile-${notdir $<} -DNOT_HAVE_SA_LEN -DUSE_SELECT -DUSE_INOTIFY -DGENKEY_PROGRAM=$(GENKEY) -DCERTWRITE_PROGRAM=$(CERTWRITE) -DNO_KEYCHAIN
39 SRPLDOPTS = /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedx509.a /usr/local/lib/libmbedcrypto.a
40 #SRPLDOPTS = -lmbedcrypto -lmbedtls -lmbedx509
41 HMACOBJS = $(OBJDIR)/hmac-mbedtls.o
42 SIGNOBJS = $(OBJDIR)/sign-mbedtls.o
43 VERIFYOBJS = $(OBJDIR)/verify-mbedtls.o
44 TLSOBJS = $(OBJDIR)/tls-mbedtls.o
45 IOOBJS = $(OBJDIR)/ioloop.o $(TLSOBJS)
46 IOWOTLSOBJS = $(OBJDIR)/ioloop-notls.o
47 else ifeq ($(os), linux-uclibc)
48 SRPCFLAGS = -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -O0 -g -Wall -Werror -DSTANDALONE -I../mDNSCore -I/usr/local/include -I. -I../mDNSShared -I../DSO -MMD -MF .depfile-${notdir $<} -DNOT_HAVE_SA_LEN -DUSE_SELECT -DLINUX_GETENTROPY -DGENKEY_PROGRAM=$(GENKEY) -DCERTWRITE_PROGRAM=$(CERTWRITE) -DNO_KEYCHAIN
49 SRPLDOPTS = -lmbedcrypto -lmbedtls -lmbedx509
50 HMACOBJS = $(OBJDIR)/hmac-mbedtls.o
51 SIGNOBJS = $(OBJDIR)/sign-mbedtls.o
52 VERIFYOBJS = $(OBJDIR)/verify-mbedtls.o
53 TLSOBJS = $(OBJDIR)/tls-mbedtls.o
54 IOOBJS = $(OBJDIR)/ioloop.o $(TLSOBJS)
55 IOWOTLSOBJS = $(OBJDIR)/ioloop-notls.o
56 else ifeq ($(os), raspbian)
57 SRPCFLAGS = -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -O0 -g -Wall -Werror -DSTANDALONE -I../mDNSCore -I/usr/local/include -I. -I../mDNSShared -I../DSO -MMD -MF .depfile-${notdir $<} -DNOT_HAVE_SA_LEN -DUSE_SELECT -DLINUX_GETENTROPY -DGENKEY_PROGRAM=$(GENKEY) -DCERTWRITE_PROGRAM=$(CERTWRITE) -DNO_KEYCHAIN
58 SRPLDOPTS = /usr/local/lib/libmbedtls.a /usr/local/lib/libmbedx509.a /usr/local/lib/libmbedcrypto.a
59 HMACOBJS = $(OBJDIR)/hmac-mbedtls.o
60 SIGNOBJS = $(OBJDIR)/sign-mbedtls.o
61 VERIFYOBJS = $(OBJDIR)/verify-mbedtls.o
62 TLSOBJS = $(OBJDIR)/tls-mbedtls.o
63 IOOBJS = $(OBJDIR)/ioloop.o $(TLSOBJS)
64 IOWOTLSOBJS = $(OBJDIR)/ioloop-notls.o
66 SRPCFLAGS=$(os) $(os_id)
69 all: setup $(BUILDDIR)/srp-client $(BUILDDIR)/srp-mdns-proxy $(BUILDDIR)/keydump $(BUILDDIR)/dnssd-proxy $(BUILDDIR)/srp-dns-proxy # $(BUILDDIR)/dnssd-relay
72 $(CP) $(BUILDDIR)/srp-client $(INSTALL_PREFIX)/sbin
73 $(CP) $(BUILDDIR)/srp-dns-proxy $(INSTALL_PREFIX)/sbin
74 $(CP) $(BUILDDIR)/srp-mdns-proxy $(INSTALL_PREFIX)/sbin
75 $(CP) $(BUILDDIR)/dnssd-proxy $(INSTALL_PREFIX)/sbin
76 $(CP) $(BUILDDIR)/keydump $(INSTALL_PREFIX)/bin
78 # 'setup' sets up the build directory structure the way we want
80 @if test ! -d $(OBJDIR) ; then mkdir -p $(OBJDIR) ; fi
81 @if test ! -d $(BUILDDIR) ; then mkdir -p $(BUILDDIR) ; fi
83 # clean removes targets and objects
85 @if test -d $(OBJDIR) ; then rm -r $(OBJDIR) ; fi
86 @if test -d $(BUILDDIR) ; then rm -r $(BUILDDIR) ; fi
88 SIMPLEOBJS = $(OBJDIR)/towire.o $(SIGNOBJS)
89 DSOOBJS = $(OBJDIR)/dso.o
90 MDNSOBJS = $(OBJDIR)/dnssd_clientstub.o $(OBJDIR)/dnssd_ipc.o
91 FROMWIREOBJS = $(OBJDIR)/fromwire.o $(VERIFYOBJS) $(OBJDIR)/wireutils.o
92 CFOBJS = $(OBJDIR)/config-parse.o
94 $(BUILDDIR)/dnssd-relay: $(OBJDIR)/dnssd-relay.o $(DSOOBJS) $(IOOBJS) $(CFOBJS)
95 $(CC) -o $@ $+ $(SRPLDOPTS)
97 $(BUILDDIR)/dnssd-proxy: $(OBJDIR)/dnssd-proxy.o $(SIMPLEOBJS) $(DSOOBJS) $(MDNSOBJS) $(FROMWIREOBJS) $(IOOBJS) $(CFOBJS)
98 $(CC) -o $@ $+ $(SRPLDOPTS)
100 $(BUILDDIR)/srp-client: $(OBJDIR)/srp-ioloop.o $(OBJDIR)/srp-client.o $(SIMPLEOBJS) $(IOWOTLSOBJS) $(CFOBJS)
101 $(CC) -o $@ $+ $(SRPLDOPTS)
103 $(BUILDDIR)/srp-dns-proxy: $(OBJDIR)/srp-dns-proxy.o $(OBJDIR)/srp-parse.o $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS) $(HMACOBJS) $(CFOBJS)
104 $(CC) -o $@ $+ $(SRPLDOPTS)
106 $(BUILDDIR)/srp-mdns-proxy: $(OBJDIR)/srp-mdns-proxy.o $(OBJDIR)/srp-parse.o $(MDNSOBJS) $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS) $(HMACOBJS) $(CFOBJS)
107 $(CC) -o $@ $+ $(SRPLDOPTS)
109 $(BUILDDIR)/keydump: $(OBJDIR)/keydump.o $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS)
110 $(CC) -o $@ $+ $(SRPLDOPTS)
112 $(OBJDIR)/dso.o: ../DSO/dso.c
113 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
115 $(OBJDIR)/dnssd_clientstub.o: ../mDNSShared/dnssd_clientstub.c
116 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
118 $(OBJDIR)/dnssd_ipc.o: ../mDNSShared/dnssd_ipc.c
119 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
121 $(OBJDIR)/ioloop-notls.o: ioloop.c
122 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -DEXCLUDE_TLS -c $<
125 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c $<
127 -include .depfile-config-parse.c
128 -include .depfile-dnssd-proxy.c
129 -include .depfile-dnssd_clientstub.c
130 -include .depfile-dnssd_ipc.c
131 -include .depfile-dso.c
132 -include .depfile-fromwire.c
133 -include .depfile-hmac-mbedtls.c
134 -include .depfile-hmac-macos.c
135 -include .depfile-ioloop.c
136 -include .depfile-keydump.c
137 -include .depfile-sign-mbedtls.c
138 -include .depfile-sign-macos.c
139 -include .depfile-srp-client.c
140 -include .depfile-srp-dns-proxy.c
141 -include .depfile-srp-ioloop.c
142 -include .depfile-srp-mdns-proxy.c
143 -include .depfile-srp-parse.c
144 -include .depfile-tls-mbedtls.c
145 -include .depfile-towire.c
146 -include .depfile-verify-mbedtls.c
147 -include .depfile-verify-macos.c
148 -include .depfile-wireutils.c