-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (36 loc) · 1.59 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
pkgname=zaman
PREFIX ?= /usr/local
.PHONY: build test install clean uninstall
build:
# Generate man page
scdoc < "doc/man/${pkgname}.1.scd" > "doc/man/${pkgname}.1"
# Archive man page
gzip -c "doc/man/${pkgname}.1" > "doc/man/${pkgname}.1.gz"
test:
# Run some simple unit tests on basic functions
bats test/case/basic_functions.bats
install:
# Install the main script
install -Dm 755 "src/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}"
# Install shell completions
install -Dm 644 "res/completions/${pkgname}.bash" "${DESTDIR}${PREFIX}/share/bash-completion/completions/${pkgname}"
install -Dm 644 "res/completions/${pkgname}.zsh" "${DESTDIR}${PREFIX}/share/zsh/site-functions/_${pkgname}"
install -Dm 644 "res/completions/${pkgname}.fish" "${DESTDIR}${PREFIX}/share/fish/vendor_completions.d/${pkgname}.fish"
# Install man page
install -Dm 644 "doc/man/${pkgname}.1.gz" "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz"
# Install documentation
install -Dm 644 README.md "${DESTDIR}${PREFIX}/share/doc/${pkgname}/README.md"
clean:
# Delete generated and archived man page
rm -f "doc/man/${pkgname}.1"{,.gz}
uninstall:
# Delete the main script
rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}"
# Delete shell completions
rm -f "${DESTDIR}${PREFIX}/share/bash-completion/completions/${pkgname}"
rm -f "${DESTDIR}${PREFIX}/share/zsh/site-functions/_${pkgname}"
rm -f "${DESTDIR}${PREFIX}/share/fish/vendor_completions.d/${pkgname}.fish"
# Delete man pages
rm -f "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz"
# Delete documentation
rm -rf "${DESTDIR}${PREFIX}/share/doc/${pkgname}/"