Makefile.bsd-wrapper revision 1.3
1#	$OpenBSD: Makefile.bsd-wrapper,v 1.3 2012/03/26 19:09:30 sthen Exp $
2
3.include <bsd.own.mk>
4
5BINDIR=		/usr/sbin
6CHROOTDIR=	/var/unbound
7USER=		_unbound
8
9XCFLAGS=	CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDFLAGS}"
10
11CONFIGURE_OPTS_LDNS=	--with-drill \
12			--disable-shared
13
14CONFIGURE_OPTS_UNBOUND=	--enable-allsymbols \
15			--with-ssl=/usr \
16			--with-libevent=/usr \
17			--with-libexpat=/usr \
18			--with-ldns=ldns \
19			--without-pthreads \
20			--without-pythonmodule \
21			--with-chroot-dir=${CHROOTDIR} \
22			--with-pidfile=${CHROOTDIR}/var/run/unbound.pid \
23			--with-conf-file=${CHROOTDIR}/etc/unbound.conf \
24			--with-username=${USER} \
25			--disable-shared
26
27PROG=	ldns/drill/drill \
28	unbound \
29	unbound-anchor \
30	unbound-checkconf \
31	unbound-control \
32	unbound-host
33
34SCRIPT=	unbound-control-setup
35
36MAN=	ldns/drill/drill.1 \
37	doc/unbound.8 \
38	doc/unbound.conf.5 \
39	doc/unbound-anchor.8 \
40	doc/unbound-checkconf.8	\
41	doc/unbound-control.8 \
42	doc/unbound-host.1
43
44all:	gnu
45
46.ifndef NOMAN
47${MANALL} ${PSALL}: ${MAN}
48
49${MAN}:	gnu
50.endif
51
52gnu: ${.OBJDIR}/config.status
53	${MAKE}
54
55.FORCE: .IGNORE
56
57config: .FORCE
58	-rm -f ${.OBJDIR}/ldns/config.cache
59	-rm -f ${.OBJDIR}/config.cache
60	cd ${.OBJDIR} && mkdir -p ldns && cd ldns && \
61		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
62		${XCFLAGS} \
63		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
64		sh ${.CURDIR}/ldns/configure ${CONFIGURE_OPTS_LDNS} && \
65		${MAKE} 
66	cd ${.OBJDIR} && \
67		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
68		${XCFLAGS} \
69		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
70		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
71	if [ ! -e ${.OBJDIR}/ldns/drill/drill.1 ]; then \
72		cp ${.CURDIR}/ldns/drill/drill.1 \
73			${.OBJDIR}/ldns/drill/drill.1;\
74	fi
75	if [ ! -e ${.OBJDIR}/doc/unbound-host.1 ]; then \
76		cp ${.CURDIR}/doc/unbound-host.1 \
77			${.OBJDIR}/doc/unbound-host.1; \
78	fi
79
80${.OBJDIR}/config.status:
81	cd ${.OBJDIR} && mkdir -p ldns && cd ldns && \
82		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
83		${XCFLAGS} \
84		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
85		sh ${.CURDIR}/ldns/configure ${CONFIGURE_OPTS_LDNS} && \
86		${MAKE}
87	cd ${.OBJDIR} && \
88		PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
89		${XCFLAGS} \
90		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
91		sh ${.CURDIR}/configure ${CONFIGURE_OPTS_UNBOUND}
92	if [ ! -e ${.OBJDIR}/ldns/drill/drill.1 ]; then \
93		cp ${.CURDIR}/ldns/drill/drill.1 \
94			 ${.OBJDIR}/ldns/drill/drill.1;\
95	fi
96	if [ ! -e ${.OBJDIR}/doc/unbound-host.1 ]; then \
97		cp ${.CURDIR}/doc/unbound-host.1 \
98			${.OBJDIR}/doc/unbound-host.1; \
99	fi
100
101.ifdef NOMAN
102maninstall:
103	@echo NOMAN is set
104.endif
105
106install: maninstall
107.for file in ${PROG}
108	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} \
109		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
110		${file} ${DESTDIR}${BINDIR}
111.endfor
112
113.for file in ${SCRIPT}
114	${INSTALL} ${INSTALL_COPY} \
115		-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
116		${file} ${DESTDIR}${BINDIR}
117.endfor
118
119BEFOREMAN= ${.OBJDIR}/config.status
120
121clean cleandir:
122	-@if [ -e Makefile ]; then ${MAKE} realclean; fi
123	-@if [ -e ldns/Makefile ]; then cd ldns; ${MAKE} realclean; fi
124	rm -f ${CLEANFILES}
125
126depend:
127	# Nothing here so far...
128
129lint:
130	# Nothing here so far...
131
132tags:
133	# Nothing here so far...
134
135.include <bsd.obj.mk>
136.include <bsd.subdir.mk>
137.ifndef NOMAN
138.include <bsd.man.mk>
139.endif
140