.PHONY: all bootstrap setup build lint fmt fmt-check test check clean docker hooks

BINARY := upaasd
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILDARCH := $(shell go env GOARCH)
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)

all: check build

bootstrap:
	@script/bootstrap

setup:
	@script/setup

build:
	go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/upaasd

lint:
	@script/lint

fmt:
	@script/fmt

fmt-check:
	@script/fmt-check

test:
	@script/test

# Check runs all validation without making changes
# Used by CI and Docker build - fails if anything is wrong
check:
	@script/check

docker:
	@script/docker

hooks:
	@script/install-precommit

clean:
	rm -rf bin/
