Fix for no entries.
[openresolv] / Makefile
1 NAME=           openresolv
2 VERSION=        3.3.6
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 pdnsd unbound
23 TARGET=         ${RESOLVCONF} ${SUBSCRIBERS}
24 SRCS=           ${TARGET:C,$,.in,} # pmake
25 SRCS:=          ${TARGET:=.in} # gmake
26
27 # Try to embed correct service restart commands
28 _CMD1=          \\1 status >/dev/null 2>\\&1
29 _CMD2=          \\1 restart
30 _CMD_SH=if [ -x /sbin/rc-service ]; then \
31                 printf '/sbin/rc-service -e \\1 \\&\\& /sbin/rc-service \\1 -- -Ds restart'; \
32         elif [ -x /usr/sbin/invoke-rc.d ]; then \
33                 printf '/usr/sbin/invoke-rc.d --query --quiet \\1 restart || [ \\\\$$? = 104 ] \\&\\& /usr/sbin/invoke-rc.d ${_CMD2}'; \
34         elif [ -x /sbin/service ]; then \
35                 printf '/sbin/service ${_CMD1} \\&\\& /sbin/service ${_CMD2}'; \
36         elif [ -d /usr/local/etc/rc.d ]; then \
37                 printf 'if /usr/local/etc/rc.d/${_CMD1}; then'; \
38                 printf ' /usr/local/etc/rc.d/${_CMD2}; '; \
39                 printf 'elif /etc/rc.d/${_CMD1}; then /etc/rc.d/${_CMD2}; fi'; \
40         elif [ -d /etc/rc.d ]; then \
41                 printf '/etc/rc.d/${_CMD1} \\&\\& /etc/rc.d/${_CMD2}'; \
42         elif [ -d /etc/init.d ]; then \
43                 printf '/etc/init.d/${_CMD1} \\&\\& /etc/init.d/${_CMD2}'; \
44         fi;
45 _CMD!=          ${_CMD_SH}
46 RESTARTCMD?=    ${_CMD}$(shell ${_CMD_SH})
47
48 .SUFFIXES: .in
49
50 all: ${TARGET}
51
52 .in:
53         ${SED} -e 's:@PREFIX@:${PREFIX}:g' \
54                 -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' \
55                 -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' \
56                 -e 's:@VARDIR@:${VARDIR}:g' \
57                 -e 's:@RESTARTCMD \(.*\)@:${RESTARTCMD}:g' \
58                 $@.in > $@
59
60 clean:
61         rm -f ${TARGET} openresolv-${VERSION}.tar.bz2
62
63 installdirs:
64
65 install: ${TARGET}
66         ${INSTALL} -d ${DESTDIR}${BINDIR}
67         ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${BINDIR}
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         ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
74         ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
75         ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
76         ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
77
78 import:
79         rm -rf /tmp/${PKG}
80         ${INSTALL} -d /tmp/${PKG}
81         cp README ${SRCS} /tmp/${PKG}
82
83 dist: import
84         cp Makefile resolvconf.conf /tmp/${PKG}
85         tar cvjpf ${PKG}.tar.bz2 -C /tmp ${PKG} 
86         rm -rf /tmp/${PKG} 
87         ls -l ${PKG}.tar.bz2