2015-12-18 19:18:41 +08:00
|
|
|
RUNC_IMAGE=runc_dev
|
2015-06-27 04:06:17 +08:00
|
|
|
RUNC_TEST_IMAGE=runc_test
|
|
|
|
PROJECT=github.com/opencontainers/runc
|
2015-07-01 04:05:13 +08:00
|
|
|
TEST_DOCKERFILE=script/test_Dockerfile
|
2015-08-22 06:25:26 +08:00
|
|
|
BUILDTAGS=seccomp
|
2015-12-18 19:18:41 +08:00
|
|
|
RUNC_BUILD_PATH=/go/src/github.com/opencontainers/runc/runc
|
|
|
|
RUNC_INSTANCE=runc_dev
|
2016-03-12 05:49:45 +08:00
|
|
|
COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true)
|
2016-03-01 15:45:18 +08:00
|
|
|
RUNC_LINK=$(CURDIR)/Godeps/_workspace/src/github.com/opencontainers/runc
|
2015-07-01 02:07:56 +08:00
|
|
|
export GOPATH:=$(CURDIR)/Godeps/_workspace:$(GOPATH)
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2015-12-18 19:18:41 +08:00
|
|
|
.PHONY=dbuild
|
|
|
|
|
2015-06-22 10:31:12 +08:00
|
|
|
all:
|
2016-03-01 15:45:18 +08:00
|
|
|
ifneq ($(RUNC_LINK), $(wildcard $(RUNC_LINK)))
|
|
|
|
ln -sfn $(CURDIR) $(RUNC_LINK)
|
|
|
|
endif
|
2016-03-12 05:49:45 +08:00
|
|
|
go build -ldflags "-X main.gitCommit=${COMMIT}" -tags "$(BUILDTAGS)" -o runc .
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2015-11-15 08:33:52 +08:00
|
|
|
static:
|
2016-03-12 05:49:45 +08:00
|
|
|
CGO_ENABLED=1 go build -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT}" -o runc .
|
2015-11-15 08:33:52 +08:00
|
|
|
|
2015-07-01 03:51:09 +08:00
|
|
|
vet:
|
2015-06-27 04:06:17 +08:00
|
|
|
go get golang.org/x/tools/cmd/vet
|
2015-07-01 03:51:09 +08:00
|
|
|
|
|
|
|
lint: vet
|
2015-06-27 04:06:17 +08:00
|
|
|
go vet ./...
|
|
|
|
go fmt ./...
|
|
|
|
|
|
|
|
runctestimage:
|
|
|
|
docker build -t $(RUNC_TEST_IMAGE) -f $(TEST_DOCKERFILE) .
|
|
|
|
|
|
|
|
test: runctestimage
|
2016-02-12 02:42:28 +08:00
|
|
|
docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest
|
|
|
|
tests/sniffTest
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2016-02-12 02:42:28 +08:00
|
|
|
localtest: all
|
2015-08-22 06:25:26 +08:00
|
|
|
go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./...
|
|
|
|
|
2015-12-18 19:18:41 +08:00
|
|
|
dbuild: runctestimage
|
|
|
|
docker build -t $(RUNC_IMAGE) .
|
|
|
|
docker create --name=$(RUNC_INSTANCE) $(RUNC_IMAGE)
|
|
|
|
docker cp $(RUNC_INSTANCE):$(RUNC_BUILD_PATH) .
|
|
|
|
docker rm $(RUNC_INSTANCE)
|
2015-06-22 10:31:12 +08:00
|
|
|
|
2015-06-30 04:33:15 +08:00
|
|
|
install:
|
2015-06-22 10:31:12 +08:00
|
|
|
cp runc /usr/local/bin/runc
|
|
|
|
|
2016-03-14 09:59:36 +08:00
|
|
|
uninstall:
|
|
|
|
rm -f /usr/local/bin/runc
|
|
|
|
|
2015-06-22 10:31:12 +08:00
|
|
|
clean:
|
2016-03-01 15:45:18 +08:00
|
|
|
rm -f runc
|
|
|
|
rm -f $(RUNC_LINK)
|
2015-07-01 03:51:09 +08:00
|
|
|
|
|
|
|
validate: vet
|
|
|
|
script/validate-gofmt
|
|
|
|
go vet ./...
|
|
|
|
|
|
|
|
ci: validate localtest
|