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