5c1f8cab4bf54818a4da679644a41d886d2ca6df
[openresolv] / Makefile
1 PKG=            openresolv
2 VERSION=        3.8.0
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
14 INSTALL?=       install
15 SED?=           sed
16
17 BINMODE?=       0755
18 DOCMODE?=       0644
19 MANMODE?=       0444
20
21 RESOLVCONF=     resolvconf resolvconf.8 resolvconf.conf.5
22 SUBSCRIBERS=    libc dnsmasq named pdnsd unbound
23 TARGET=         ${RESOLVCONF} ${SUBSCRIBERS}
24 SRCS=           ${TARGET:C,$,.in,} # pmake
25 SRCS:=          ${TARGET:=.in} # gmake
26
27 SED_SBINDIR=            -e 's:@SBINDIR@:${SBINDIR}:g'
28 SED_SYSCONFDIR=         -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
29 SED_LIBEXECDIR=         -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
30 SED_VARDIR=             -e 's:@VARDIR@:${VARDIR}:g'
31 SED_RCDIR=              -e 's:@RCDIR@:${RCDIR}:g'
32 SED_RESTARTCMD=         -e 's:@RESTARTCMD@:${RESTARTCMD}:g'
33 SED_RCDIR=              -e 's:@RCDIR@:${RCDIR}:g'
34
35 DISTPREFIX?=    ${PKG}-${VERSION}
36 DISTFILEGZ?=    ${DISTPREFIX}.tar.gz
37 DISTFILE?=      ${DISTPREFIX}.tar.xz
38 FOSSILID?=      current
39
40 .SUFFIXES: .in
41
42 all: ${TARGET}
43
44 .in:
45         ${SED}  ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
46                 ${SED_VARDIR} ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} \
47                 $< > $@
48
49 clean:
50         rm -f ${TARGET}
51
52 distclean: clean
53         rm -f config.mk ${DISTFILE}
54
55 installdirs:
56
57 proginstall: ${TARGET}
58         ${INSTALL} -d ${DESTDIR}${SBINDIR}
59         ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
60         ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
61         test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
62         ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
63         ${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
64         ${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
65
66 maninstall:
67         ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
68         ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
69         ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
70         ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
71
72 install: proginstall maninstall
73
74 import:
75         rm -rf /tmp/${DISTPREFIX}
76         ${INSTALL} -d /tmp/${DISTPREFIX}
77         cp README ${SRCS} /tmp/${DISTPREFIX}
78
79 dist:
80         fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
81         gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
82         rm ${DISTFILEGZ}