-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (26 loc) · 825 Bytes
/
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
.PHONY: all clean test server
.SUFFIXED: .wasm .js .rs .ts
TS_ROOT = ts/
TS_SRC = $(TS_ROOT)src/
TS_DIST = $(TS_ROOT)dist/
TS_MAIN = $(TS_DIST)main.js
RS_SRC = rs/
RS_LIB = ts/lib/libtsc_bg.wasm
TOOLS = tools/
all: $(RS_LIB) $(TS_MAIN)
clean:
(cd $(RS_SRC); cargo clean)
-rm $(RS_LIB) $(TS_MAIN)
-rm -rf $(TS_DIST)
debug:
(cd $(RS_SRC); cargo build)
cp target/wasm32-unknown-unknown/debug/libimage.wasm $(RS_LIB)
$(RS_LIB): $(RS_SRC)src/*.rs
echo "export const HASH = \"`git rev-parse --short HEAD`\";" > ts/src/hash.ts
(cd $(RS_SRC); cargo build --release)
wasm-bindgen target/wasm32-unknown-unknown/release/libimage.wasm --out-dir ts/lib
cargo run -p wasm-strip -- -strip-all ts/lib/libimage_bg.wasm
$(TS_MAIN): $(RS_LIB) $(TS_SRC)*.ts
(cd $(TS_ROOT); npm i; npm run build)
server:
(cd ts; npm run start)