guard/Makefile
loki5512344 aa615a1141
fix: XDP unsafe loader + Redis sync; enforce 250-line/4-file layout limits
- xdp: CString for if_nametoindex (was UB), real detach via prog fd
  (fabricated borrow_raw(-1) silently never detached), SAFETY comments,
  saturating expiry math; +5 unit tests
- redis: real pubsub reconnect with exponential backoff (was sleep+return);
  KEYS -> SCAN in heartbeat sweep
- ci: cargo test --all-features, repo-gates job — module size gate
  (scripts/check_module_size.sh, ratchet baseline) + default-secrets grep
- refactor src/ to <=250 LOC/file, <=4 .rs/dir without behavior change;
  thin bins (rampart.rs 330 -> 6 LOC), new app/, subnet/, intel/,
  profile/, prefix/, challenge/, filter/, probe/, inventory/, metrics/, node/
- docs: TODO v5.0 (status refresh, new rules, findings backlog),
  README quickstart now matches real binaries
- verify: fmt/clippy -D warnings/test --all-features (164 tests)/clang XDP green
2026-09-15 23:55:17 +02:00

89 lines
1.6 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
.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 -c xdp/core/universal_filter.c -o $(TARGET_DIR)/xdp/universal_filter.o 2>/dev/null || \
echo "WARNING: clang+bpf not installed, skipping eBPF build"
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)"
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"