.PHONY: build run test test-unit test-integration lint docker clean

BINARY=edgeai-gateway
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS=-ldflags "-X main.version=$(VERSION)"

build:
	go build $(LDFLAGS) -o bin/$(BINARY) ./cmd/gateway

run:
	go run ./cmd/gateway --config configs/config.yaml

test:
	go test ./... -v -count=1

test-unit:
	go test ./internal/... -v -count=1

test-integration:
	go test ./test/integration/... -v -count=1

test-coverage:
	go test ./... -coverprofile=coverage.out -count=1
	go tool cover -func=coverage.out

lint:
	golangci-lint run ./...

docker:
	docker build -t $(BINARY):$(VERSION) .

clean:
	rm -rf bin/ coverage.out

tidy:
	go mod tidy
