Correct issue with dragonfly libexecdir
[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 DISTINFO=       ${DISTFILE}.distinfo
41 DISTINFOSIGN=   ${DISTINFO}.asc
42 CKSUM?=         cksum -a SHA256
43 PGP?=           netpgp
44
45 GITREF?=        HEAD
46
47 .SUFFIXES: .in
48
49 all: ${TARGET}
50
51 .in: Makefile ${CONFIG_MK}
52         ${SED}  ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
53                 ${SED_VARDIR} \
54                 ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
55                 $< > $@
56
57 clean:
58         rm -f ${TARGET}
59
60 distclean: clean
61         rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
62
63 installdirs:
64
65 proginstall: ${TARGET}
66         ${INSTALL} -d ${DESTDIR}${SBINDIR}
67         ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
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
74 maninstall:
75         ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
76         ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
77         ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
78         ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
79
80 install: proginstall maninstall
81
82 dist-git:
83         git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE}
84
85 dist-inst:
86         mkdir /tmp/${DISTPREFIX}
87         cp -RPp * /tmp/${DISTPREFIX}
88         (cd /tmp/${DISTPREFIX}; make clean)
89         tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX}
90         rm -rf /tmp/${DISTPREFIX}
91
92 dist: dist-git
93
94 distinfo: dist
95         rm -f ${DISTINFO} ${DISTINFOSIGN}
96         ${CKSUM} ${DISTFILE} >${DISTINFO}
97         #printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
98         ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
99         chmod 644 ${DISTINFOSIGN}
100         ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
101
102 import: dist
103         rm -rf /tmp/${DISTPREFIX}
104         ${INSTALL} -d /tmp/${DISTPREFIX}
105         tar xvJpf ${DISTFILE} -C /tmp