Browse code

Merged branch sa2ajj/top-level-makefile

Solomon Hykes authored on 2013/03/28 03:50:01
Showing 3 changed files
... ...
@@ -13,4 +13,5 @@ auth/auth.test
13 13
 .DS_Store
14 14
 docs/_build
15 15
 docs/_static
16
-docs/_templates
17 16
\ No newline at end of file
17
+docs/_templates
18
+.gopath/
18 19
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+DOCKER_PACKAGE := github.com/dotcloud/docker
1
+
2
+BUILD_DIR := $(CURDIR)/.gopath
3
+
4
+GOPATH ?= $(BUILD_DIR)
5
+export GOPATH
6
+
7
+GO_OPTIONS ?=
8
+ifeq ($(VERBOSE), 1)
9
+GO_OPTIONS += -v
10
+endif
11
+
12
+SRC_DIR := $(GOPATH)/src
13
+
14
+DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
15
+DOCKER_MAIN := $(DOCKER_DIR)/docker
16
+
17
+DOCKER_BIN_RELATIVE := bin/docker
18
+DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE)
19
+
20
+.PHONY: all clean test
21
+
22
+all: $(DOCKER_BIN)
23
+
24
+$(DOCKER_BIN): $(DOCKER_DIR)
25
+	@mkdir -p  $(dir $@)
26
+	@(cd $(DOCKER_MAIN); go get $(GO_OPTIONS); go build $(GO_OPTIONS) -o $@)
27
+	@echo $(DOCKER_BIN_RELATIVE) is created.
28
+
29
+$(DOCKER_DIR):
30
+	@mkdir -p $(dir $@)
31
+	@ln -sf $(CURDIR)/ $@
32
+
33
+clean:
34
+	@rm -rf $(dir $(DOCKER_BIN))
35
+ifeq ($(GOPATH), $(BUILD_DIR))
36
+	@rm -rf $(BUILD_DIR)
37
+else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
38
+	@rm -f $(DOCKER_DIR)
39
+endif
40
+
41
+test: all
42
+	@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS))
... ...
@@ -53,6 +53,30 @@ 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
+   This command will install all necessary dependencies and build the
71
+   executable that you can find in ``bin/docker``
72
+
73
+3. Should you like to see what's happening, run ``make`` with ``VERBOSE=1`` parameter:
74
+
75
+    ```bash
76
+
77
+    $ make VERBOSE=1
78
+    ```
79
+
56 80
 Installing on Ubuntu 12.04 and 12.10
57 81
 ------------------------------------
58 82