| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
PREFIX?=$(shell pwd) |
| 17 |
|
| 18 |
PKG=github.com/containerd/continuity |
| 19 |
|
| 20 |
PACKAGES=$(shell go list -mod=vendor ./... | grep -v /vendor/) |
| 21 |
TEST_REQUIRES_ROOT_PACKAGES=$(filter \ |
| 22 |
${PACKAGES}, \ |
| 23 |
$(shell \ |
| 24 |
for f in $$(git grep -l testutil.RequiresRoot | grep -v Makefile); do \ |
| 25 |
d="$$(dirname $$f)"; \ |
| 26 |
[ "$$d" = "." ] && echo "${PKG}" && continue; \ |
| 27 |
echo "${PKG}/$$d"; \ |
| 28 |
done | sort -u) \ |
| 29 |
) |
| 30 |
|
| 31 |
.PHONY: clean all lint build test binaries |
| 32 |
.DEFAULT: default |
| 33 |
|
| 34 |
all: AUTHORS clean lint build test binaries |
| 35 |
|
| 36 |
AUTHORS: .mailmap .git/HEAD |
| 37 |
git log --format='%aN <%aE>' | sort -fu > $@ |
| 38 |
|
| 39 |
${PREFIX}/bin/continuity: |
| 40 |
@echo "+ $@" |
| 41 |
@(cd cmd/continuity && go build -mod=mod -o $@ ${GO_GCFLAGS} .) |
| 42 |
|
| 43 |
generate: |
| 44 |
go generate -mod=vendor $(PACKAGES) |
| 45 |
|
| 46 |
lint: |
| 47 |
@echo "+ $@" |
| 48 |
@golangci-lint run |
| 49 |
@(cd cmd/continuity && golangci-lint --config=../../.golangci.yml run) |
| 50 |
|
| 51 |
build: |
| 52 |
@echo "+ $@" |
| 53 |
@go build -mod=vendor -v ${GO_LDFLAGS} $(PACKAGES) |
| 54 |
|
| 55 |
test: |
| 56 |
@echo "+ $@" |
| 57 |
@go test -mod=vendor $(PACKAGES) |
| 58 |
|
| 59 |
root-test: |
| 60 |
@echo "+ $@" |
| 61 |
@go test -exec sudo ${TEST_REQUIRES_ROOT_PACKAGES} -test.root -test.v |
| 62 |
|
| 63 |
test-compile: |
| 64 |
@echo "+ $@" |
| 65 |
@for pkg in $(PACKAGES); do go test -mod=vendor -c $$pkg; done |
| 66 |
|
| 67 |
binaries: ${PREFIX}/bin/continuity |
| 68 |
@echo "+ $@" |
| 69 |
@if [ x$$GOOS = xwindows ]; then echo "+ continuity -> continuity.exe"; mv ${PREFIX}/bin/continuity ${PREFIX}/bin/continuity.exe; fi |
| 70 |
|
| 71 |
clean: |
| 72 |
@echo "+ $@" |
| 73 |
@rm -rf "${PREFIX}/bin/continuity" "${PREFIX}/bin/continuity.exe" |
| 74 |
|