introduce top-level Makefile to build the docker binary

This commit is contained in:
Mikhail Sobolev 2013-03-25 23:48:46 +02:00
parent 3cce89d8ed
commit 7009d6c6dd
3 changed files with 50 additions and 0 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ command-line-arguments.test
.flymake*
docker.test
auth/auth.test
build/

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
DOCKER_PACKAGE := github.com/dotcloud/docker
BUILD_DIR := $(CURDIR)/build
GOPATH ?= $(BUILD_DIR)
export GOPATH
SRC_DIR := $(GOPATH)/src
DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
DOCKER_MAIN := $(DOCKER_DIR)/docker
DOCKER_BIN := $(CURDIR)/bin/docker
.PHONY: all clean
all: $(DOCKER_BIN)
$(DOCKER_BIN): $(DOCKER_DIR)
@mkdir -p $(dir $@)
(cd $(DOCKER_MAIN); go get; go build -o $@)
$(DOCKER_DIR):
@mkdir -p $(dir $@)
@ln -sf $(CURDIR)/ $@
clean:
@rm -rf $(dir $(DOCKER_BIN))
ifeq ($(GOPATH), $(BUILD_DIR))
@rm -rf $(BUILD_DIR)
else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
@rm -f $(DOCKER_DIR)
endif

View File

@ -53,6 +53,22 @@ Under the hood, Docker is built on the following components:
Install instructions
==================
Building from source
--------------------
1. Make sure you have a [Go language](http://golang.org) compiler.
On a Debian/wheezy or Ubuntu 12.10 install the package:
```bash
$ sudo apt-get install golang-go
```
2. Execute ``make``
3. Find your binary in ``bin/docker``
Installing on Ubuntu 12.04 and 12.10
------------------------------------