-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
49 lines (36 loc) · 1.35 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
.PHONY : build dist dist-clean release tag-release deps vet test lint
NAME=docker-machine-driver-vultr
VERSION := $(shell cat VERSION)
ifneq ($(CIRCLE_BUILD_NUM),)
BUILD:=$(VERSION)-$(CIRCLE_BUILD_NUM)
else
BUILD:=$(VERSION)
endif
LDFLAGS:=-X main.Version=$(VERSION)
all: build
build:
mkdir -p build
go build -a -ldflags "$(LDFLAGS)" -o build/$(NAME)-$(BUILD) ./bin
tag-release:
git tag -f $(VERSION)
git push -f origin master --tags
deps:
go get -v github.com/tcnksm/ghr
go get -v github.com/golang/lint/golint
lint:
@golint $$(go list ./... 2> /dev/null | grep -v /vendor/)
vet:
@go vet $$(go list ./... 2> /dev/null | grep -v /vendor/)
test: lint vet
@go test $$(go list ./... 2> /dev/null | grep -v /vendor/)
dist-clean:
rm -rf release
dist: dist-clean
mkdir -p release
GOOS=linux GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o release/$(NAME)-Linux-x86_64 ./bin
GOOS=linux GOARCH=arm GOARM=6 go build -a -ldflags "$(LDFLAGS)" -o release/$(NAME)-Linux-armhf ./bin
GOOS=darwin GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o release/$(NAME)-Darwin-x86_64 ./bin
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o release/$(NAME)-Windows-x86_64.exe ./bin
for file in release/$(NAME)-*; do openssl dgst -md5 < $${file} > $${file}.md5; done
release: dist
ghr -u janeczku -r docker-machine-vultr --replace $(VERSION) release/