BINARY     := clonepack
BUILD_DIR  := bin
CMD        := ./cmd/clonepack

.PHONY: all build run test lint clean tidy help

all: build

## build: compile le binaire dans bin/clonepack
build:
	@mkdir -p $(BUILD_DIR)
	go build -o $(BUILD_DIR)/$(BINARY) $(CMD)

## run: démarre le serveur
run: build
	./$(BUILD_DIR)/$(BINARY) serve

## test: lance tous les tests
test:
	go test ./...

## test-v: tests avec sortie verbeuse
test-v:
	go test -v ./...

## lint: vérifie le code (nécessite golangci-lint)
lint:
	golangci-lint run ./...

## vet: analyse statique Go
vet:
	go vet ./...

## tidy: met à jour go.mod et go.sum
tidy:
	go mod tidy

## clean: supprime les artefacts de build
clean:
	rm -rf $(BUILD_DIR)

## help: affiche cette aide
help:
	@grep -E '^## ' Makefile | sed 's/## /  /'
