Jelajahi Sumber

Merged branch sa2ajj/top-level-makefile

Solomon Hykes 12 tahun lalu
induk
melakukan
d8dc6d4583
3 mengubah file dengan 69 tambahan dan 1 penghapusan
  1. 2 1
      .gitignore
  2. 43 0
      Makefile
  3. 24 0
      README.md

+ 2 - 1
.gitignore

@@ -13,4 +13,5 @@ auth/auth.test
 .DS_Store
 docs/_build
 docs/_static
-docs/_templates
+docs/_templates
+.gopath/

+ 43 - 0
Makefile

@@ -0,0 +1,43 @@
+DOCKER_PACKAGE := github.com/dotcloud/docker
+
+BUILD_DIR := $(CURDIR)/.gopath
+
+GOPATH ?= $(BUILD_DIR)
+export GOPATH
+
+GO_OPTIONS ?=
+ifeq ($(VERBOSE), 1)
+GO_OPTIONS += -v
+endif
+
+SRC_DIR := $(GOPATH)/src
+
+DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
+DOCKER_MAIN := $(DOCKER_DIR)/docker
+
+DOCKER_BIN_RELATIVE := bin/docker
+DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE)
+
+.PHONY: all clean test
+
+all: $(DOCKER_BIN)
+
+$(DOCKER_BIN): $(DOCKER_DIR)
+	@mkdir -p  $(dir $@)
+	@(cd $(DOCKER_MAIN); go get $(GO_OPTIONS); go build $(GO_OPTIONS) -o $@)
+	@echo $(DOCKER_BIN_RELATIVE) is created.
+
+$(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
+
+test: all
+	@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS))

+ 24 - 0
README.md

@@ -53,6 +53,30 @@ 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``
+
+   This command will install all necessary dependencies and build the
+   executable that you can find in ``bin/docker``
+
+3. Should you like to see what's happening, run ``make`` with ``VERBOSE=1`` parameter:
+
+    ```bash
+
+    $ make VERBOSE=1
+    ```
+
 Installing on Ubuntu 12.04 and 12.10
 ------------------------------------