.PHONY: proto build clean test install

PROTOC      ?= protoc
GO          ?= go
BINARY       = dwarfctl

build: ## Build the dwarfctl binary
	$(GO) build -o $(BINARY) ./cmd/dwarfctl/

proto: ## Regenerate Go protobuf bindings from .proto files
	$(PROTOC) --go_out=. --go_opt=paths=source_relative --proto_path=. dwarf.proto

install: build ## Install dwarfctl to $$GOBIN
	$(GO) install ./cmd/dwarfctl/

test: ## Run tests
	$(GO) test ./...

clean: ## Remove build artifacts
	rm -f $(BINARY)

help: ## Show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf "  \033[36m%-12s\033[0m %s\n",$$1,$$2}'

.DEFAULT_GOAL := build
