forked from heng30/slint-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (80 loc) · 3.13 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
108
109
110
111
112
113
114
115
#!/bin/sh
pwd=${shell pwd}
app-name=slint-template
version=`git describe --tags --abbrev=0`
build-env=
android-build-env=SLINT_STYLE=material $(build-env)
desktop-build-env=SLINT_STYLE=fluent $(build-env)
web-build-env=SLINT_STYLE=fluent $(build-env)
run-env=RUST_LOG=debug,sqlx=off,reqwest=off
all: desktop-build-release
android-build:
$(android-build-env) cargo apk build --lib --features=android
android-build-release:
$(android-build-env) cargo apk build --lib --release --features=android
android-debug:
$(android-build-env) $(run-env) cargo apk run --lib --features=android
desktop-build-debug:
$(desktop-build-env) cargo build --features=desktop
desktop-build-release:
$(desktop-build-env) cargo build --release --features=desktop
desktop-build-debug-nixos:
nix-shell --run "$(desktop-build-env) cargo build --features=desktop"
desktop-build-release-nixos:
nix-shell --run "$(desktop-build-env) cargo build --release --features=desktop"
desktop-debug:
$(desktop-build-env) $(run-env) cargo run --features=desktop
web-build-debug:
$(web-build-env) wasm-pack build --target web --out-dir ./web/pkg --features=web
web-build-release:
$(web-build-env) wasm-pack build --release --target web --out-dir ./web/pkg --features=web
web-build-dist:
- rm -rf ./web/dist/*
$(web-build-env) wasm-pack build --release --target web --out-dir ./web/dist/pkg --features=web
cp -f ./web/index.html ./web/dist
cp -f ./ui/images/brand.png ./web/dist/pkg/favicon.png
web-server:
python3 -m http.server -d web 8000
web-server-dist:
python3 -m http.server -d web/dist 8800
packing-android:
cp -f target/release/apk/${app-name}.apk target/${app-name}-${version}-aarch64-linux-android.apk
echo "${app-name}-${version}-aarch64-linux-android.apk" > target/output-name
packing-linux:
cp -f target/release/${app-name} target/${app-name}-${version}-x86_64-linux
echo "${app-name}-${version}-x86_64-linux" > target/output-name
packing-windows:
cp -f target/release/${app-name}.exe target/${app-name}-${version}-x86_64-windows.exe
echo "${app-name}-${version}-x86_64-windows.exe" > target/output-name
packing-darwin:
cp -f target/release/${app-name} target/${app-name}-${version}-x86_64-darwin
echo "${app-name}-${version}-x86_64-darwin" > target/output-name
packing-web:
tar -zcf target/$(app-name)-$(version)-web.tar.gz web/dist
echo "$(app-name)-$(version)-web.tar.gz" > target/output-name
reduce-linux-binary-size:
upx -9 target/release/$(app-name)
slint-viewer-android:
$(android-build-env) slint-viewer --auto-reload -I ui ./ui/android-window.slint
slint-viewer-desktop:
$(desktop-build-env) slint-viewer --auto-reload -I ui ./ui/desktop-window.slint
slint-viewer-web:
$(web-build-env) slint-viewer --auto-reload -I ui ./ui/web-window.slint
test:
$(build-env) $(run-env) cargo test -- --nocapture
clippy:
cargo clippy
clean-incremental:
rm -rf ./target/debug/incremental
rm -rf ./target/aarch64-linux-android/debug/incremental
clean-unused-dependences:
cargo machete
clean:
cargo clean
app-name:
- mkdir -p target
echo "$(app-name)" > target/app-name
get-font-name:
fc-scan ./ui/fonts/SourceHanSerifCN.ttf | grep fullname
outdated:
cargo outdated