csi-driver/Makefile

50 lines
1.3 KiB
Makefile

# Image URL to use all building/pushing image targets
IMG ?= registry.millslan.net/p5x-csi:latest
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
.PHONY: all
all: build
##@ General
.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
.PHONY: vet
vet: ## Run go vet against code.
go vet ./...
##@ Build
.PHONY: build
build: fmt vet ## Build manager binary.
go build -o bin/manager main.go
.PHONY: run
run: fmt vet ## Run a csi driver from your host.
go run ./main.go
.PHONY: image
image: Dockerfile build ## Build docker image with the manager.
docker build -t ${IMG} .
.PHONY: push
push: ## Push docker image with the manager.
docker push ${IMG}