github.com/docker-archive/containerd@v0.2.8/Makefile (about) 1 BUILDTAGS= 2 3 PROJECT=github.com/docker/containerd 4 5 GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true) 6 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null) 7 8 LDFLAGS := -X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS} 9 10 TEST_TIMEOUT ?= 5m 11 TEST_SUITE_TIMEOUT ?= 10m 12 13 RUNTIME ?= runc 14 15 # if this session isn't interactive, then we don't want to allocate a 16 # TTY, which would fail, but if it is interactive, we do want to attach 17 # so that the user can send e.g. ^C through. 18 INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0) 19 ifeq ($(INTERACTIVE), 1) 20 DOCKER_FLAGS += -t 21 endif 22 23 TESTBENCH_ARTIFACTS_DIR := output/test-artifacts 24 TESTBENCH_BUNDLE_DIR := $(TESTBENCH_ARTIFACTS_DIR)/archives 25 26 DOCKER_IMAGE := containerd-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 27 DOCKER_RUN := docker run --privileged --rm -i $(DOCKER_FLAGS) "$(DOCKER_IMAGE)" 28 29 30 export GOPATH:=$(CURDIR)/vendor:$(GOPATH) 31 32 all: client daemon shim 33 34 static: client-static daemon-static shim-static 35 36 bin: 37 mkdir -p bin/ 38 39 clean: 40 rm -rf bin && rm -rf output 41 42 client: bin 43 cd ctr && go build -ldflags "${LDFLAGS}" -o ../bin/ctr 44 45 client-static: 46 cd ctr && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/ctr 47 48 daemon: bin 49 cd containerd && go build -ldflags "${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd 50 51 daemon-static: 52 cd containerd && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd 53 54 shim: bin 55 cd containerd-shim && go build -tags "$(BUILDTAGS)" -ldflags "-w ${LDFLAGS}" -o ../bin/containerd-shim 56 57 shim-static: 58 cd containerd-shim && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd-shim 59 60 $(TESTBENCH_BUNDLE_DIR)/busybox.tar: 61 mkdir -p $(TESTBENCH_BUNDLE_DIR) 62 curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' -o $(TESTBENCH_BUNDLE_DIR)/busybox.tar 63 64 bundles-rootfs: $(TESTBENCH_BUNDLE_DIR)/busybox.tar 65 66 dbuild: $(TESTBENCH_BUNDLE_DIR)/busybox.tar 67 @docker build --rm --force-rm -t "$(DOCKER_IMAGE)" . 68 69 dtest: dbuild 70 $(DOCKER_RUN) make test 71 72 dbench: dbuild 73 $(DOCKER_RUN) make bench 74 75 install: 76 cp bin/* /usr/local/bin/ 77 78 protoc: 79 protoc -I ./api/grpc/types ./api/grpc/types/api.proto --go_out=plugins=grpc:api/grpc/types 80 81 fmt: 82 @gofmt -s -l . | grep -v vendor | grep -v .pb. | tee /dev/stderr 83 84 lint: 85 @hack/validate-lint 86 87 shell: dbuild 88 $(DOCKER_RUN) bash 89 90 test: validate install bundles-rootfs 91 go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test ) -runtime=$(RUNTIME) 92 ifneq ($(wildcard /.dockerenv), ) 93 cd integration-test ; \ 94 go test -check.v -check.timeout=$(TEST_TIMEOUT) $(TESTFLAGS) timeout=$(TEST_SUITE_TIMEOUT) github.com/docker/containerd/integration-test 95 endif 96 97 bench: shim validate install bundles-rootfs 98 go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test) -runtime=$(RUNTIME) 99 100 validate: fmt lint 101 102 uninstall: 103 $(foreach file,containerd containerd-shim ctr,rm /usr/local/bin/$(file);)