2015-12-11 21:59:19 +00:00
|
|
|
BUILDTAGS=libcontainer
|
|
|
|
|
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
|
|
|
|
2015-12-18 17:08:14 +00:00
|
|
|
|
|
|
|
all: client daemon
|
|
|
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
|
shell:
|
|
|
|
$(DOCKER_RUN) bash
|
|
|
|
|
|
|
|
test: all validate
|
|
|
|
go test -v $(shell go list ./... | grep -v /vendor)
|
|
|
|
|
|
|
|
validate: fmt lint vet
|
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet $(shell go list ./... | grep -v vendor)
|