Browse code

introduce top-level Makefile to build the docker binary

Mikhail Sobolev authored on 2013/03/26 06:48:46
Showing 3 changed files
... ...
@@ -9,3 +9,4 @@ command-line-arguments.test
9 9
 .flymake*
10 10
 docker.test
11 11
 auth/auth.test
12
+build/
12 13
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+DOCKER_PACKAGE := github.com/dotcloud/docker
1
+
2
+BUILD_DIR := $(CURDIR)/build
3
+
4
+GOPATH ?= $(BUILD_DIR)
5
+export GOPATH
6
+
7
+SRC_DIR := $(GOPATH)/src
8
+
9
+DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
10
+DOCKER_MAIN := $(DOCKER_DIR)/docker
11
+
12
+DOCKER_BIN := $(CURDIR)/bin/docker
13
+
14
+.PHONY: all clean
15
+
16
+all: $(DOCKER_BIN)
17
+
18
+$(DOCKER_BIN): $(DOCKER_DIR)
19
+	@mkdir -p  $(dir $@)
20
+	(cd $(DOCKER_MAIN); go get; go build -o $@)
21
+
22
+$(DOCKER_DIR):
23
+	@mkdir -p $(dir $@)
24
+	@ln -sf $(CURDIR)/ $@
25
+
26
+clean:
27
+	@rm -rf $(dir $(DOCKER_BIN))
28
+ifeq ($(GOPATH), $(BUILD_DIR))
29
+	@rm -rf $(BUILD_DIR)
30
+else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
31
+	@rm -f $(DOCKER_DIR)
32
+endif
... ...
@@ -53,6 +53,22 @@ Under the hood, Docker is built on the following components:
53 53
 Install instructions
54 54
 ==================
55 55
 
56
+Building from source
57
+--------------------
58
+
59
+1. Make sure you have a [Go language](http://golang.org) compiler.
60
+
61
+    On a Debian/wheezy or Ubuntu 12.10 install the package:
62
+
63
+    ```bash
64
+
65
+    $ sudo apt-get install golang-go
66
+    ```
67
+
68
+2. Execute ``make``
69
+
70
+3. Find your binary in ``bin/docker``
71
+
56 72
 Installing on Ubuntu 12.04 and 12.10
57 73
 ------------------------------------
58 74