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