# AASD — API Attack Surface Discovery
# Version: 2026-04.1
# GITEX 2026 Booth Application

GO       := go
BINARY   := /opt/aasd/aasd
PACKAGES := ./cmd/aasd/ ./internal/...

.PHONY: all build vet test clean deploy restart logs

all: vet test build

## build — Compile the AASD binary
build:
	$(GO) build -o $(BINARY) ./cmd/aasd/

## vet — Run static analysis
vet:
	$(GO) vet $(PACKAGES)

## test — Run all unit tests with race detector
test:
	$(GO) test ./internal/... -v -count=1 -race -timeout 30s

## test-short — Quick test run (no race detector)
test-short:
	$(GO) test ./internal/... -count=1 -timeout 30s

## clean — Remove build artifacts
clean:
	rm -f $(BINARY)

## deploy — Build, deploy binary, and restart service (requires sudo)
deploy: build
	sudo systemctl restart aasd

## restart — Restart the systemd service
restart:
	sudo systemctl restart aasd

## status — Check service status
status:
	sudo systemctl status aasd

## logs — Follow service logs
logs:
	sudo journalctl -u aasd -f
