Files
docker-cli/Makefile
Sebastiaan van Stijn 94e08f2e2d Makefile: don't warn "outside container" for some targets
This change allows some make targets to be ran outside the dev-container for
easier discovery and use:

- `make clean` can be used on the host (as artifacts created from within the
  development container are usually stored on the host).
- `make help` was already allowed
- `make dev` and `make shell` are added to the regular Makefile, to make it
  easier to create and start the development container.
- When attempting to run `make dev` from within the development container, a
  message is printed, and the target is cancelled:

      root@docker-cli-dev$ make dev
      you are already in the dev container

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-06 19:10:53 +02:00

91 lines
2.4 KiB
Makefile

#
# github.com/docker/cli
#
# Sets the name of the company that produced the windows binary.
PACKAGER_NAME ?=
all: binary
_:=$(shell ./scripts/warn-outside-container $(MAKECMDGOALS))
.PHONY: dev
dev: ## start a build container in interactive mode for in-container development
@if [ -n "${DISABLE_WARN_OUTSIDE_CONTAINER}" ]; then \
echo "you are already in the dev container"; \
else \
$(MAKE) -f docker.Makefile dev; \
fi
.PHONY: shell
shell: dev ## alias for dev
.PHONY: clean
clean: ## remove build artifacts
rm -rf ./build/* man/man[1-9] docs/yaml
.PHONY: test
test: test-unit ## run tests
.PHONY: test-unit
test-unit: ## run unit tests, to change the output format use: GOTESTSUM_FORMAT=(dots|short|standard-quiet|short-verbose|standard-verbose) make test-unit
gotestsum -- $${TESTDIRS:-$(shell go list ./... | grep -vE '/vendor/|/e2e/')} $(TESTFLAGS)
.PHONY: test-coverage
test-coverage: ## run test coverage
mkdir -p $(CURDIR)/build/coverage
gotestsum -- $(shell go list ./... | grep -vE '/vendor/|/e2e/') -coverprofile=$(CURDIR)/build/coverage/coverage.txt
.PHONY: lint
lint: ## run all the lint tools
golangci-lint run
.PHONY: shellcheck
shellcheck: ## run shellcheck validation
find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
.PHONY: fmt
fmt: ## run gofmt
go list -f {{.Dir}} ./... | xargs gofmt -w -s -d
.PHONY: binary
binary: ## build executable for Linux
./scripts/build/binary
.PHONY: dynbinary
dynbinary: ## build dynamically linked binary
GO_LINKMODE=dynamic ./scripts/build/binary
.PHONY: plugins
plugins: ## build example CLI plugins
./scripts/build/plugins
.PHONY: vendor
vendor: ## update vendor with go modules
rm -rf vendor
./scripts/vendor update
.PHONY: validate-vendor
validate-vendor: ## validate vendor
./scripts/vendor validate
.PHONY: mod-outdated
mod-outdated: ## check outdated dependencies
./scripts/vendor outdated
.PHONY: authors
authors: ## generate AUTHORS file from git history
scripts/docs/generate-authors.sh
.PHONY: manpages
manpages: ## generate man pages from go source and markdown
scripts/docs/generate-man.sh
.PHONY: yamldocs
yamldocs: ## generate documentation YAML files consumed by docs repo
scripts/docs/generate-yaml.sh
.PHONY: help
help: ## print this help
@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)