-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
88 lines (75 loc) · 3.3 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
.PHONY: hello
hello: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./hello/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: tinygo
tinygo: clean
docker run --rm -v $$(pwd):/go/src/github.com/johanbrandhorst/wasm-experiments tinygo/tinygo:latest /bin/bash -c "\
cd /go/src/github.com/johanbrandhorst/wasm-experiments && \
tinygo build -o ./html/test.wasm -target wasm --no-debug ./$(target)/main.go && \
cp /usr/local/tinygo/targets/wasm_exec.js ./html/wasm_exec.js\
"
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
sed -i -e 's;</button>;</button>\n\t<div id=\"target\"></div>;' ./html/index.html
.PHONY: channels
channels: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./channels/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: js
js: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./js/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
sed -i -e 's;</button>;</button>\n\t<div id=\"target\"></div>;' ./html/index.html
.PHONY: fetch
fetch: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./fetch/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
sed -i -e 's;</button>;</button>\n\t<div id=\"target\"></div>;' ./html/index.html
.PHONY: canvas
canvas: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./canvas/main.go
cp ./canvas/index.html ./html/index.html
cp ./canvas/main.go ./html/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
tinygo-canvas: clean
docker run --rm -v $$(pwd):/go/src/github.com/johanbrandhorst/wasm-experiments tinygo/tinygo:latest /bin/bash -c "\
cd /go/src/github.com/johanbrandhorst/wasm-experiments && \
tinygo build -o ./html/test.wasm -target wasm --no-debug ./canvas/main.go && \
cp /usr/local/tinygo/targets/wasm_exec.js ./html/wasm_exec.js\
"
cp ./canvas/index.html ./html/index.html
cp ./canvas/main.go ./html/main.go
.PHONY: ebitengine
ebitengine: clean
GOOS=js GOARCH=wasm go build -o ./html/ebitengine.wasm ./ebitengine/main.go
cp ./ebitengine/index.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: vugu
vugu: clean
go install github.com/vugu/vugu/cmd/vugugen@latest
vugugen --skip-go-mod ./vugu/
GOOS=js GOARCH=wasm go build -o ./html/main.wasm ./vugu/
cp ./vugu/index.html ./html/
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: vecty
vecty: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./vecty/main.go
cp ./vecty/index.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: export
export: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./export/main.go
cp ./export/index.html ./html/index.html
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
.PHONY: test
test: install-test
GOOS=js GOARCH=wasm go test -v ./test/
clean:
rm -f ./html/*
install-test:
go install github.com/agnivade/wasmbrowsertest@latest
mv $$(go env GOPATH)/bin/wasmbrowsertest $$(go env GOPATH)/bin/go_js_wasm_exec