Debian Codegraph @

Makefile

raw
1 # Copyright The containerd Authors.
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6
7 # http://www.apache.org/licenses/LICENSE-2.0
8
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 # Base path used to install.
17 CMD_DESTDIR ?= /usr/local
18 GO111MODULE_VALUE=auto
19 PREFIX ?= $(CURDIR)/out/
20
21 PKG=github.com/containerd/stargz-snapshotter
22 VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
23 REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
24 GO_BUILD_LDFLAGS ?= -s -w
25 GO_LD_FLAGS=-ldflags '$(GO_BUILD_LDFLAGS) -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) $(GO_EXTRA_LDFLAGS)'
26
27 CMD=containerd-stargz-grpc ctr-remote stargz-store
28
29 CMD_BINARIES=$(addprefix $(PREFIX),$(CMD))
30
31 .PHONY: all build check install uninstall clean test test-root test-all integration test-optimize benchmark test-kind test-cri-containerd test-cri-o test-criauth generate validate-generated test-k3s test-k3s-argo-workflow vendor
32
33 all: build
34
35 build: $(CMD)
36
37 FORCE:
38
39 containerd-stargz-grpc: FORCE
40 cd cmd/ ; GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) -v ./containerd-stargz-grpc
41
42 ctr-remote: FORCE
43 cd cmd/ ; GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) -v ./ctr-remote
44
45 stargz-store: FORCE
46 cd cmd/ ; GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) -v ./stargz-store
47
48 check:
49 @echo "$@"
50 @GO111MODULE=$(GO111MODULE_VALUE) $(shell go env GOPATH)/bin/golangci-lint run
51 @cd ./estargz ; GO111MODULE=$(GO111MODULE_VALUE) $(shell go env GOPATH)/bin/golangci-lint run
52 @cd ./cmd ; GO111MODULE=$(GO111MODULE_VALUE) $(shell go env GOPATH)/bin/golangci-lint run
53 @cd ./ipfs ; GO111MODULE=$(GO111MODULE_VALUE) $(shell go env GOPATH)/bin/golangci-lint run
54
55 install:
56 @echo "$@"
57 @mkdir -p $(CMD_DESTDIR)/bin
58 @install $(CMD_BINARIES) $(CMD_DESTDIR)/bin
59
60 uninstall:
61 @echo "$@"
62 @rm -f $(addprefix $(CMD_DESTDIR)/bin/,$(notdir $(CMD_BINARIES)))
63
64 clean:
65 @echo "$@"
66 @rm -f $(CMD_BINARIES)
67
68 generate:
69 @./script/generated-files/generate.sh update
70
71 validate-generated:
72 @./script/generated-files/generate.sh validate
73
74 vendor:
75 @cd ./estargz ; GO111MODULE=$(GO111MODULE_VALUE) go mod tidy
76 @cd ./ipfs ; GO111MODULE=$(GO111MODULE_VALUE) go mod tidy
77 @GO111MODULE=$(GO111MODULE_VALUE) go mod tidy
78 @cd ./cmd ; GO111MODULE=$(GO111MODULE_VALUE) go mod tidy
79
80 test:
81 @echo "$@"
82 @GO111MODULE=$(GO111MODULE_VALUE) go test -race ./...
83 @cd ./estargz ; GO111MODULE=$(GO111MODULE_VALUE) go test -timeout 30m -race ./...
84 @cd ./cmd ; GO111MODULE=$(GO111MODULE_VALUE) go test -timeout 20m -race ./...
85 @cd ./ipfs ; GO111MODULE=$(GO111MODULE_VALUE) go test -timeout 20m -race ./...
86
87 test-root:
88 @echo "$@"
89 @GO111MODULE=$(GO111MODULE_VALUE) go test -race ./snapshot -test.root
90
91 test-all: test-root test
92
93 integration:
94 @./script/integration/test.sh
95
96 test-optimize:
97 @./script/optimize/test.sh
98
99 benchmark:
100 @./script/benchmark/test.sh
101
102 test-kind:
103 @./script/kind/test.sh
104
105 test-cri-containerd:
106 @./script/cri-containerd/test.sh
107
108 test-cri-o:
109 @./script/cri-o/test.sh
110
111 test-podman:
112 @./script/podman/test.sh
113
114 test-criauth:
115 @./script/criauth/test.sh
116
117 test-k3s:
118 @./script/k3s/test.sh
119
120 test-k3s-argo-workflow:
121 @./script/k3s-argo-workflow/run.sh
122
123 test-ipfs:
124 @./script/ipfs/test.sh