-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (88 loc) · 2.77 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
#
# Copyright (c) 2017-2019 Gaël PORTAY
#
# SPDX-License-Identifier: MIT
#
PREFIX ?= /usr/local
.PHONY: all
all:
.PHONY: doc
doc: docker-clean.1.gz docker-archive.1.gz
.PHONY: install-all
install-all: install install-doc install-bash-completion
.PHONY: install
install:
install -d $(DESTDIR)$(PREFIX)/bin/
install -m 755 docker-clean docker-archive $(DESTDIR)$(PREFIX)/bin/
.PHONY: install-doc
install-doc:
install -d $(DESTDIR)$(PREFIX)/share/man/man1/
install -m 644 docker-clean.1.gz \
docker-archive.1.gz \
$(DESTDIR)$(PREFIX)/share/man/man1/
.PHONY: install-bash-completion
install-bash-completion:
completionsdir=$${BASHCOMPLETIONSDIR:-$$(pkg-config --define-variable=prefix=$(PREFIX) \
--variable=completionsdir \
bash-completion)}; \
if [ -n "$$completionsdir" ]; then \
install -d $(DESTDIR)$$completionsdir/; \
for bash in docker-clean docker-archive; do \
install -m 644 bash-completion/$$bash \
$(DESTDIR)$$completionsdir/; \
done; \
fi
.PHONY: uninstall
uninstall:
for bin in docker-clean docker-archive; do \
rm -f $(DESTDIR)$(PREFIX)/bin/$$bin; \
done
for man in docker-clean.1.gz docker-archive.1.gz; do \
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/$$man; \
done
completionsdir=$${BASHCOMPLETIONSDIR:-$$(pkg-config --define-variable=prefix=$(PREFIX) \
--variable=completionsdir \
bash-completion)}; \
if [ -n "$$completionsdir" ]; then \
for bash in docker-clean docker-archive; do \
rm -f $(DESTDIR)$$completionsdir/$$bash; \
done; \
fi
.PHONY: user-install-all
user-install-all: user-install user-install-doc user-install-bash-completion
user-install user-install-doc user-install-bash-completion user-uninstall:
user-%:
$(MAKE) $* PREFIX=$$HOME/.local BASHCOMPLETIONSDIR=$$HOME/.local/share/bash-completion/completions
.PHONY: tests
tests:
@./tests.sh
.PHONY: check
check: docker-clean docker-archive
shellcheck $^
.PHONY: clean
clean:
rm -f docker-clean.1.gz docker-archive.1.gz
rm -f PKGBUILD.aur master.tar.gz src/master.tar.gz *.pkg.tar.xz \
-R src/docker-scripts-master/ pkg/docker-scripts/
.PHONY: aur
aur: PKGBUILD.aur
makepkg --force --syncdeps -p $^
PKGBUILD.aur: PKGBUILD
cp $< [email protected]
makepkg --nobuild --nodeps --skipinteg -p [email protected]
md5sum="$$(makepkg --geninteg -p [email protected])"; \
sed -e "/pkgver()/,/^$$/d" \
-e "/md5sums=/d" \
-e "/source=/a$$md5sum" \
mv [email protected] $@
define do_install_aur =
install-aur-$(1):
pacman -U $(1).pkg.tar.xz
endef
aurs := $(shell ls -1d *.pkg.tar.xz 2>/dev/null | sed -e 's,.pkg.tar.xz$$,,')
$(foreach aur,$(aurs),$(eval $(call do_install_aur,$(aur))))
%.1: %.1.adoc
asciidoctor -b manpage -o $@ $<
%.gz: %
gzip -c $^ >$@