Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. RUNC_IMAGE=runc_dev
  2. RUNC_TEST_IMAGE=runc_test
  3. PROJECT=github.com/opencontainers/runc
  4. TEST_DOCKERFILE=script/test_Dockerfile
  5. BUILDTAGS=seccomp
  6. RUNC_BUILD_PATH=/go/src/github.com/opencontainers/runc/runc
  7. RUNC_INSTANCE=runc_dev
  8. COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true)
  9. RUNC_LINK=$(CURDIR)/Godeps/_workspace/src/github.com/opencontainers/runc
  10. export GOPATH:=$(CURDIR)/Godeps/_workspace:$(GOPATH)
  11. .PHONY=dbuild
  12. all:
  13. ifneq ($(RUNC_LINK), $(wildcard $(RUNC_LINK)))
  14. ln -sfn $(CURDIR) $(RUNC_LINK)
  15. endif
  16. go build -ldflags "-X main.gitCommit=${COMMIT}" -tags "$(BUILDTAGS)" -o runc .
  17. static:
  18. CGO_ENABLED=1 go build -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT}" -o runc .
  19. lint:
  20. go vet ./...
  21. go fmt ./...
  22. runctestimage:
  23. docker build -t $(RUNC_TEST_IMAGE) -f $(TEST_DOCKERFILE) .
  24. test: runctestimage
  25. docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest
  26. tests/sniffTest
  27. localtest: all
  28. go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./...
  29. dbuild: runctestimage
  30. docker build -t $(RUNC_IMAGE) .
  31. docker create --name=$(RUNC_INSTANCE) $(RUNC_IMAGE)
  32. docker cp $(RUNC_INSTANCE):$(RUNC_BUILD_PATH) .
  33. docker rm $(RUNC_INSTANCE)
  34. install:
  35. install -D -m0755 runc /usr/local/sbin/runc
  36. uninstall:
  37. rm -f /usr/local/sbin/runc
  38. clean:
  39. rm -f runc
  40. rm -f $(RUNC_LINK)
  41. validate:
  42. script/validate-gofmt
  43. go vet ./...
  44. ci: validate localtest