# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
BINARY_NAME=karpenter-ibm-cloud

# Build parameters
BUILD_DIR=bin
MAIN_PKG=cmd/controller/main.go

.PHONY: all build clean test deps generate

all: deps generate build test

build:
	$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)

clean:
	$(GOCLEAN)
	rm -rf $(BUILD_DIR)

test:
	$(GOTEST) -v ./...

deps:
	$(GOMOD) download
	$(GOMOD) tidy

generate:
	go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.1
	controller-gen \
		object:headerFile="hack/boilerplate.go.txt" \
		paths="./pkg/apis/..." \
		output:dir="."

# Run code generators
codegen: generate
