-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
60 lines (49 loc) · 1.94 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
.PHONY : build clean fmt release
NAME=docker-machine-driver-gandi
VERSION:=$(shell git describe --abbrev=0 --tags)
#ifdef $CIRCLE_BUILD_NUM
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
dist-clean:
rm -rf dist
rm -rf release
dist: dist-clean
mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o dist/linux/amd64/$(NAME) ./bin
mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -a -ldflags "$(LDFLAGS)" -o dist/linux/armhf/$(NAME) ./bin
mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/$(NAME) ./bin
mkdir -p dist/windows/amd64 && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -ldflags "$(LDFLAGS)" -o dist/windows/amd64/$(NAME).exe ./bin
release: dist
mkdir -p release
tar -cvzf release/$(NAME)-$(VERSION)-linux-amd64.tar.gz -C dist/linux/amd64 $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-linux-armhf.tar.gz -C dist/linux/armhf $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-darwin-amd64.tar.gz -C dist/darwin/amd64 $(NAME)
tar -cvzf release/$(NAME)-$(VERSION)-windows-amd64.tar.gz -C dist/windows/amd64 $(NAME).exe
ghr -u gandi -r docker-machine-gandi --replace $(VERSION) release/
get-deps:
go get github.com/tcnksm/ghr
go get github.com/tools/godep
go get github.com/ChimeraCoder/tokenbucket
go get github.com/docker/machine
go get github.com/docker/docker/pkg/term
go get golang.org/x/crypto/ssh
go get golang.org/x/crypto/ssh/terminal
go get github.com/Azure/go-ansiterm
go get github.com/Sirupsen/logrus
go get github.com/gandi/docker-machine-gandi
check-gofmt:
if [ -n "$(shell gofmt -l .)" ]; then \
echo 1>&2 'The following files need to be formatted:'; \
gofmt -l .; \
exit 1; \
fi
test:
go vet .
go test -race ./...