1#	$OpenBSD: Makefile.bsd-wrapper,v 1.19 2020/06/02 14:41:13 espie 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
22# do not remove, breaks unwind(8)
23CONFIGURE_OPTS_UNBOUND+= --without-pthreads
24
25PROG=	unbound \
26	unbound-anchor \
27	unbound-checkconf \
28	unbound-control \
29	unbound-host
30
31SCRIPT=	unbound-control-setup
32
33MAN=	doc/unbound.8 \
34	doc/unbound.conf.5 \
35	doc/unbound-anchor.8 \
36	doc/unbound-checkconf.8	\
37	doc/unbound-control.8 \
38	doc/unbound-host.1
39
40all:	${.OBJDIR}/config.status
41	exec ${MAKE}
42
43${MAN}: ${.OBJDIR}/config.status
44
45.FORCE: .IGNORE
46
47config: .FORCE
48	-rm -f ${.OBJDIR}/config.cache
49	cd ${.OBJDIR} && \
50		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
51		${XCFLAGS} \
52		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
53
54${.OBJDIR}/config.status:
55	cd ${.OBJDIR} && \
56		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
57		${XCFLAGS} \
58		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
59
60.ifdef NOMAN
61maninstall:
62	@echo NOMAN is set
63.endif
64
65install: maninstall
66.for file in ${PROG}
67	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} \
68		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
69		${file} ${DESTDIR}${BINDIR}
70.endfor
71
72.for file in ${SCRIPT}
73	${INSTALL} ${INSTALL_COPY} \
74		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
75		${file} ${DESTDIR}${BINDIR}
76.endfor
77
78CLEANFILES+= ${MAN} dnstap/dnstap_config.h doc/example.conf doc/libunbound.3 \
79		smallapp/unbound-control-setup.sh dnscrypt/dnscrypt_config.h
80
81clean cleandir:
82	-@if [ -e Makefile ]; then ${MAKE} realclean; fi
83	rm -f ${CLEANFILES}
84
85tags:
86	# Nothing here so far...
87
88.include <bsd.obj.mk>
89.include <bsd.subdir.mk>
90.ifndef NOMAN
91.include <bsd.man.mk>
92.endif
93