forked from Satty-org/Satty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (84 loc) · 3.26 KB
/
Makefile
File metadata and controls
115 lines (84 loc) · 3.26 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
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
108
109
110
111
112
113
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
SOURCEDIRS:=src $(wildcard src/*)
SOURCEFILES:=$(foreach d,$(SOURCEDIRS),$(wildcard $(d)/*.rs))
BINDIR:=$(PREFIX)/bin
BASHDIR:=$(PREFIX)/share/bash-completion/completions
ZSHDIR:=$(PREFIX)/share/zsh/site-functions
FISHDIR:=$(PREFIX)/share/fish/vendor_completions.d
ELVDIR:=$(PREFIX)/share/elvish/lib
NUDIR:=$(PREFIX)/share/nushell/completions
FIGDIR:=$(PREFIX)/share/fig/autocomplete
build: target/debug/satty
build-release: target/release/satty
force-build:
cargo build --features ci-release
force-build-release:
cargo build --release --features ci-release
target/debug/satty: $(SOURCEFILES) Cargo.lock Cargo.toml
cargo build --features ci-release
target/release/satty: $(SOURCEFILES) Cargo.lock Cargo.toml
cargo build --release --features ci-release
clean:
cargo clean
install: target/release/satty
install -s -Dm755 target/release/satty -t $(BINDIR)
install -Dm644 satty.desktop $(PREFIX)/share/applications/satty.desktop
install -Dm644 assets/satty.svg $(PREFIX)/share/icons/hicolor/scalable/apps/satty.svg
install -Dm644 LICENSE $(PREFIX)/share/licenses/satty/LICENSE
install -Dm644 completions/_satty $(ZSHDIR)/_satty
install -Dm644 completions/satty.bash $(BASHDIR)/satty
install -Dm644 completions/satty.fish $(FISHDIR)/satty.fish
install -Dm644 completions/satty.elv $(ELVDIR)/satty.elv
install -Dm644 completions/satty.nu $(NUDIR)/satty.nu
install -Dm644 completions/satty.ts $(FIGDIR)/satty.ts
install -Dm644 man/satty.1 ${PREFIX}/share/man/man1
uninstall:
rm ${BINDIR}/satty
rmdir -p ${PREFIX}/bin || true
rm ${PREFIX}/share/applications/satty.desktop
rmdir -p ${PREFIX}/share/applications || true
rm ${PREFIX}/share/icons/hicolor/scalable/apps/satty.svg
rmdir -p ${PREFIX}/share/icons/hicolor/scalable/apps || true
rm ${PREFIX}/share/licenses/satty/LICENSE
rmdir -p ${PREFIX}/share/licenses/satty || true
rm ${PREFIX}/share/man/man1/satty.1
rm $(ZSHDIR)/_satty
rmdir -p $(ZSHDIR) || true
rm $(BASHDIR)/satty
rmdir -p $(BASHDIR) || true
rm $(FISHDIR)/satty.fish
rmdir -p $(FISHDIR) || true
rm $(ELVDIR)/satty.elv
rmdir -p $(ELVDIR) || true
rm $(NUDIR)/satty.nu
rmdir -p $(NUDIR) || true
rm $(FIGDIR)/satty.ts
rmdir -p $(FIGDIR) || true
package: clean build-release
$(eval TMP := $(shell mktemp -d))
echo "Temporary folder ${TMP}"
# install to tmp
PREFIX=${TMP} make install
# create package
$(eval LATEST_TAG := $(shell git describe --tags --abbrev=0))
tar -czvf satty-${LATEST_TAG}-x86_64.tar.gz -C ${TMP} .
# clean up
rm -rf $(TMP)
fix:
cargo fmt --all
cargo clippy --fix --allow-dirty --all-targets --all-features -- -D warnings
STARTPATTERN:=» satty --help
ENDPATTERN=```
# sed command adds command line help to README.md
# within startpattern and endpattern:
# when startpattern is found, print it and read stdin
# when endpattern is found, print it
# everything else, delete
#
# The double -e is needed because r command cannot be terminated with semicolon.
# -i is tricky to use for both BSD/busybox sed AND GNU sed at the same time, so use mv instead.
update-readme: target/release/satty
target/release/satty --help 2>&1 | sed -e '/${STARTPATTERN}/,/${ENDPATTERN}/{ /${STARTPATTERN}/p;r /dev/stdin' -e '/${ENDPATTERN}/p; d; }' README.md > README.md.new
mv README.md.new README.md