For FreeBSD, the status argument needs to be onestatus.
[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 SED_STATUSARG=          -e 's:@STATUSARG@:${STATUSARG}:g'
36
37 DISTPREFIX?=    ${PKG}-${VERSION}
38 DISTFILEGZ?=    ${DISTPREFIX}.tar.gz
39 DISTFILE?=      ${DISTPREFIX}.tar.xz
40 FOSSILID?=      current
41
42 .SUFFIXES: .in
43
44 all: ${TARGET}
45
46 .in: Makefile ${CONFIG_MK}
47         ${SED}  ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
48                 ${SED_VARDIR} \
49                 ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
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}