-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (73 loc) · 1.95 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
default: build
version := "v0.0.4"
version_description := "Docker Machine Driver Plugin to access CloudUnit"
human_name := "CloudUnit Driver"
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
github_user := "Treeptik"
project := "github.com/$(github_user)/$(current_dir)"
bin_suffix := ""
containerbuild:
docker build -t $(current_dir) .
docker run \
-v $(shell pwd):/go/src/$(project) \
-e GOOS \
-e GOARCH \
-e GO15VENDOREXPERIMENT=1 \
$(current_dir) \
make build
containerrelease:
docker build -t $(current_dir) .
docker run \
-v $(shell pwd):/go/src/$(project) \
-e GOOS \
-e GOARCH \
-e GITHUB_TOKEN \
-e GO15VENDOREXPERIMENT=1 \
$(current_dir) \
make release
clean:
rm bin/docker-machine*
compile:
GOGC=off CGOENABLED=0 go build -ldflags "-s" -o bin/$(current_dir)$(BIN_SUFFIX) main.go
print-success:
@echo
@echo "Plugin built."
@echo
@echo "To use it, either run 'make install' or set your PATH environment variable correctly."
build: compile print-success
cross:
for os in darwin linux; do \
for arch in amd64; do \
GOOS=$$os GOARCH=$$arch BIN_SUFFIX=_$$os-$$arch $(MAKE) compile & \
done; \
done; \
wait
install:
cp bin/docker-machine-driver-cloudunit_darwin-amd64 /usr/local/bin/$(current_dir)
cleanrelease:
github-release delete \
--user $(github_user) \
--repo $(current_dir) \
--tag $(version)
git tag -d $(version)
git push origin :refs/tags/$(version)
release: cross
git tag $(version)
git push --tags
github-release release \
--user $(github_user) \
--repo $(current_dir) \
--tag $(version) \
--name $(human_name) \
--description $(version_description)
for os in darwin windows linux; do \
for arch in amd64; do \
github-release upload \
--user $(github_user) \
--repo $(current_dir) \
--tag $(version) \
--name bin/$(current_dir)_$$os-$$arch \
--file bin/$(current_dir)_$$os-$$arch; \
done; \
done