-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (54 loc) · 2.12 KB
/
Copy pathMakefile
File metadata and controls
71 lines (54 loc) · 2.12 KB
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
PREFIX := /usr/local
DESTDIR :=
GREP := grep
ifeq ($(shell uname), Darwin)
GREP := ggrep
endif
VERSION ?= $(shell $(GREP) -m1 '^version ' Cargo.toml | awk -F\" '{print $$2}')
TODAY ?= $(shell date +%Y-%m-%d)
all: target/release/ipsort target/release/ipsort.1 target/release/ipsort.bash \
target/release/ipsort.fish target/release/ipsort.zsh
clean:
rm -rf target www
target/release/ipsort: $(wildcard src/*.rs)
cargo build --frozen --release
target/release/ipsort.bash: target/release/ipsort
./target/release/ipsort --generate-completions bash > $@
target/release/ipsort.fish: target/release/ipsort
./target/release/ipsort --generate-completions fish > $@
target/release/ipsort.zsh: target/release/ipsort
./target/release/ipsort --generate-completions zsh > $@
target/release/ipsort.1: ipsort.1.scd
mkdir -p target/release
sed -e "s/__VERSION__/$(VERSION)/" -e "s/__DATE__/$(TODAY)/" \
$< | scdoc > $@
www:
mkdir -p www
www/favicon.ico: logo.png www
magick $< -gravity center -crop 1000x1000+0+0 +repage -resize 16x16 $@
www/_headers: _headers www
cp $< $@
www/index.html: index.html www
cp $< $@
install: all
install -Dm0755 target/release/ipsort "$(DESTDIR)$(PREFIX)/bin/ipsort"
install -Dm0644 README.md \
"$(DESTDIR)$(PREFIX)/share/doc/ipsort/README.md"
install -Dm0644 target/release/ipsort.bash \
"$(DESTDIR)$(PREFIX)/share/bash-completion/completions/ipsort"
install -Dm0644 target/release/ipsort.fish \
"$(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/ipsort.fish"
install -Dm0644 target/release/ipsort.zsh \
"$(DESTDIR)$(PREFIX)/share/zsh/site-functions/_ipsort"
install -Dm0644 target/release/ipsort.1 \
"$(DESTDIR)$(PREFIX)/share/man/man1/ipsort.1"
uninstall:
rm -rf \
"$(DESTDIR)$(PREFIX)/bin/ipsort" \
"$(DESTDIR)$(PREFIX)/share/doc/ipsort" \
"$(DESTDIR)$(PREFIX)/share/bash-completion/completions/completions/ipsort" \
"$(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/ipsort.fish" \
"$(DESTDIR)$(PREFIX)/share/doc/zsh/site-functions/_ipsort" \
"$(DESTDIR)$(PREFIX)/share/man/man1/ipsort.1"
pubwww: www www/favicon.ico www/_headers www/index.html
.PHONY: all clean pubwww install uninstall