Files
khosra/Makefile
T
bdeshi 9359478789 add a Makefile and build instructions
So the thing can be built and run without reading the harness. Eight targets,
each one go command or verify.sh; make help lists them. README gains the four
lines someone actually needs, and says a site root is a directory the binary is
pointed at rather than something in this repo.

make is recorded in toolchain.md as a convenience: the gate never invokes it, so
a machine without make loses nothing but typing.
2026-08-01 02:23:34 +06:00

34 lines
929 B
Makefile

# Convenience only. `go build`, `go test` and ./scripts/verify.sh are the ground truth — nothing here
# is required to work on khosra, and the gate never invokes make.
SITE ?= $(KHOSRA_SITE)
ADDR ?= localhost:8080
BIN := ./khosra
.PHONY: help build run test verify fmt tidy clean
help: ## list targets
@grep -hE '^[a-z]+:.*##' $(MAKEFILE_LIST) | sed 's/:[^#]*## /|/' | column -t -s '|'
build: ## compile the binary
go build -o $(BIN) ./cmd/khosra
run: build ## serve a site root: make run SITE=/path/to/site
@test -n "$(SITE)" || { echo "set SITE=/path/to/site, or export KHOSRA_SITE"; exit 1; }
$(BIN) -site "$(SITE)" -addr "$(ADDR)"
test: ## run tests with the race detector
go test -race ./...
verify: ## everything the harness enforces; must be green before a commit
./scripts/verify.sh
fmt: ## format all Go source
gofmt -w .
tidy: ## tidy go.mod
go mod tidy
clean: ## remove build output
rm -f $(BIN)