BINARY := wan
PORT   ?= 8123

.PHONY: run run-notes build test fmt vet dist clean

## run: build and run the server (override port with PORT=xxxx)
run:
	PORT=$(PORT) go run .

## run-notes: run the server against the ./notes store (override port with PORT=xxxx)
run-notes:
	PORT=$(PORT) go run . -data notes

## build: compile a static binary into ./bin
build:
	go build -o bin/$(BINARY) .

## test: run all tests
test:
	go test ./...

## fmt: format all Go source
fmt:
	go fmt ./...

## vet: run go vet
vet:
	go vet ./...

## dist: package tracked files into $(BINARY).zip for distribution (skips gitignored personal notes/configs)
dist:
	git archive --format=zip --prefix=$(BINARY)/ -o $(BINARY).zip HEAD

## clean: remove build artifacts
clean:
	rm -rf bin $(BINARY).zip
