-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (38 loc) · 1.19 KB
/
Copy pathMakefile
File metadata and controls
53 lines (38 loc) · 1.19 KB
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
CLI_NAME=viztruct
WASM_BINARY_NAME=main.wasm
OUTPUT_DIR=static
WASM_DIR=cmd/server
CLI_DIR=cmd/viztruct
PLUGIN_DIR=cmd/ci-plugin
PLUGIN_NAME=ci-plugin
GO_INSTALL_PATH=$(shell which go)
WASM_EXEC_PATH=$(GO_INSTALL_PATH)/lib/wasm/wasm_exec.js
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -X main.binVersion=$(VERSION)
default: build
build-wasm:
GOOS=js GOARCH=wasm go build -o $(OUTPUT_DIR)/$(WASM_BINARY_NAME) ./$(WASM_DIR)
build-cli:
go build -ldflags "$(LDFLAGS)" -o $(CLI_NAME) ./$(CLI_DIR)
build-plugin:
go build -ldflags "$(LDFLAGS)" -o $(PLUGIN_NAME) ./$(PLUGIN_DIR)
build: build-wasm build-cli build-plugin
clean:
go clean
rm -f $(OUTPUT_DIR)/$(WASM_BINARY_NAME)
wasm-exec:
cp $(WASM_EXEC_PATH) ./static
fmt:
go fmt ./...
test: fmt
go test ./structi/... ./svg/... -run "^Test[^B]"
test-race: fmt
go test --race ./structi/... ./svg/... -run "^Test[^B]"
regression-test:
go test -v --race ./structi/... -run TestRegression
benchmark:
go test -bench=. -benchmem ./structi/... -run=^$
serve:
npx http-server ./static --cors
all: clean build-wasm build-cli
.PHONY: build-wasm clean fmt test test-race regression-test benchmark serve all