Files
sift/Makefile
T
kyleandClaude Opus 5.5 cfde35397a P5a plan: PDF documents — seven Ornith tasks with acceptance tests first
docs/plans/p5a: 01 kind+fetch limits, 02 pdftext child + runner, 03 dcache PDF tables,
04 pdfpool, 05 pdfdoc render (map/pages/grep), 06 api, 07 digest citations, metrics, CLI,
skill, unit, README. Given tests compile against a panic-only skeleton and fail there for the
intended reasons; PDFs for tests are built by internal/pdftest (given), plus two qpdf-encrypted
fixtures.

Owner changes for the run: vendor go-pdfkit/extract v0.3.0 + reader v0.6.0 (pinned via
tools.go until task 02); AGENTS.md, tools/run-plan.sh (enforces a Co-Authored-By trailer for
the model), docs/implementer-log.md, `make gate`; gofmt (whitespace) on clean.go and guard;
TestUnsupportedType uses a zip now that PDFs are supported; requestDeadline 90→210 s and
writeTimeout 120→240 s for the PDF path's worst case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 20:47:38 -07:00

58 lines
2.0 KiB
Makefile

# 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 gate
all: build
build:
CGO_ENABLED=$(CGO_ENABLED) $(GO) build -trimpath -ldflags "$(LDFLAGS)" -o bin/sift ./cmd/sift
test:
$(GO) test -race ./...
# The implementer's gate (AGENTS.md): formatting, vet, race tests, staticcheck when present. Offline.
gate:
@test -z "$$(gofmt -l cmd internal tests 2>&1)" || { echo "gofmt: these files need formatting:"; gofmt -l cmd internal tests; exit 1; }
$(MAKE) lint
$(GO) test -race -count=1 ./...
@echo "gate: ok"
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