-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (31 loc) · 1.05 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
.PHONY: error build test lint cp-wasm-exec build-wasm test-wasm
error:
@echo "specify make target"
@exit 1
# build
# build wasm packages separately
build:
go build `go list ./... | grep -v wasm`
GOOS=js GOARCH=wasm go build `go list ./... | grep wasm`
# test w/ output history
test:
go test ./... -output-history
# test w/ output history and fail if any output changes are found
test-check-output:
go test ./... -output-history
git diff --exit-code
# lint
lint:
golangci-lint run
######################################################### wasm #########################################################
# copy Go's wasm_exec to this project
cp-wasm-exec:
mkdir -p memory/wasm/assets
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js memory/wasm/assets/.
# build memory/wasm and place in assets dir
build-wasm:
mkdir -p memory/wasm/assets
(cd memory/wasm/main && GOOS=js GOARCH=wasm go build -o main.wasm && mv main.wasm ../assets/.)
# starts up a local webserver for testing the wasm build
test-wasm: cp-wasm-exec build-wasm
go run memory/wasm/test-server/main.go