-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
197 lines (162 loc) · 7.57 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# <general>
.phony: build-slightjs-cli
build-slightjs-cli:
cargo build --release --package slightjs-cli
.PHONY: compile-slight-engine
compile-slight-engine:
cargo build --package slightjs-engine --target wasm32-wasi
.PHONY: improve
improve:
cargo clippy --all-targets --all-features --workspace -- -D warnings
cargo fmt --all -- --check
.PHONY: install-deps-linux
install-deps-linux:
set -x
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sdk-15.0-linux.tar.gz
tar xf wasi-sdk-15.0-linux.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-15.0/* /opt/wasi-sdk/
sudo rm -rf wasi-sdk-*
.PHONY: install-deps-macos
install-deps-macos:
set -x
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sdk-15.0-macos.tar.gz
tar xf wasi-sdk-15.0-macos.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-15.0/* /opt/wasi-sdk/
sudo rm -rf wasi-sdk-*
.PHONY: install-deps-win
install-deps-win:
choco install wget -y
wget -O wasi-sdk-15.0-mingw.tar.gz https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sdk-15.0-mingw.tar.gz
mkdir -p C:\wasi-sdk
tar -xvzf wasi-sdk-15.0-mingw.tar.gz --strip-components=1 -C C:\wasi-sdk
.PHONY: prepare-release-linux
prepare-release-linux:
tar -C target/ -czvf slightjs-linux-x86_64.tar.gz release/slightjs
.PHONY: prepare-release-win
prepare-release-win:
tar -C target/ -czvf slightjs-windows-x86_64.tar.gz release/slightjs.exe
.PHONY: prepare-release-mac
prepare-release-mac:
tar -C target/ -czvf slightjs-macos.tar.gz release/slightjs
# </general>
# <keyvalue>
.PHONY: compile-keyvalue-example
compile-keyvalue-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/keyvalue/index.js ./keyvalue.wasm
.PHONY: run-keyvalue-example
run-keyvalue-example:
slight -c ./examples/keyvalue/slightfile.toml run keyvalue.wasm -l
.PHONY: keyvalue-all-in-one
keyvalue-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/keyvalue/index.js ./keyvalue.wasm
slight -c ./examples/keyvalue/slightfile.toml run keyvalue.wasm -l
# </keyvalue>
# <http-server>
.PHONY: compile-http-server-example
compile-http-server-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/http-server/index.js ./http-server.wasm
.PHONY: run-http-server-example
run-http-server-example:
slight -c ./examples/http-server/slightfile.toml run http-server.wasm -l
.PHONY: http-all-in-one
http-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/http-server/index.js ./http-server.wasm
slight -c ./examples/http-server/slightfile.toml run http-server.wasm -l
# </http-server>
# <messaging>
.PHONY: compile-messaging-example
compile-messaging-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/messaging/index.js ./messaging.wasm
.PHONY: run-messaging-example
run-messaging-example:
slight -c ./examples/messaging/slightfile.toml run messaging.wasm -l
.PHONY: messaging-all-in-one
messaging-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/messaging/index.js ./messaging.wasm
slight -c ./examples/messaging/slightfile.toml run messaging.wasm -l
# </messaging>
# <app>
.PHONY: compile-app-example
compile-app-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/app/backend/index.js ./app.wasm
.PHONY: run-app-example
run-app-example:
slight -c ./examples/app/backend/slightfile.toml run app.wasm -l
.PHONY: app-all-in-one
app-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/app/backend/index.js ./app.wasm
slight -c ./examples/app/backend/slightfile.toml run app.wasm -l
# </app>
# <sql>
.PHONY: compile-sql-example
compile-sql-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/sql/index.js ./sql.wasm
.PHONY: run-sql-example
run-sql-example:
slight -c ./examples/sql/slightfile.toml run sql.wasm -l
.PHONY: sql-all-in-one
sql-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/sql/index.js ./sql.wasm
slight -c ./examples/sql/slightfile.toml run sql.wasm -l
# </sql>
# <http-client>
.PHONY: compile-http-client-example
compile-http-client-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/http-client/index.js ./http-client.wasm
.PHONY: run-http-client-example
run-http-client-example:
slight -c ./examples/http-client/slightfile.toml run http-client.wasm -l
.PHONY: http-client-all-in-one
http-client-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/http-client/index.js ./http-client.wasm
slight -c ./examples/http-client/slightfile.toml run http-client.wasm -l
# </http-client>
# <blob-store>
.PHONY: compile-blob-store-example
compile-blob-store-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/blob-store/index.js ./blob-store.wasm
.PHONY: run-blob-store-example
run-blobs-tore-example:
slight -c ./examples/blob-store/slightfile.toml run blob-store.wasm -l
.PHONY: blob-store-all-in-one
blob-store-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/blob-store/index.js ./blob-store.wasm
slight -c ./examples/blob-store/slightfile.toml run blob-store.wasm -l
# </blob-store>
# <configs>
.PHONY: compile-configs-example
compile-configs-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/configs/index.js ./configs.wasm
.PHONY: run-configs-example
run-configs-example:
slight -c ./examples/configs/slightfile.toml run configs.wasm -l
.PHONY: configs-all-in-one
configs-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/configs/index.js ./configs.wasm
slight -c ./examples/configs/slightfile.toml run configs.wasm -l
# </configs>
# <distributed-locking>
.PHONY: compile-distributed-locking-example
compile-distributed-locking-example:
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/distributed-locking/index.js ./distributed-locking.wasm
.PHONY: run-distributed-locking-example
run-distributed-locking-example:
slight -c ./examples/distributed-locking/slightfile.toml run distributed-locking.wasm -l &
slight -c ./examples/distributed-locking/slightfile.toml run distributed-locking.wasm -l
.PHONY: distributed-locking-all-in-one
distributed-locking-all-in-one:
cargo build --package slightjs-engine --target wasm32-wasi
cargo run --package slightjs-cli -- ./target/wasm32-wasi/debug/slightjs_engine.wasm ./examples/distributed-locking/index.js ./distributed-locking.wasm
slight -c ./examples/distributed-locking/slightfile.toml run distributed-locking.wasm -l &
slight -c ./examples/distributed-locking/slightfile.toml run distributed-locking.wasm -l
# </distributed-locking>