forked from jwilk/ubanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (39 loc) · 1.11 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
# Copyright © 2024 Jakub Wilk <[email protected]>
# SPDX-License-Identifier: MIT
PYTHON = python3
PREFIX = /usr/local
DESTDIR =
bindir = $(PREFIX)/bin
mandir = $(PREFIX)/share/man
zshcompletiondir = $(PREFIX)/share/zsh/site-functions
.PHONY: all
all: ;
.PHONY: install
install: ubanner
install -d $(DESTDIR)$(bindir)
python_exe=$$($(PYTHON) -c 'import sys; print(sys.executable)') && \
sed \
-e "1 s@^#!.*@#!$$python_exe@" \
-e "s#^basedir = .*#basedir = '$(basedir)/'#" \
$(<) > $(<).tmp
install $(<).tmp $(DESTDIR)$(bindir)/$(<)
rm $(<).tmp
# manual page:
install -d $(DESTDIR)$(mandir)/man1
install -p -m644 doc/$(<).1 $(DESTDIR)$(mandir)/man1/
# zsh completion:
install -d $(DESTDIR)$(zshcompletiondir)
install -p -m644 completion/zsh/_* $(DESTDIR)$(zshcompletiondir)
.PHONY: test
test: verbose=
test: ubanner
prove $(and $(verbose),-v)
.PHONY: test-installed
test-installed: verbose=
test-installed: $(or $(shell command -v ubanner;),$(bindir)/ubanner)
UBANNER_TEST_TARGET=ubanner prove $(and $(verbose),-v)
.PHONY: clean
clean:
rm -f *.tmp
.error = GNU make is required
# vim:ts=4 sts=4 sw=4 noet