Debian Codegraph @

Makefile

raw symbols SCIP
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 # Set an output prefix, which is the local directory if not specified
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