Add WireGuard interfaces to dynamic_order
[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 ECHO?=          echo
14 INSTALL?=       install
15 SED?=           sed
16
17 VERSION!=       ${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in
18
19 BINMODE?=       0755
20 DOCMODE?=       0644
21 MANMODE?=       0444
22
23 RESOLVCONF=     resolvconf resolvconf.8 resolvconf.conf.5
24 SUBSCRIBERS=    libc dnsmasq named pdnsd pdns_recursor unbound
25 TARGET=         ${RESOLVCONF} ${SUBSCRIBERS}
26 SRCS=           ${TARGET:C,$,.in,} # pmake
27 SRCS:=          ${TARGET:=.in} # gmake
28
29 SED_SBINDIR=            -e 's:@SBINDIR@:${SBINDIR}:g'
30 SED_SYSCONFDIR=         -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
31 SED_LIBEXECDIR=         -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
32 SED_VARDIR=             -e 's:@VARDIR@:${VARDIR}:g'
33 SED_RCDIR=              -e 's:@RCDIR@:${RCDIR}:g'
34 SED_RESTARTCMD=         -e 's:@RESTARTCMD@:${RESTARTCMD}:g'
35 SED_RCDIR=              -e 's:@RCDIR@:${RCDIR}:g'
36 SED_STATUSARG=          -e 's:@STATUSARG@:${STATUSARG}:g'
37
38 DISTPREFIX?=    ${PKG}-${VERSION}
39 DISTFILEGZ?=    ${DISTPREFIX}.tar.gz
40 DISTFILE?=      ${DISTPREFIX}.tar.xz
41 DISTINFO=       ${DISTFILE}.distinfo
42 DISTINFOSIGN=   ${DISTINFO}.asc
43 CKSUM?=         cksum -a SHA256
44 PGP?=           netpgp
45
46 GITREF?=        HEAD
47
48 .SUFFIXES: .in
49
50 all: ${TARGET}
51
52 .in: Makefile ${CONFIG_MK}
53         ${SED}  ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
54                 ${SED_VARDIR} \
55                 ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
56                 $< > $@
57
58 clean:
59         rm -f ${TARGET}
60
61 distclean: clean
62         rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
63
64 installdirs:
65
66 proginstall: ${TARGET}
67         ${INSTALL} -d ${DESTDIR}${SBINDIR}
68         ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
69         ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
70         test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
71         ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
72         ${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
73         ${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
74
75 maninstall:
76         ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
77         ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
78         ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
79         ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
80
81 install: proginstall maninstall
82
83 dist-git:
84         git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE}
85
86 dist-inst:
87         mkdir /tmp/${DISTPREFIX}
88         cp -RPp * /tmp/${DISTPREFIX}
89         (cd /tmp/${DISTPREFIX}; make clean)
90         tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX}
91         rm -rf /tmp/${DISTPREFIX}
92
93 dist: dist-git
94
95 distinfo: dist
96         rm -f ${DISTINFO} ${DISTINFOSIGN}
97         ${CKSUM} ${DISTFILE} >${DISTINFO}
98         #printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
99         ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
100         chmod 644 ${DISTINFOSIGN}
101         ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
102
103 import: dist
104         rm -rf /tmp/${DISTPREFIX}
105         ${INSTALL} -d /tmp/${DISTPREFIX}
106         tar xvJpf ${DISTFILE} -C /tmp
107
108 _import-src:
109         rm -rf ${DESTDIR}/*
110         ${INSTALL} -d ${DESTDIR}
111         cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR};
112         cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR};
113         @${ECHO}
114         @${ECHO} "============================================================="
115         @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}"
116
117 import-src:
118         ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else  echo /tmp/${DISTPREFIX}; fi`