2016-01-06 21:32:46 +00:00
|
|
|
BUILDTAGS=
|
2015-12-11 21:59:19 +00:00
|
|
|
|
2016-03-21 19:06:39 +00:00
|
|
|
PROJECT=github.com/docker/containerd
|
|
|
|
|
2016-03-18 22:29:22 +00:00
|
|
|
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
|
2016-03-21 20:47:13 +00:00
|
|
|
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
2016-03-18 22:29:22 +00:00
|
|
|
|
2016-03-21 16:58:53 +00:00
|
|
|
LDFLAGS := -X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS}
|
2016-03-18 22:29:22 +00:00
|
|
|
|
2016-03-28 18:21:50 +00:00
|
|
|
TEST_TIMEOUT ?= 5m
|
|
|
|
TEST_SUITE_TIMEOUT ?= 10m
|
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
# if this session isn't interactive, then we don't want to allocate a
|
|
|
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
|
|
|
# so that the user can send e.g. ^C through.
|
|
|
|
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
|
|
|
ifeq ($(INTERACTIVE), 1)
|
|
|
|
DOCKER_FLAGS += -t
|
|
|
|
endif
|
|
|
|
|
2016-03-21 19:06:39 +00:00
|
|
|
TEST_ARTIFACTS_DIR := integration-test/test-artifacts
|
|
|
|
BUNDLE_ARCHIVES_DIR := $(TEST_ARTIFACTS_DIR)/archives
|
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
DOCKER_IMAGE := containerd-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
|
2016-03-21 19:06:39 +00:00
|
|
|
DOCKER_RUN := docker run --privileged --rm -i $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
|
|
|
|
|
2015-12-08 19:37:55 +00:00
|
|
|
|
2016-03-17 23:10:24 +00:00
|
|
|
export GOPATH:=$(CURDIR)/vendor:$(GOPATH)
|
2015-12-18 17:08:14 +00:00
|
|
|
|
2016-03-17 23:10:07 +00:00
|
|
|
all: client daemon shim
|
2015-12-18 17:08:14 +00:00
|
|
|
|
2016-03-21 16:58:53 +00:00
|
|
|
static: client-static daemon-static shim-static
|
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
bin:
|
2015-12-08 21:31:20 +00:00
|
|
|
mkdir -p bin/
|
2015-12-18 17:08:14 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf bin
|
|
|
|
|
|
|
|
client: bin
|
2016-03-21 16:58:53 +00:00
|
|
|
cd ctr && go build -ldflags "${LDFLAGS}" -o ../bin/ctr
|
|
|
|
|
|
|
|
client-static:
|
|
|
|
cd ctr && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/ctr
|
2015-12-08 21:31:20 +00:00
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
daemon: bin
|
2016-03-21 16:58:53 +00:00
|
|
|
cd containerd && go build -ldflags "${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd
|
|
|
|
|
|
|
|
daemon-static:
|
|
|
|
cd containerd && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd
|
2015-12-08 21:31:20 +00:00
|
|
|
|
2016-01-06 21:32:46 +00:00
|
|
|
shim: bin
|
2016-04-04 18:23:40 +00:00
|
|
|
cd containerd-shim && go build -tags "$(BUILDTAGS)" -ldflags "-w" -o ../bin/containerd-shim
|
2016-01-06 21:32:46 +00:00
|
|
|
|
2016-03-21 16:58:53 +00:00
|
|
|
shim-static:
|
|
|
|
cd containerd-shim && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
|
|
|
|
2016-03-21 19:06:39 +00:00
|
|
|
$(BUNDLE_ARCHIVES_DIR)/busybox.tar:
|
|
|
|
@mkdir -p $(BUNDLE_ARCHIVES_DIR)
|
|
|
|
curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' -o $(BUNDLE_ARCHIVES_DIR)/busybox.tar
|
|
|
|
|
|
|
|
bundles-rootfs: $(BUNDLE_ARCHIVES_DIR)/busybox.tar
|
|
|
|
|
|
|
|
dbuild: $(BUNDLE_ARCHIVES_DIR)/busybox.tar
|
2015-12-18 17:08:14 +00:00
|
|
|
@docker build --rm --force-rm -t "$(DOCKER_IMAGE)" .
|
|
|
|
|
|
|
|
dtest: dbuild
|
|
|
|
$(DOCKER_RUN) make test
|
|
|
|
|
2015-12-08 21:31:20 +00:00
|
|
|
install:
|
|
|
|
cp bin/* /usr/local/bin/
|
2015-12-11 20:08:02 +00:00
|
|
|
|
|
|
|
protoc:
|
|
|
|
protoc -I ./api/grpc/types ./api/grpc/types/api.proto --go_out=plugins=grpc:api/grpc/types
|
2015-12-18 17:08:14 +00:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
@gofmt -s -l . | grep -v vendor | grep -v .pb. | tee /dev/stderr
|
|
|
|
|
|
|
|
lint:
|
|
|
|
@golint ./... | grep -v vendor | grep -v .pb. | tee /dev/stderr
|
|
|
|
|
2016-01-12 22:56:07 +00:00
|
|
|
shell: dbuild
|
2015-12-18 17:08:14 +00:00
|
|
|
$(DOCKER_RUN) bash
|
|
|
|
|
|
|
|
test: all validate
|
2016-03-21 19:06:39 +00:00
|
|
|
go test -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test)
|
|
|
|
ifneq ($(wildcard /.dockerenv), )
|
|
|
|
$(MAKE) install bundles-rootfs
|
|
|
|
cd integration-test ; \
|
2016-03-28 18:21:50 +00:00
|
|
|
go test -check.v -check.timeout=$(TEST_TIMEOUT) timeout=$(TEST_SUITE_TIMEOUT) $(TESTFLAGS) github.com/docker/containerd/integration-test
|
2016-03-21 19:06:39 +00:00
|
|
|
endif
|
2015-12-18 17:08:14 +00:00
|
|
|
|
2016-01-22 18:47:06 +00:00
|
|
|
validate: fmt
|
2015-12-18 17:08:14 +00:00
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet $(shell go list ./... | grep -v vendor)
|