2013-03-25 21:48:46 +00:00
|
|
|
DOCKER_PACKAGE := github.com/dotcloud/docker
|
|
|
|
|
2013-03-26 00:23:36 +00:00
|
|
|
BUILD_DIR := $(CURDIR)/.gopath
|
2013-03-25 21:48:46 +00:00
|
|
|
|
|
|
|
GOPATH ?= $(BUILD_DIR)
|
|
|
|
export GOPATH
|
|
|
|
|
2013-03-26 06:28:35 +00:00
|
|
|
GO_OPTIONS ?=
|
|
|
|
ifeq ($(VERBOSE), 1)
|
|
|
|
GO_OPTIONS += -v
|
|
|
|
endif
|
|
|
|
|
2013-03-25 21:48:46 +00:00
|
|
|
SRC_DIR := $(GOPATH)/src
|
|
|
|
|
|
|
|
DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE)
|
|
|
|
DOCKER_MAIN := $(DOCKER_DIR)/docker
|
|
|
|
|
2013-03-26 14:30:01 +00:00
|
|
|
DOCKER_BIN_RELATIVE := bin/docker
|
|
|
|
DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE)
|
2013-03-25 21:48:46 +00:00
|
|
|
|
2013-03-25 22:15:37 +00:00
|
|
|
.PHONY: all clean test
|
2013-03-25 21:48:46 +00:00
|
|
|
|
|
|
|
all: $(DOCKER_BIN)
|
|
|
|
|
|
|
|
$(DOCKER_BIN): $(DOCKER_DIR)
|
|
|
|
@mkdir -p $(dir $@)
|
2013-03-26 06:28:35 +00:00
|
|
|
@(cd $(DOCKER_MAIN); go get $(GO_OPTIONS); go build $(GO_OPTIONS) -o $@)
|
2013-03-26 14:30:01 +00:00
|
|
|
@echo $(DOCKER_BIN_RELATIVE) is created.
|
2013-03-25 21:48:46 +00:00
|
|
|
|
|
|
|
$(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
|
2013-03-25 22:15:37 +00:00
|
|
|
|
|
|
|
test: all
|
2013-03-26 06:28:35 +00:00
|
|
|
@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS))
|
2013-04-01 20:05:00 +00:00
|
|
|
|
|
|
|
fmt:
|
2013-04-01 21:50:25 +00:00
|
|
|
@gofmt -s -l -w .
|