-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
124 lines (92 loc) · 3.36 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
116
117
118
119
120
121
122
123
124
.PHONY: all workspace ui ncube ncubed \
pkg-bin pkg-deb pkg-deb-ncubed pkg-web-ext clean clean-dist clean-build clean-pkgs \
verify verify-ui verify-backend verify-web-ext test test-ui test-backend fmt-backend
target_dir = target
ui_dir = $(target_dir)/ui
webext_dir = $(target_dir)/web-ext
workspace_dir = $(target_dir)/workspace
backend_dir = $(target_dir)/release
pkg_build_dir = $(target_dir)/pkgs
pkg_build_macos = $(pkg_build_dir)/Ncube.app
workspace_archive = $(workspace_dir)/workspace.tar.gz
pkgs_release_dir = pkgs
node_deps_dir = node_modules
all: ncube
ui: $(ui_dir)
ncube: $(backend_dir)/ncube
workspace: $(workspace_archive)
ncubed: $(backend_dir)/ncubed $(backend_dir)/ncubectl
$(node_deps_dir):
yarn install
$(ui_dir): $(node_deps_dir)
yarn compile:ui
$(webext_dir): $(node_deps_dir)
yarn compile:web-ext
$(workspace_archive):
@mkdir -p $(workspace_dir)
./scripts/build_workspace.sh $(workspace_dir) $(workspace_archive)
$(backend_dir)/ncube: $(ui_dir) $(workspace_archive)
@mkdir -p $(backend_dir)
cargo build --bin ncube --release
$(backend_dir)/ncubed: $(ui_dir) $(workspace_archive)
@mkdir -p $(backend_dir)
cargo build --bin ncubed --release
$(backend_dir)/ncubectl: $(ui_dir) $(workspace_archive)
@mkdir -p $(backend_dir)
cargo build --bin ncubectl --release
$(pkg_build_macos): $(backend_dir)/ncube
@mkdir -p $(pkg_build_macos)/Contents/{MacOS,Resources}
cp -r resources/Info.plist $(pkg_build_macos)/Contents
cp -r resources/icon.icns $(pkg_build_macos)/Contents/Resources/ncube.icns
cp -r $(backend_dir)/ncube $(pkg_build_macos)/Contents/MacOS/ncube-bin
cp -r scripts/macos_launch.sh $(pkg_build_macos)/Contents/MacOS/Ncube
chmod +x $(pkg_build_macos)/Contents/MacOS/ncube-bin
chmod +x $(pkg_build_macos)/Contents/MacOS/Ncube
# TODO: If I don't provide a signing code the create-dmg command returns an
# error. To make make not choke up on that I force a good return.
pkg-dmg: $(pkg_build_macos)
@mkdir -p $(pkgs_release_dir)
@scripts/build_dmg.sh -f $(pkg_build_macos) $(pkgs_release_dir)
pkg-bin: $(backend_dir)/ncube
@mkdir -p $(pkgs_release_dir)
cp $(backend_dir)/ncube $(pkgs_release_dir)/ncube-$(shell uname -s | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/")
pkg-deb: $(backend_dir)/ncube
@mkdir -p $(pkgs_release_dir)
cargo deb -p ncube
cp target/debian/ncube*.deb $(pkgs_release_dir)
pkg-deb-ncubed: $(backend_dir)/ncubed $(backend_dir)/ncubectl
@mkdir -p $(pkgs_release_dir)
cargo deb -p ncubed
cp target/debian/ncubed*.deb $(pkgs_release_dir)
pkg-web-ext: web-ext
@mkdir -p $(pkgs_release_dir)
node_modules/.bin/web-ext build -s $(webext_dir) -a $(pkgs_release_dir) --overwrite-dest
clean: clean-pkgs clean-dist
clean-dist:
rm -rf $(backend_dir)/ncube
rm -rf $(backend_dir)/ncubed
rm -rf $(backend_dir)/ncubectl
rm -rf $(ui_dir)
rm -rf $(webext_dir)
rm -rf $(workspace_dir)
rm -f $(workspace_archive)
clean-build:
rm -rf $(pkg_build_dir)
clean-web-ext:
rm -rf $(webext_dir)
clean-pkgs:
rm -rf $(pkgs_release_dir)
verify: verify-ui verify-web-ext verify-backend
verify-ui: $(node_deps_dir)
yarn run-p lint:eslint lint:tsc
verify-web-ext: $(webext_dir)
yarn web-ext:lint
verify-backend: $(ui_dir) $(workspace_archive)
cargo check --all --all-features
test: test-ui test-backend
test-ui:
yarn test
test-backend: $(ui_dir) $(workspace_archive)
cargo test --all --all-features
fmt-backend:
cargo fmt --all -- --check