2016-01-06 21:32:46 +00:00
|
|
|
BUILDTAGS=
|
2015-12-11 21:59:19 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
DOCKER_IMAGE := containerd-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
|
|
|
|
DOCKER_RUN := docker run --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
|
|
|
|
|
|
|
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
|
2015-12-08 21:31:20 +00:00
|
|
|
cd ctr && go build -o ../bin/ctr
|
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
daemon: bin
|
2015-12-11 21:59:19 +00:00
|
|
|
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
2015-12-08 21:31:20 +00:00
|
|
|
|
2016-01-06 21:32:46 +00:00
|
|
|
shim: bin
|
|
|
|
cd containerd-shim && go build -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
dbuild:
|
|
|
|
@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
|
|
|
|
go test -v $(shell go list ./... | grep -v /vendor)
|
|
|
|
|
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)
|