]> git.saurik.com Git - apple/mdnsresponder.git/blob - ServiceRegistration/Makefile
mDNSResponder-1310.40.42.tar.gz
[apple/mdnsresponder.git] / ServiceRegistration / Makefile
1 BUILDDIR = build
2 OBJDIR = objects
3 GENKEY=\"/usr/local/bin/mbedtls_gen_key\"
4 CERTWRITE=\"/usr/local/bin/mbedtls_cert_write\"
5
6 ifndef os
7 SYSTEM := $(shell uname -s)
8 ifeq ($(SYSTEM), Darwin)
9 os=x
10 else ifeq ($(SYSTEM), Linux)
11 os_id := $(shell sed -n -e 's/^ID=//p' < /etc/os-release)
12 ifeq ($(os_id), raspbian)
13 os=raspbian
14 else
15 os=linux
16 endif
17 endif
18 endif
19
20 ifdef INSTBASE
21 INSTALL_PREFIX=$(INSTBASE)
22 else
23 INSTALL_PREFIX=$(DESTDIR)/usr
24 endif
25
26 CP?=/bin/cp
27
28 ifeq ($(os),x)
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
34 TLSOBJS =
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
65 else
66 SRPCFLAGS=$(os) $(os_id)
67 endif
68
69 all: setup $(BUILDDIR)/srp-client $(BUILDDIR)/srp-mdns-proxy $(BUILDDIR)/keydump $(BUILDDIR)/dnssd-proxy $(BUILDDIR)/srp-dns-proxy # $(BUILDDIR)/dnssd-relay
70
71 install: all
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
77
78 # 'setup' sets up the build directory structure the way we want
79 setup:
80 @if test ! -d $(OBJDIR) ; then mkdir -p $(OBJDIR) ; fi
81 @if test ! -d $(BUILDDIR) ; then mkdir -p $(BUILDDIR) ; fi
82
83 # clean removes targets and objects
84 clean:
85 @if test -d $(OBJDIR) ; then rm -r $(OBJDIR) ; fi
86 @if test -d $(BUILDDIR) ; then rm -r $(BUILDDIR) ; fi
87
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
93
94 $(BUILDDIR)/dnssd-relay: $(OBJDIR)/dnssd-relay.o $(DSOOBJS) $(IOOBJS) $(CFOBJS)
95 $(CC) -o $@ $+ $(SRPLDOPTS)
96
97 $(BUILDDIR)/dnssd-proxy: $(OBJDIR)/dnssd-proxy.o $(SIMPLEOBJS) $(DSOOBJS) $(MDNSOBJS) $(FROMWIREOBJS) $(IOOBJS) $(CFOBJS)
98 $(CC) -o $@ $+ $(SRPLDOPTS)
99
100 $(BUILDDIR)/srp-client: $(OBJDIR)/srp-ioloop.o $(OBJDIR)/srp-client.o $(SIMPLEOBJS) $(IOWOTLSOBJS) $(CFOBJS)
101 $(CC) -o $@ $+ $(SRPLDOPTS)
102
103 $(BUILDDIR)/srp-dns-proxy: $(OBJDIR)/srp-dns-proxy.o $(OBJDIR)/srp-parse.o $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS) $(HMACOBJS) $(CFOBJS)
104 $(CC) -o $@ $+ $(SRPLDOPTS)
105
106 $(BUILDDIR)/srp-mdns-proxy: $(OBJDIR)/srp-mdns-proxy.o $(OBJDIR)/srp-parse.o $(MDNSOBJS) $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS) $(HMACOBJS) $(CFOBJS)
107 $(CC) -o $@ $+ $(SRPLDOPTS)
108
109 $(BUILDDIR)/keydump: $(OBJDIR)/keydump.o $(SIMPLEOBJS) $(FROMWIREOBJS) $(IOOBJS)
110 $(CC) -o $@ $+ $(SRPLDOPTS)
111
112 $(OBJDIR)/dso.o: ../DSO/dso.c
113 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
114
115 $(OBJDIR)/dnssd_clientstub.o: ../mDNSShared/dnssd_clientstub.c
116 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
117
118 $(OBJDIR)/dnssd_ipc.o: ../mDNSShared/dnssd_ipc.c
119 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c -I. -I../mDNSShared $<
120
121 $(OBJDIR)/ioloop-notls.o: ioloop.c
122 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -DEXCLUDE_TLS -c $<
123
124 $(OBJDIR)/%.o: %.c
125 $(CC) -o $@ $(SRPCFLAGS) $(CFLAGS) -c $<
126
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