-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathMakefile
53 lines (38 loc) · 1.82 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
CWD := $(shell pwd)
VERSION := $(shell cat VERSION)
LDFLAGS := -s -w \
-X 'main.BuildVersion=$(VERSION)' \
-X 'main.BuildGitBranch=$(shell git describe --all)' \
-X 'main.BuildGitRev=$(shell git rev-list --count HEAD)' \
-X 'main.BuildGitCommit=$(shell git rev-parse HEAD)' \
-X 'main.BuildDate=$(shell date -u -R)'
export GO111MODULE=on
default:
@ echo "no default target for Makefile"
clean:
rm -rf frep ./_releases ./_build
fmt:
go fmt ./...
lint:
go vet ./...
build:
go build -ldflags "$(LDFLAGS)"
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -a -installsuffix cgo -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-linux-amd64
build-all: clean fmt
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -a -installsuffix cgo -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 \
go build -a -installsuffix cgo -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-linux-arm64
GOOS=darwin GOARCH=amd64 \
go build -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-darwin-amd64
GOOS=darwin GOARCH=arm64 \
go build -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-darwin-arm64
GOOS=windows GOARCH=amd64 \
go build -ldflags "$(LDFLAGS)" -o _releases/frep-$(VERSION)-windows-amd64.exe
sha256sum _releases/frep-$(VERSION)-linux-amd64 > _releases/frep-$(VERSION)-linux-amd64.sha256
sha256sum _releases/frep-$(VERSION)-linux-arm64 > _releases/frep-$(VERSION)-linux-arm64.sha256
sha256sum _releases/frep-$(VERSION)-darwin-amd64 > _releases/frep-$(VERSION)-darwin-amd64.sha256
sha256sum _releases/frep-$(VERSION)-darwin-arm64 > _releases/frep-$(VERSION)-darwin-arm64.sha256
sha256sum _releases/frep-$(VERSION)-windows-amd64.exe > _releases/frep-$(VERSION)-windows-amd64.exe.sha256