# Makefile is the source of truth for build flags. The flake's buildGoModule # uses the same -trimpath / ldflags, and `nix flake check` runs `make test lint`. PREFIX ?= /usr/local DESTDIR ?= VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) LDFLAGS := -s -w -X main.version=$(VERSION) CGO_ENABLED ?= 0 GO ?= go STATICCHECK ?= $(shell command -v staticcheck 2>/dev/null) .PHONY: all build test lint contract install clean all: build build: CGO_ENABLED=$(CGO_ENABLED) $(GO) build -trimpath -ldflags "$(LDFLAGS)" -o bin/sift ./cmd/sift test: $(GO) test -race ./... lint: $(GO) vet ./... @if [ -n "$(STATICCHECK)" ]; then $(STATICCHECK) ./...; else echo "staticcheck not found; skipped"; fi # Hermes 0.19/0.21 SDK harness (firecrawl-py==4.17.0) against a local sifttest binary. contract: $(GO) test -count=1 ./internal/api ./internal/auth ./internal/guard @if command -v python3 >/dev/null 2>&1; then \ $(GO) build -tags sifttest -trimpath -ldflags "$(LDFLAGS)" -o bin/sift-test ./cmd/sift && \ python3 tests/contract/sdk_test.py; \ else \ if [ "$$SIFT_CONTRACT_SKIP_SDK" = "1" ]; then echo "python3 missing; skipped"; \ else echo "python3 required for make contract" >&2; exit 1; fi; \ fi install: build install -d $(DESTDIR)$(PREFIX)/bin install -m 755 bin/sift $(DESTDIR)$(PREFIX)/bin/sift install -d $(DESTDIR)/etc/sift if [ ! -f $(DESTDIR)/etc/sift/config.toml ]; then \ install -m 644 dist/sift.toml.example $(DESTDIR)/etc/sift/config.toml; \ fi install -d $(DESTDIR)$(PREFIX)/lib/systemd/system install -m 644 dist/sift.service $(DESTDIR)$(PREFIX)/lib/systemd/system/sift.service clean: rm -rf bin/ rm -f sift *.test