-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
137 lines (109 loc) · 3.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
PKG= openresolv
# Nasty hack so that make clean works without configure being run
_CONFIG_MK!= test -e config.mk && echo config.mk || echo config-null.mk
CONFIG_MK?= ${_CONFIG_MK}
include ${CONFIG_MK}
DIST!= if test -d .git; then echo "dist-git"; \
else echo "dist-inst"; fi
SBINDIR?= /sbin
SYSCONFDIR?= /etc
LIBEXECDIR?= /libexec/resolvconf
VARDIR?= /var/run/resolvconf
ECHO?= echo
INSTALL?= install
SED?= sed
VERSION!= ${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in
BINMODE?= 0755
DOCMODE?= 0644
MANMODE?= 0444
RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5
SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound
LIBC_SUBSCRIBERS= avahi-daemon mdnsd
TARGET= ${RESOLVCONF} ${SUBSCRIBERS} ${LIBC_SUBSCRIBERS}
SRCS= ${TARGET:C,$,.in,} # pmake
SRCS:= ${TARGET:=.in} # gmake
SED_SBINDIR= -e 's:@SBINDIR@:${SBINDIR}:g'
SED_SYSCONFDIR= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
SED_LIBEXECDIR= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
SED_VARDIR= -e 's:@VARDIR@:${VARDIR}:g'
SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g'
SED_RESTARTCMD= -e 's:@RESTARTCMD@:${RESTARTCMD}:g'
SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g'
SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g'
DISTPREFIX?= ${PKG}-${VERSION}
DISTFILE?= ${DISTPREFIX}.tar.xz
DISTINFO= ${DISTFILE}.distinfo
DISTINFOMD= ${DISTINFO}.md
DISTSIGN= ${DISTFILE}.asc
SHA256?= sha256
PGP?= gpg
GITREF?= HEAD
.SUFFIXES: .in
all: ${TARGET}
.in: Makefile ${CONFIG_MK}
${SED} ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \
${SED_VARDIR} \
${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \
$< > $@
clean:
rm -f ${TARGET}
distclean: clean
rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOMD} ${DISTSIGN}
installdirs:
proginstall: ${TARGET}
${INSTALL} -d ${DESTDIR}${SBINDIR}
${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR}
${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \
${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
${INSTALL} -d ${DESTDIR}${LIBEXECDIR}/libc.d
${INSTALL} -m ${DOCMODE} ${LIBC_SUBSCRIBERS} \
${DESTDIR}${LIBEXECDIR}/libc.d
maninstall:
${INSTALL} -d ${DESTDIR}${MANDIR}/man8
${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
${INSTALL} -d ${DESTDIR}${MANDIR}/man5
${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5
install: proginstall maninstall
dist-git:
git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE}
dist-inst:
mkdir /tmp/${DISTPREFIX}
cp -RPp * /tmp/${DISTPREFIX}
(cd /tmp/${DISTPREFIX}; make clean)
tar -cvJpf ${DISTFILE} -C /tmp ${DISTPREFIX}
rm -rf /tmp/${DISTPREFIX}
dist: ${DIST}
distinfo: dist
rm -f ${DISTINFO} ${DISTSIGN}
${SHA256} ${DISTFILE} >${DISTINFO}
wc -c <${DISTFILE} \
| xargs printf 'Size (${DISTFILE}) = %s\n' >>${DISTINFO}
${PGP} --armour --detach-sign ${DISTFILE}
chmod 644 ${DISTSIGN}
ls -l ${DISTFILE} ${DISTINFO} ${DISTSIGN}
${DISTINFOMD}: ${DISTINFO}
echo '```' >${DISTINFOMD}
cat ${DISTINFO} >>${DISTINFOMD}
echo '```' >>${DISTINFOMD}
release: distinfo ${DISTINFOMD}
gh release create v${VERSION} \
--title "openresolv ${VERSION}" --draft --generate-notes \
--notes-file ${DISTINFOMD} \
${DISTFILE} ${DISTSIGN}
import: dist
rm -rf /tmp/${DISTPREFIX}
${INSTALL} -d /tmp/${DISTPREFIX}
tar xvJpf ${DISTFILE} -C /tmp
_import-src:
rm -rf ${DESTDIR}/*
${INSTALL} -d ${DESTDIR}
cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR};
cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR};
@${ECHO}
@${ECHO} "============================================================="
@${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}"
import-src:
${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi`