Release openresolv-3.3.1
[openresolv] / Makefile
1 NAME=           openresolv
2 VERSION=        3.3.1
3 PKG=            ${NAME}-${VERSION}
4
5 INSTALL?=       install
6 SED?=           sed
7 #PREFIX?=       /usr/local
8 MANPREFIX?=     /usr/share
9 VARBASE?=       /var
10
11 BINMODE?=       0755
12 DOCMODE?=       0644
13 MANMODE?=       0444
14
15 SYSCONFDIR?=    ${PREFIX}/etc
16 BINDIR=         ${PREFIX}/sbin
17 LIBEXECDIR?=    ${PREFIX}/libexec/resolvconf
18 VARDIR?=        ${VARBASE}/run/resolvconf
19 MANDIR?=        ${MANPREFIX}/man
20
21 RESOLVCONF=     resolvconf resolvconf.8 resolvconf.conf.5
22 SUBSCRIBERS=    libc dnsmasq named
23 TARGET=         ${RESOLVCONF} ${SUBSCRIBERS}
24
25 # Try to embed correct service restart commands
26 _CMD1=          \\1 status >/dev/null 2>\\&1
27 _CMD2=          \\1 restart
28 _CMD_SH=if [ -x /sbin/rc-service ]; then \
29                 printf '/sbin/rc-service \\1 -- -Ds restart'; \
30         elif [ -x /sbin/service ]; then \
31                 printf '/sbin/service \\1 restart'; \
32         elif [ -d /usr/local/etc/rc.d ]; then \
33                 printf 'if /usr/local/etc/rc.d/${_CMD1}; then'; \
34                 printf ' /usr/local/etc/rc.d/${_CMD2}; '; \
35                 printf 'elif /etc/rc.d/${_CMD1}; then /etc/rc.d/${_CMD2}; fi'; \
36         elif [ -d /etc/rc.d ]; then \
37                 printf '/etc/rc.d/${_CMD1} \\&\\& /etc/rc.d/${_CMD2}'; \
38         elif [ -d /etc/init.d ]; then \
39                 printf '/etc/init.d/${_CMD1} \\&\\& /etc/init.d/${_CMD2}'; \
40         fi;
41 _CMD!=          ${_CMD_SH}
42 RESTARTCMD?=    ${_CMD}$(shell ${_CMD_SH})
43
44 .SUFFIXES: .in
45
46 all: ${TARGET}
47
48 .in:
49         ${SED} -e 's:@PREFIX@:${PREFIX}:g' \
50                 -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \
51                 -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' \
52                 -e 's:@VARDIR@:${VARDIR}:g' \
53                 -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' \
54                 $@.in > $@
55
56 clean:
57         rm -f ${TARGET} openresolv-${VERSION}.tar.bz2
58
59 installdirs:
60
61 install: ${TARGET}
62         ${INSTALL} -d ${DESTDIR}${BINDIR}
63         ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${BINDIR}
64         ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
65         ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
66         ${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
67         ${INSTALL} -m ${BINMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
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 dist:
74         ${INSTALL} -d /tmp/${PKG}
75         cp -RPp . /tmp/${PKG}
76         (cd /tmp/${PKG}; ${MAKE} clean)
77         rm -rf /tmp/${PKG}/*.bz2 /tmp/${PKG}/.git
78         tar cvjpf ${PKG}.tar.bz2 -C /tmp ${PKG} 
79         rm -rf /tmp/${PKG} 
80         ls -l ${PKG}.tar.bz2