xref: /freebsd/contrib/openresolv/Makefile (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1PKG=		openresolv
2VERSION=	3.7.1
3
4# Nasty hack so that make clean works without configure being run
5_CONFIG_MK!=	test -e config.mk && echo config.mk || echo config-null.mk
6CONFIG_MK?=	${_CONFIG_MK}
7include		${CONFIG_MK}
8
9SBINDIR?=	/sbin
10SYSCONFDIR?=	/etc
11LIBEXECDIR?=	/libexec/resolvconf
12VARDIR?=	/var/run/resolvconf
13RCDIR?=		/etc/rc.d
14RESTARTCMD?=	if ${RCDIR}/\1 status >/dev/null 2>\&1; then \
15			${RCDIR}/\1 restart; \
16		fi
17
18INSTALL?=	install
19SED?=		sed
20
21BINMODE?=	0755
22DOCMODE?=	0644
23MANMODE?=	0444
24
25RESOLVCONF=	resolvconf resolvconf.8 resolvconf.conf.5
26SUBSCRIBERS=	libc dnsmasq named pdnsd unbound
27TARGET=		${RESOLVCONF} ${SUBSCRIBERS}
28SRCS=		${TARGET:C,$,.in,} # pmake
29SRCS:=		${TARGET:=.in} # gmake
30
31SED_SBINDIR=		-e 's:@SBINDIR@:${SBINDIR}:g'
32SED_SYSCONFDIR=		-e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
33SED_LIBEXECDIR=		-e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
34SED_VARDIR=		-e 's:@VARDIR@:${VARDIR}:g'
35SED_RCDIR=		-e 's:@RCDIR@:${RCDIR}:g'
36SED_RESTARTCMD=		-e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g'
37
38DISTPREFIX?=	${PKG}-${VERSION}
39DISTFILEGZ?=	${DISTPREFIX}.tar.gz
40DISTFILE?=	${DISTPREFIX}.tar.xz
41FOSSILID?=	current
42
43.SUFFIXES: .in
44
45all: ${TARGET}
46
47.in:
48	${SED}	${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
49		${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} \
50		$< > $@
51
52clean:
53	rm -f ${TARGET}
54
55distclean: clean
56	rm -f config.mk ${DISTFILE}
57
58installdirs:
59
60proginstall: ${TARGET}
61	${INSTALL} -d ${DESTDIR}${SBINDIR}
62	${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
63	${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
64	test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
65	${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
66	${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
67	${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
68
69maninstall:
70	${INSTALL} -d ${DESTDIR}${MANDIR}/man8
71	${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
72	${INSTALL} -d ${DESTDIR}${MANDIR}/man5
73	${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
74
75install: proginstall maninstall
76
77import:
78	rm -rf /tmp/${DISTPREFIX}
79	${INSTALL} -d /tmp/${DISTPREFIX}
80	cp README ${SRCS} /tmp/${DISTPREFIX}
81
82dist:
83	fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
84	gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
85	rm ${DISTFILEGZ}
86