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