export CGO_ENABLED=1

.PHONY: default bootstrap setup build test lint lint-darwin fmt fmt-check \
	check docker docker-run clean install hooks

default: check

bootstrap:
	@script/bootstrap

setup:
	@script/setup

# Build ./secret; `make build VERSION=x` stamps x instead of `git describe`
build:
	@script/build

test:
	@script/test

fmt:
	@script/fmt

lint:
	@script/lint

# Type-check and lint the macOS build from Linux (see script/lint-darwin)
lint-darwin:
	@script/lint-darwin

check:
	@script/check

# Build Docker container
docker:
	@script/docker

# Run Docker container interactively
docker-run:
	docker run --rm -it "$$(./script/projectname)"

# Clean build artifacts
clean:
	rm -f ./secret

install: build
	cp ./secret $(HOME)/bin/secret

fmt-check:
	@script/fmt-check

hooks:
	@script/install-precommit
