-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
100 lines (76 loc) · 2.18 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
.PHONY: all build test clean doc install dev-install dev-uninstall
# These variables are used to generate compatibilitytool.vdf:
#
tool_name = luxtorpeda
tool_name_dev = luxtorpeda_dev
tool_name_display = Luxtorpeda
tool_name_display_dev = Luxtorpeda (dev)
# Default names for installation directories:
#
tool_dir = luxtorpeda
tool_dir_dev = luxtorpeda-dev
files = compatibilitytool.vdf \
toolmanifest.vdf \
packages.json \
luxtorpeda \
LICENSE \
README.md
ifeq ($(origin XDG_DATA_HOME), undefined)
data_home := ${HOME}/.local/share
else
data_home := ${XDG_DATA_HOME}
endif
STRIP := strip
PREFIX := /usr/local
install_dir = $(DESTDIR)/$(PREFIX)/share/steam/compatibilitytools.d/$(tool_dir)
dev_install_dir = $(data_home)/Steam/compatibilitytools.d/$(tool_dir_dev)
build:
cargo build
release:
cargo build --release
lint:
cargo clippy -- -D warnings
test:
cargo test
clean:
cargo clean
rm -rf $(tool_dir)
rm -f $(tool_dir).tar.xz
doc:
cargo doc --document-private-items --open
target/debug/compatibilitytool.vdf: compatibilitytool.template
sed 's/%name%/$(tool_name_dev)/; s/%display_name%/$(tool_name_display_dev)/' $< > $@
target/release/compatibilitytool.vdf: compatibilitytool.template
sed 's/%name%/$(tool_name)/; s/%display_name%/$(tool_name_display)/' $< > $@
target/debug/%: %
cp --reflink=auto $< $@
target/release/%: %
cp --reflink=auto $< $@
$(tool_dir): \
release \
target/release/compatibilitytool.vdf \
target/release/toolmanifest.vdf \
target/release/packages.json \
target/release/LICENSE \
target/release/README.md
mkdir -p $(tool_dir)
cd target/release && cp --reflink=auto -t ../../$(tool_dir) $(files)
$(STRIP) luxtorpeda/luxtorpeda
$(tool_dir).tar.xz: $(tool_dir)
tar -cJf $@ $(tool_dir)
install: $(tool_dir)
mkdir -p $(install_dir)
cp -av $(tool_dir)/* $(install_dir)/
dev-install: \
build \
target/debug/compatibilitytool.vdf \
target/debug/toolmanifest.vdf \
target/debug/packages.json \
target/debug/LICENSE \
target/debug/README.md
mkdir -p $(dev_install_dir)
cd target/debug && cp --reflink=auto -t $(dev_install_dir) $(files)
dev-uninstall:
rm -rf $(dev_install_dir)
check-formatting:
cargo fmt -- --check