-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
66 lines (55 loc) · 1.64 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
PACKAGE=eve4pve-zstorage
VERSION=$(shell ./${PACKAGE} version)
DATE=$(shell LANG=en_us_8859_1; date '+%b %d, %Y')
DESTDIR=
PREFIX=/usr
SBINDIR=${PREFIX}/sbin
CRONDIR=/etc/cron.d
MANDIR=${PREFIX}/share/man
DOCDIR=${PREFIX}/share/doc/${PACKAGE}
MAN8DIR=${MANDIR}/man8
EXAMPLE=${DOCDIR}/examples
DEB=${PACKAGE}_${VERSION}_all.deb
all: ${DEB}
.PHONY: dinstall
dinstall: deb
dpkg -i ${DEB}
.PHONY: install
install:
install -d ${DESTDIR}${SBINDIR}
install -m 0755 ${PACKAGE} ${DESTDIR}${SBINDIR}
install -d ${DESTDIR}${CRONDIR}
install -m 0644 ${PACKAGE}.cron ${DESTDIR}${CRONDIR}/${PACKAGE}
install -d ${DESTDIR}${MAN8DIR}
install -m 0644 ${PACKAGE}.8 ${DESTDIR}${MAN8DIR}
gzip ${DESTDIR}${MAN8DIR}/${PACKAGE}.8
.PHONY: deb ${DEB}
deb ${DEB}:
rm -rf debian
mkdir debian
$(shell ./${PACKAGE} help --no-logo > help.tmp)
sed '/@@COPYRIGHT@@/r copyright' ${PACKAGE}.8.template | \
sed "/@@COPYRIGHT@@/d" | \
sed '/@@SYNOPSIS@@/r help.tmp' | \
sed /@@SYNOPSIS@@/d | \
sed s/@@PACKAGE@@/${PACKAGE}/ | \
sed s/@@PACKAGE@@/${PACKAGE}/ | \
sed "s/@@DATE@@/${DATE}/" \
> ${PACKAGE}.8
make DESTDIR=${CURDIR}/debian install
install -d -m 0755 debian/DEBIAN
sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PACKAGE@@/${PACKAGE}/ <control.in >debian/DEBIAN/control
install -D -m 0644 copyright debian/${DOCDIR}/copyright
install -m 0644 changelog.Debian debian/${DOCDIR}/
gzip -9 debian/${DOCDIR}/changelog.Debian
dpkg-deb --build debian
mv debian.deb ${DEB}
rm -rf debian
rm ${PACKAGE}.8
rm help.tmp
.PHONY: clean
clean:
rm -rf debian *.deb ${PACKAGE}-*.tar.gz dist *.8.man *.8.gz *.tmp
find . -name '*~' -exec rm {} ';'
.PHONY: distclean
distclean: clean