Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Feb 27, 2018. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
43 lines (31 loc) · 1.41 KB
/
Copy pathMakefile
File metadata and controls
43 lines (31 loc) · 1.41 KB
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
VERSION := $(shell cat VERSION)
GITSHA1 := $(shell git rev-parse --short HEAD)
GOARCH := amd64
GOFLAGS := -ldflags "-X main.Version $(VERSION) -X main.GitSHA $(GITSHA1)"
PREFIX := boot2docker
DOCKER_IMAGE := boot2docker-golang
DOCKER_CONTAINER := boot2docker-cli-build
DOCKER_SRC_PATH := /go/src/github.com/boot2docker/boot2docker-cli
default: dockerbuild
@true # stop from matching "%" later
# Build binaries in Docker container.
dockerbuild: clean
docker build -t "$(DOCKER_IMAGE)".
docker run --name "$(DOCKER_CONTAINER)""$(DOCKER_IMAGE)"
docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-darwin-$(GOARCH).
docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-linux-$(GOARCH).
docker cp "$(DOCKER_CONTAINER)":"$(DOCKER_SRC_PATH)"/$(PREFIX)-$(VERSION)-windows-$(GOARCH).exe .
docker rm "$(DOCKER_CONTAINER)"
# Remove built binaries and Docker container. Silent errors if container not found.
clean:
rm -f $(PREFIX)*
docker rm "$(DOCKER_CONTAINER)"2>/dev/null ||true
all: darwin linux windows
@true # stop "all" from matching "%" later
# Native Go build per OS/ARCH combo.
%:
GOOS=$@ GOARCH=$(GOARCH) go build $(GOFLAGS) -o $(PREFIX)-$(VERSION)-$@-$(GOARCH)$(if$(filter windows, $@),.exe)
# This binary will be installed at $GOBIN or $GOPATH/bin. Requires proper
# $GOPATH setup AND the location of the source directory in $GOPATH.
goinstall:
go install $(GOFLAGS)