-
Notifications
You must be signed in to change notification settings - Fork 50
/
Makefile
57 lines (40 loc) · 1.23 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
# command to build and run on the local OS.
GO_BUILD = go build
# command to compiling the distributable. Specify GOOS and GOARCH for
# the target OS.
GO_DIST = CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO_BUILD) -a -tags netgo -ldflags '-w'
APP = sqsmv
TMP_BUILD = tmp/$(APP)
DIST_DIR = dist
TAG ?= `git describe --tags | sed -e 's/^v//'`
.PHONY: dist
all: clean tools lint goimports vet dist
deps:
go get -t ./...
prepare:
mkdir -p build dist
tools:
go get golang.org/x/tools/cmd/goimports
go get golang.org/x/lint/golint
lint: golint vet goimports vet
vet:
go vet
golint:
ret=0 && test -z "$$(golint . | tee /dev/stderr)" || ret=1 ; exit $$ret
goimports:
ret=0 && test -z "$$(goimports -l . | tee /dev/stderr)" || ret=1 ; exit $$ret
dist: prepare dist-linux dist-darwin dist-windows
dist-linux:
GOOS=linux GOARCH=amd64 go build -o $(TMP_BUILD)
tar -C tmp -zcvf $(DIST_DIR)/$(APP)-$(TAG)-linux.gz $(APP)
rm $(TMP_BUILD)
dist-darwin:
GOOS=darwin GOARCH=amd64 go build -o $(TMP_BUILD)
tar -C tmp -zcvf $(DIST_DIR)/$(APP)-$(TAG)-darwin.gz $(APP)
rm $(TMP_BUILD)
dist-windows:
GOOS=windows GOARCH=amd64 go build -o $(TMP_BUILD)
tar -C tmp -zcvf $(DIST_DIR)/$(APP)-$(TAG)-windows.gz $(APP)
rm $(TMP_BUILD)
clean:
rm -rf build dist