-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (28 loc) · 869 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
34
35
36
37
38
39
cmds = kwt kwtd
vfile = pkg/version/version.go
vdata = `git describe --tags`-`git log -1 --format=%cd --date=format:"%Y%m%d%H%M%S"`
.PHONY: $(cmds) all clean version tidy assets third package
all: $(cmds)
clean:
rm -f $(cmds) $(addsuffix .exe, $(cmds))
$(cmds): version tidy
go build -mod=mod ./cmd/$@
version:
rm -f $(vfile)
@echo "package version" > $(vfile)
@echo "const (" >> $(vfile)
@echo " Version = \"$(vdata)\"" >> $(vfile)
@echo ")" >> $(vfile)
tidy:
go mod tidy && go mod vendor && go fmt ./pkg/* ./cmd/*
kwtd: assets
assets: third
go install github.com/jessevdk/go-assets-builder@latest && \
cd ./cmd/kwtd && \
go-assets-builder -s=/assets/ -o assets.go assets
third:
GOOS= GOARCH= go run cmd/prebuild/main.go
package: $(cmds)
zip -q dist/kwt-$$GOOS-$$GOARCH-$(vdata).zip kwt* kwtd* LICENSE README.md
test: version
go test ./pkg/*