-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (80 loc) · 2.72 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
BINDIR := $(CURDIR)/bin
BINNAME ?= si
VERSION ?= 0.3.0
SHELL = /usr/bin/env bash
GOBIN = $(shell go env GOBIN)
ifeq ($(GOBIN),)
GOBIN = $(shell go env GOPATH)/bin
endif
.PHONY: build
build: build-linux build-linux-armv7 build-linux-mips build-mac build-mac-arm build-windows
.PHONY: build-windows
build-windows: export GOOS=windows
build-windows: export GOARCH=amd64
build-windows: export GO111MODULE=on
build-windows: export GOPROXY=$(MOD_PROXY_URL)
build-windows:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-windows-amd64 cmd/si/main.go
.PHONY: build-linux
build-linux: export GOOS=linux
build-linux: export GOARCH=amd64
build-linux: export CGO_ENABLED=0
build-linux: export GO111MODULE=on
build-linux: export GOPROXY=$(MOD_PROXY_URL)
build-linux:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-linux-amd64 cmd/si/main.go
.PHONY: build-linux-mips
build-linux-mips: export GOOS=linux
build-linux-mips: export GOARCH=mips64le
build-linux-mips: export CGO_ENABLED=0
build-linux-mips: export GO111MODULE=on
build-linux-mips: export GOPROXY=$(MOD_PROXY_URL)
build-linux-mips:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-linux-mips64 cmd/si/main.go
.PHONY: build-linux-armv7
build-linux-armv7: export GOOS=linux
build-linux-armv7: export GOARCH=arm
build-linux-armv7: export GOARM=7
build-linux-armv7: export CGO_ENABLED=0
build-linux-armv7: export GO111MODULE=on
build-linux-armv7: export GOPROXY=$(MOD_PROXY_URL)
build-linux-armv7:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-linux-armv7 cmd/si/main.go
.PHONY: build-mac
build-mac: export GOOS=darwin
build-mac: export GOARCH=amd64
build-mac: export CGO_ENABLED=0
build-mac: export GO111MODULE=on
build-mac: export GOPROXY=$(MOD_PROXY_URL)
build-mac:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-darwin-amd64 cmd/si/main.go
.PHONY: build-mac-arm
build-mac-arm: export GOOS=darwin
build-mac-arm: export GOARCH=arm64
build-mac-arm: export CGO_ENABLED=0
build-mac-arm: export GO111MODULE=on
build-mac-arm: export GOPROXY=$(MOD_PROXY_URL)
build-mac-arm:
go build -v --ldflags="-w -X main.Version=$(VERSION)" \
-o bin/$(BINNAME)-darwin-arm64 cmd/si/main.go
.PHONY: clean
clean:
rm -f $(BINDIR)/*
.PHONY: dist
dist:
for f in $$(ls -1 bin/$(BINNAME)-*-{arm64,armv7,amd64,mips64} 2>/dev/null) ; do \
echo "Creating $${f}-v$(VERSION).tar.gz" ; \
tar -czvf bin/$$(basename $${f})-v$(VERSION).tar.gz $${f} README.md LICENSE; \
done
.PHONY: checksum
checksum:
cd $(BINDIR) ; \
for f in $$(ls -1 $(BINNAME)-*.tar.gz 2>/dev/null) ; do \
echo "Creating $${f}.sha256sum" ; \
shasum -a 256 "$${f}" > "$${f}.sha256sum" ; \
done