1282746SgjbPKG=		openresolv
2282746SgjbVERSION=	3.7.0
3219732Sume
4282746Sgjb# Nasty hack so that make clean works without configure being run
5282746Sgjb_CONFIG_MK!=	test -e config.mk && echo config.mk || echo config-null.mk
6282746SgjbCONFIG_MK?=	${_CONFIG_MK}
7282746Sgjbinclude		${CONFIG_MK}
8219732Sume
9282746SgjbSBINDIR?=	/sbin
10282746SgjbSYSCONFDIR?=	/etc
11282746SgjbLIBEXECDIR?=	/libexec/resolvconf
12282746SgjbVARDIR?=	/var/run/resolvconf
13282746SgjbRCDIR?=		/etc/rc.d
14282746SgjbRESTARTCMD?=	if ${RCDIR}/\1 status >/dev/null 2>\&1; then \
15282746Sgjb			${RCDIR}/\1 restart; \
16282746Sgjb		fi
17282746Sgjb
18219732SumeINSTALL?=	install
19219732SumeSED?=		sed
20219732Sume
21219732SumeBINMODE?=	0755
22219732SumeDOCMODE?=	0644
23219732SumeMANMODE?=	0444
24219732Sume
25219732SumeRESOLVCONF=	resolvconf resolvconf.8 resolvconf.conf.5
26219732SumeSUBSCRIBERS=	libc dnsmasq named pdnsd unbound
27219732SumeTARGET=		${RESOLVCONF} ${SUBSCRIBERS}
28219732SumeSRCS=		${TARGET:C,$,.in,} # pmake
29219732SumeSRCS:=		${TARGET:=.in} # gmake
30219732Sume
31282746SgjbSED_SBINDIR=		-e 's:@SBINDIR@:${SBINDIR}:g'
32219732SumeSED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
33219732SumeSED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
34219732SumeSED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
35219732SumeSED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
36219732SumeSED_RESTARTCMD=		-e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
37219732Sume
38282746SgjbDISTPREFIX?=	${PKG}-${VERSION}
39282746SgjbDISTFILEGZ?=	${DISTPREFIX}.tar.gz
40282746SgjbDISTFILE?=	${DISTPREFIX}.tar.bz2
41282746SgjbFOSSILID?=	current
42282746Sgjb
43219732Sume.SUFFIXES: .in
44219732Sume
45219732Sumeall: ${TARGET}
46219732Sume
47219732Sume.in:
48282746Sgjb	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
49219732Sume		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
50219732Sume		$< > $@
51219732Sume
52219732Sumeclean:
53282746Sgjb	rm -f ${TARGET}
54219732Sume
55219732Sumedistclean: clean
56282746Sgjb	rm -f config.mk ${DISTFILE}
57219732Sume
58219732Sumeinstalldirs:
59219732Sume
60282746Sgjbproginstall: ${TARGET}
61219732Sume	${INSTALL} -d ${DESTDIR}${SBINDIR}
62219732Sume	${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
63219732Sume	${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
64219732Sume	test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
65219732Sume	${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
66219732Sume	${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
67219732Sume	${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
68282746Sgjb
69282746Sgjbmaninstall:
70219732Sume	${INSTALL} -d ${DESTDIR}${MANDIR}/man8
71219732Sume	${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
72219732Sume	${INSTALL} -d ${DESTDIR}${MANDIR}/man5
73219732Sume	${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
74219732Sume
75282746Sgjbinstall: proginstall maninstall
76282746Sgjb
77219732Sumeimport:
78282746Sgjb	rm -rf /tmp/${DISTPREFIX}
79282746Sgjb	${INSTALL} -d /tmp/${DISTPREFIX}
80282746Sgjb	cp README ${SRCS} /tmp/${DISPREFIX}
81219732Sume
82282746Sgjbdist:
83282746Sgjb	fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
84282746Sgjb	gunzip -c ${DISTFILEGZ} |  bzip2 >${DISTFILE}
85282746Sgjb	rm ${DISTFILEGZ}
86