.PHONY: bootstrap setup test lint fmt fmt-check check build run dev deps \
	docker cibuild clean hooks

# Target bodies live in script/ (Scripts to Rule Them All); the targets
# below are thin shims that call them.
.DEFAULT_GOAL := check

VERSION ?= $(shell git describe --tags --always)

bootstrap:
	@script/bootstrap

setup:
	@script/setup

test:
	@script/test

lint:
	@script/lint

fmt:
	@script/fmt

fmt-check:
	@script/fmt-check

check:
	@script/check

docker:
	@script/docker

cibuild:
	@script/cibuild

hooks:
	@script/install-precommit

build:
	CGO_ENABLED=0 go build -trimpath -ldflags "-X main.Version=$(VERSION)" \
		-o bin/rtnetmon ./cmd/rtnetmon

run: build
	./bin/rtnetmon

dev:
	go run -ldflags "-X main.Version=$(VERSION)" ./cmd/rtnetmon

deps:
	go mod download
	go mod tidy

clean:
	rm -rf bin/
