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
|
|
|
|
|
2016-06-16 21:39:19 +00:00
|
|
|
RUNTIME ?= runc
|
|
|
|
|
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-05-27 17:35:42 +00:00
|
|
|
TESTBENCH_ARTIFACTS_DIR := output/test-artifacts
|
|
|
|
TESTBENCH_BUNDLE_DIR := $(TESTBENCH_ARTIFACTS_DIR)/archives
|
2016-03-21 19:06:39 +00:00
|
|
|
|
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:
|
2016-05-27 17:35:42 +00:00
|
|
|
rm -rf bin && rm -rf output
|
2015-12-18 17:08:14 +00:00
|
|
|
|
|
|
|
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-08-26 17:55:21 +00:00
|
|
|
cd containerd-shim && go build -tags "$(BUILDTAGS)" -ldflags "-w ${LDFLAGS}" -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-05-27 17:35:42 +00:00
|
|
|
$(TESTBENCH_BUNDLE_DIR)/busybox.tar:
|
|
|
|
mkdir -p $(TESTBENCH_BUNDLE_DIR)
|
|
|
|
curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' -o $(TESTBENCH_BUNDLE_DIR)/busybox.tar
|
2016-03-21 19:06:39 +00:00
|
|
|
|
2016-05-27 17:35:42 +00:00
|
|
|
bundles-rootfs: $(TESTBENCH_BUNDLE_DIR)/busybox.tar
|
2016-03-21 19:06:39 +00:00
|
|
|
|
2016-05-27 17:35:42 +00:00
|
|
|
dbuild: $(TESTBENCH_BUNDLE_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
|
|
|
|
|
2016-05-27 17:35:42 +00:00
|
|
|
dbench: dbuild
|
|
|
|
$(DOCKER_RUN) make bench
|
|
|
|
|
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:
|
2016-06-03 22:00:49 +00:00
|
|
|
@hack/validate-lint
|
2015-12-18 17:08:14 +00:00
|
|
|
|
2016-01-12 22:56:07 +00:00
|
|
|
shell: dbuild
|
2015-12-18 17:08:14 +00:00
|
|
|
$(DOCKER_RUN) bash
|
|
|
|
|
2016-05-27 17:35:42 +00:00
|
|
|
test: validate install bundles-rootfs
|
2016-06-16 21:39:19 +00:00
|
|
|
go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test ) -runtime=$(RUNTIME)
|
2016-03-21 19:06:39 +00:00
|
|
|
ifneq ($(wildcard /.dockerenv), )
|
|
|
|
cd integration-test ; \
|
2016-09-01 18:29:00 +00:00
|
|
|
go test -check.v -check.timeout=$(TEST_TIMEOUT) $(TESTFLAGS) timeout=$(TEST_SUITE_TIMEOUT) github.com/docker/containerd/integration-test
|
2016-03-21 19:06:39 +00:00
|
|
|
endif
|
2015-12-18 17:08:14 +00:00
|
|
|
|
2016-05-27 17:35:42 +00:00
|
|
|
bench: shim validate install bundles-rootfs
|
2016-06-16 21:39:19 +00:00
|
|
|
go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) -runtime=$(RUNTIME)
|
2016-05-27 17:35:42 +00:00
|
|
|
|
2016-06-03 22:00:49 +00:00
|
|
|
validate: fmt lint
|
2016-05-18 01:19:45 +00:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(foreach file,containerd containerd-shim ctr,rm /usr/local/bin/$(file);)
|