...
1#
2# github.com/docker/cli
3#
4
5# Sets the name of the company that produced the windows binary.
6PACKAGER_NAME ?=
7
8# The repository doesn't have a go.mod, but "go list", and "gotestsum"
9# expect to be run from a module.
10GO111MODULE=auto
11export GO111MODULE
12
13all: binary
14
15_:=$(shell ./scripts/warn-outside-container $(MAKECMDGOALS))
16
17.PHONY: dev
18dev: ## start a build container in interactive mode for in-container development
19 @if [ -n "${DISABLE_WARN_OUTSIDE_CONTAINER}" ]; then \
20 echo "you are already in the dev container"; \
21 else \
22 $(MAKE) -f docker.Makefile dev; \
23 fi
24
25.PHONY: shell
26shell: dev ## alias for dev
27
28.PHONY: clean
29clean: ## remove build artifacts
30 rm -rf ./build/* man/man[1-9] docs/yaml
31
32.PHONY: test
33test: test-unit ## run tests
34
35.PHONY: test-unit
36test-unit: ## run unit tests, to change the output format use: GOTESTSUM_FORMAT=(dots|short|standard-quiet|short-verbose|standard-verbose) make test-unit
37 gotestsum -- $${TESTDIRS:-$(shell go list ./... | grep -vE '/vendor/|/e2e/')} $(TESTFLAGS)
38
39.PHONY: test-coverage
40test-coverage: ## run test coverage
41 mkdir -p $(CURDIR)/build/coverage
42 gotestsum -- $(shell go list ./... | grep -vE '/vendor/|/e2e/') -coverprofile=$(CURDIR)/build/coverage/coverage.txt
43
44.PHONY: lint
45lint: ## run all the lint tools
46 golangci-lint run
47
48.PHONY: shellcheck
49shellcheck: ## run shellcheck validation
50 find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
51
52.PHONY: fmt
53fmt: ## run gofumpt (if present) or gofmt
54 @if command -v gofumpt > /dev/null; then \
55 gofumpt -w -d -lang=1.19 . ; \
56 else \
57 go list -f {{.Dir}} ./... | xargs gofmt -w -s -d ; \
58 fi
59
60.PHONY: binary
61binary: ## build executable for Linux
62 ./scripts/build/binary
63
64.PHONY: dynbinary
65dynbinary: ## build dynamically linked binary
66 GO_LINKMODE=dynamic ./scripts/build/binary
67
68.PHONY: plugins
69plugins: ## build example CLI plugins
70 ./scripts/build/plugins
71
72.PHONY: vendor
73vendor: ## update vendor with go modules
74 rm -rf vendor
75 ./scripts/vendor update
76
77.PHONY: validate-vendor
78validate-vendor: ## validate vendor
79 ./scripts/vendor validate
80
81.PHONY: mod-outdated
82mod-outdated: ## check outdated dependencies
83 ./scripts/vendor outdated
84
85.PHONY: authors
86authors: ## generate AUTHORS file from git history
87 scripts/docs/generate-authors.sh
88
89.PHONY: manpages
90manpages: ## generate man pages from go source and markdown
91 scripts/docs/generate-man.sh
92
93.PHONY: mddocs
94mddocs: ## generate markdown files from go source
95 scripts/docs/generate-md.sh
96
97.PHONY: yamldocs
98yamldocs: ## generate documentation YAML files consumed by docs repo
99 scripts/docs/generate-yaml.sh
100
101.PHONY: help
102help: ## print this help
103 @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
View as plain text