-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
41 lines (29 loc) · 1.11 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
VERSION=2.8
GIT_COMMIT = `git rev-parse HEAD | cut -c1-7`
BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)"
STATIC_OPTIONS = -ldflags "-extldflags='-static' -X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)"
revsocks: dep
go build ${BUILD_OPTIONS}
dep:
#go get -u ./...
go get
tools:
go install github.com/mitchellh/gox@latest
go install github.com/tcnksm/ghr@latest
ver:
echo version $(VERSION)
gittag:
git tag v$(VERSION)
git push --tags origin master
clean:
rm -rf dist
dist:
mkdir -p dist
gox:
CGO_ENABLED=0 gox -osarch="!darwin/386" -ldflags="-s -w -X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
goxwin:
CGO_ENABLED=0 gox -osarch="windows/amd64 windows/386" -ldflags="-s -w -X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
dokbuild:
docker run -it --rm -v $(PWD):/app golang:alpine /bin/sh -c 'apk add make file git && git config --global --add safe.directory /app && cd /app && make -B tools && make gox && make goxwin'
draft:
ghr -draft v$(VERSION) dist/