1#	$OpenBSD: Makefile.bsd-wrapper,v 1.20 2020/08/24 15:33:33 florian Exp $
2
3.include <bsd.own.mk>
4
5BINDIR=		/usr/sbin
6CHROOTDIR=	/var/unbound
7
8XCFLAGS=	CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDFLAGS}"
9
10CONFIGURE_OPTS_UNBOUND=	--enable-allsymbols \
11			--with-ssl=/usr \
12			--with-libevent=/usr \
13			--with-libexpat=/usr \
14			--without-pythonmodule \
15			--with-chroot-dir=${CHROOTDIR} \
16			--with-pidfile="" \
17			--with-rootkey-file=/var/unbound/db/root.key \
18			--with-conf-file=${CHROOTDIR}/etc/unbound.conf \
19			--with-username=_unbound \
20			--disable-shared \
21			--disable-explicit-port-randomisation
22
23# do not remove, breaks unwind(8)
24CONFIGURE_OPTS_UNBOUND+= --without-pthreads
25
26PROG=	unbound \
27	unbound-anchor \
28	unbound-checkconf \
29	unbound-control \
30	unbound-host
31
32SCRIPT=	unbound-control-setup
33
34MAN=	doc/unbound.8 \
35	doc/unbound.conf.5 \
36	doc/unbound-anchor.8 \
37	doc/unbound-checkconf.8	\
38	doc/unbound-control.8 \
39	doc/unbound-host.1
40
41all:	${.OBJDIR}/config.status
42	exec ${MAKE}
43
44${MAN}: ${.OBJDIR}/config.status
45
46.FORCE: .IGNORE
47
48config: .FORCE
49	-rm -f ${.OBJDIR}/config.cache
50	cd ${.OBJDIR} && \
51		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
52		${XCFLAGS} \
53		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
54
55${.OBJDIR}/config.status:
56	cd ${.OBJDIR} && \
57		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
58		${XCFLAGS} \
59		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
60
61.ifdef NOMAN
62maninstall:
63	@echo NOMAN is set
64.endif
65
66install: maninstall
67.for file in ${PROG}
68	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} \
69		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
70		${file} ${DESTDIR}${BINDIR}
71.endfor
72
73.for file in ${SCRIPT}
74	${INSTALL} ${INSTALL_COPY} \
75		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
76		${file} ${DESTDIR}${BINDIR}
77.endfor
78
79CLEANFILES+= ${MAN} dnstap/dnstap_config.h doc/example.conf doc/libunbound.3 \
80		smallapp/unbound-control-setup.sh dnscrypt/dnscrypt_config.h
81
82clean cleandir:
83	-@if [ -e Makefile ]; then ${MAKE} realclean; fi
84	rm -f ${CLEANFILES}
85
86tags:
87	# Nothing here so far...
88
89.include <bsd.obj.mk>
90.include <bsd.subdir.mk>
91.ifndef NOMAN
92.include <bsd.man.mk>
93.endif
94