1282434SgjbPKG=		openresolv
2219732Sume
3282434Sgjb# Nasty hack so that make clean works without configure being run
4282434Sgjb_CONFIG_MK!=	test -e config.mk && echo config.mk || echo config-null.mk
5282434SgjbCONFIG_MK?=	${_CONFIG_MK}
6282434Sgjbinclude		${CONFIG_MK}
7219732Sume
8282434SgjbSBINDIR?=	/sbin
9282434SgjbSYSCONFDIR?=	/etc
10282434SgjbLIBEXECDIR?=	/libexec/resolvconf
11282434SgjbVARDIR?=	/var/run/resolvconf
12282434Sgjb
13219732SumeINSTALL?=	install
14219732SumeSED?=		sed
15219732Sume
16304515SpfgVERSION!=	${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in
17304515Spfg
18219732SumeBINMODE?=	0755
19219732SumeDOCMODE?=	0644
20219732SumeMANMODE?=	0444
21219732Sume
22219732SumeRESOLVCONF=	resolvconf resolvconf.8 resolvconf.conf.5
23219732SumeSUBSCRIBERS=	libc dnsmasq named pdnsd unbound
24219732SumeTARGET=		${RESOLVCONF} ${SUBSCRIBERS}
25219732SumeSRCS=		${TARGET:C,$,.in,} # pmake
26219732SumeSRCS:=		${TARGET:=.in} # gmake
27219732Sume
28282434SgjbSED_SBINDIR=		-e 's:@SBINDIR@:${SBINDIR}:g'
29219732SumeSED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
30219732SumeSED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
31219732SumeSED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
32219732SumeSED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
33304515SpfgSED_RESTARTCMD=		-e 's:@RESTARTCMD@:${RESTARTCMD}:g'
34304515SpfgSED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
35304515SpfgSED_STATUSARG=		-e 's:@STATUSARG@:${STATUSARG}:g'
36219732Sume
37282434SgjbDISTPREFIX?=	${PKG}-${VERSION}
38282434SgjbDISTFILEGZ?=	${DISTPREFIX}.tar.gz
39295165SpfgDISTFILE?=	${DISTPREFIX}.tar.xz
40313980SpfgDISTINFO=	${DISTFILE}.distinfo
41313980SpfgDISTINFOSIGN=	${DISTINFO}.asc
42313980SpfgCKSUM?=		cksum -a SHA256
43313980SpfgPGP?=		netpgp
44313980Spfg
45282434SgjbFOSSILID?=	current
46282434Sgjb
47219732Sume.SUFFIXES: .in
48219732Sume
49219732Sumeall: ${TARGET}
50219732Sume
51304515Spfg.in: Makefile ${CONFIG_MK}
52282434Sgjb	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
53304515Spfg		${SED_VARDIR} \
54304515Spfg		${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
55219732Sume		$< > $@
56219732Sume
57219732Sumeclean:
58282434Sgjb	rm -f ${TARGET}
59219732Sume
60219732Sumedistclean: clean
61313980Spfg	rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
62219732Sume
63219732Sumeinstalldirs:
64219732Sume
65282434Sgjbproginstall: ${TARGET}
66219732Sume	${INSTALL} -d ${DESTDIR}${SBINDIR}
67219732Sume	${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
68219732Sume	${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
69219732Sume	test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
70219732Sume	${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
71219732Sume	${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
72219732Sume	${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
73282434Sgjb
74282434Sgjbmaninstall:
75219732Sume	${INSTALL} -d ${DESTDIR}${MANDIR}/man8
76219732Sume	${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
77219732Sume	${INSTALL} -d ${DESTDIR}${MANDIR}/man5
78219732Sume	${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
79219732Sume
80282434Sgjbinstall: proginstall maninstall
81282434Sgjb
82219732Sumeimport:
83282434Sgjb	rm -rf /tmp/${DISTPREFIX}
84282434Sgjb	${INSTALL} -d /tmp/${DISTPREFIX}
85295165Spfg	cp README ${SRCS} /tmp/${DISTPREFIX}
86219732Sume
87282434Sgjbdist:
88282434Sgjb	fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
89295165Spfg	gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
90282434Sgjb	rm ${DISTFILEGZ}
91313980Spfg
92313980Spfgdistinfo: dist
93313980Spfg	rm -f ${DISTINFO} ${DISTINFOSIGN}
94313980Spfg	${CKSUM} ${DISTFILE} >${DISTINFO}
95313980Spfg	#printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
96313980Spfg	${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
97313980Spfg	chmod 644 ${DISTINFOSIGN}
98313980Spfg	ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
99