|
| 1 | +# kernel-style V=1 build verbosity |
| 2 | +ifeq ("$(origin V)", "command line") |
| 3 | + BUILD_VERBOSE = $(V) |
| 4 | +endif |
| 5 | + |
| 6 | +ifeq ($(BUILD_VERBOSE),1) |
| 7 | + Q = |
| 8 | +else |
| 9 | + Q = @ |
| 10 | +endif |
| 11 | + |
| 12 | +REPO = github.com/operator-framework/api |
| 13 | +BUILD_PATH = $(REPO)/cmd/operator-verify |
| 14 | +PKGS = $(shell go list ./... | grep -v /vendor/) |
| 15 | + |
| 16 | +.PHONY: help |
| 17 | +help: ## Show this help screen |
| 18 | + @echo 'Usage: make <OPTIONS> ... <TARGETS>' |
| 19 | + @echo '' |
| 20 | + @echo 'Available targets are:' |
| 21 | + @echo '' |
| 22 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 23 | + |
| 24 | +.PHONY: install |
| 25 | + |
| 26 | +install: ## Build & install the operator-verify |
| 27 | + |
| 28 | + $(Q)go install \ |
| 29 | + -gcflags "all=-trimpath=${GOPATH}" \ |
| 30 | + -asmflags "all=-trimpath=${GOPATH}" \ |
| 31 | + -ldflags " \ |
| 32 | + -X '${REPO}/version.GitVersion=${VERSION}' \ |
| 33 | + -X '${REPO}/version.GitCommit=${GIT_COMMIT}' \ |
| 34 | + " \ |
| 35 | + $(BUILD_PATH) |
| 36 | + |
| 37 | +# Code management. |
| 38 | +.PHONY: format tidy clean |
| 39 | + |
| 40 | +format: ## Format the source code |
| 41 | + $(Q)go fmt $(PKGS) |
| 42 | + |
| 43 | +tidy: ## Update dependencies |
| 44 | + $(Q)go mod tidy -v |
| 45 | + |
| 46 | +clean: ## Clean up the build artifacts |
| 47 | + $(Q)rm -rf build |
| 48 | + |
| 49 | +############################## |
| 50 | +# Tests # |
| 51 | +############################## |
| 52 | + |
| 53 | +##@ Tests |
| 54 | + |
| 55 | +# Static tests. |
| 56 | +.PHONY: test test-unit |
| 57 | + |
| 58 | +test: test-unit ## Run the tests |
| 59 | + |
| 60 | +TEST_PKGS:=$(shell go list ./...) |
| 61 | +test-unit: ## Run the unit tests |
| 62 | + $(Q)go test -short ${TEST_PKGS} |
0 commit comments