guard/Makefile
loki5512344 72c1f45d62
perf: criterion benchmarks for the per-connection hot path
- benches/hot_paths.rs measures RateLimiter::check, Blacklist exact/CIDR/miss
  lookups, SubnetDetector::evaluate over 256 prefixes and HTTP request-head
  validation; `cargo bench --all-features --bench hot_paths`, HTML report in
  target/criterion.
- Dev-machine medians recorded in docs/testing.md (~110 ns rate limit,
  ~70 ns exact ban lookup, ~220 ns CIDR lookup, ~2.6 us detector window,
  ~280 ns HTTP head).
- Makefile `bench` target; the bench is gated on protocol-http.
2026-11-16 12:55:51 +01:00

98 lines
1.9 KiB
Makefile

# Rampart — Build System
CARGO = cargo
TARGET_DIR = target
.PHONY: all build release test test-all check check-all fmt fmt-check clippy clean deny audit fuzz bench
.PHONY: ebpf ebpf-clean
.PHONY: docker docker-build docker-up docker-down docker-logs
.PHONY: ci ci-full repo-gates
all: check test build
# --- Rust ---
build:
$(CARGO) build
release:
$(CARGO) build --release
check:
$(CARGO) check
check-all:
$(CARGO) check --all-features
test:
$(CARGO) test
test-all:
$(CARGO) test --all-features
fmt:
$(CARGO) fmt --all
fmt-check:
$(CARGO) fmt --all --check
clippy:
$(CARGO) clippy --all-targets --all-features -- -D warnings
clean:
$(CARGO) clean
deny:
cargo deny check
audit:
cargo audit
# --- eBPF / XDP ---
ebpf:
@echo "Building XDP/eBPF filter..."
mkdir -p $(TARGET_DIR)/xdp
clang -O2 -g -target bpf -I"/usr/include/$$(gcc -print-multiarch)" \
-c xdp/core/universal_filter.c -o $(TARGET_DIR)/xdp/universal_filter.o
ebpf-clean:
rm -f $(TARGET_DIR)/xdp/universal_filter.o
# --- Docker ---
docker-build:
docker compose -f deploy/docker-compose.yml build
docker-up: docker-build
docker compose -f deploy/docker-compose.yml up -d
docker-down:
docker compose -f deploy/docker-compose.yml down
docker-logs:
docker compose -f deploy/docker-compose.yml logs -f
# --- Convenience ---
checkstyle: fmt-check clippy
@echo "✓ Checkstyle passed (rustfmt + clippy)"
bench:
$(CARGO) bench --all-features --bench hot_paths
# Parser fuzzing (nightly + cargo-fuzz). 60 s per target is a smoke run;
# longer campaigns are run locally before a release.
fuzz:
cargo +nightly fuzz run http_head fuzz/seeds/http_head -- -max_total_time=60
cargo +nightly fuzz run proxy_v2 -- -max_total_time=60
repo-gates:
bash scripts/check_module_size.sh
bash scripts/check_default_secrets.sh
ci: checkstyle test-all build deny repo-gates
@echo "✓ CI passed"
ci-full: ci ebpf
@echo "✓ Full CI passed"