Ctrl K
ComunidadGuías…

Makefile

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
.PHONY: all build lint fmt check audit test coverage bench fuzz clean deploy blog release

FUZZ_TOOLCHAIN := nightly-2025-12-01
FUZZ_TARGET ?= packet_parse
FUZZ_SECONDS ?= 60
# cargo-fuzz defaults to its own build triple, which is musl when it arrives via
# cargo-binstall. Pin it to the toolchain's host.
FUZZ_TRIPLE := $(shell rustc +$(FUZZ_TOOLCHAIN) -vV | sed -n 's/^host: //p')

all: lint build test

build:
	cargo build

lint: fmt check audit

fmt:
	cargo fmt --check

check:
	cargo clippy -- -D warnings

audit:
	cargo audit

test:
	cargo test

coverage:
	cargo tarpaulin --skip-clean --out stdout

bench:
	cargo bench

# cargo-fuzz resolves its toolchain from the repo root, so fuzz/rust-toolchain.toml
# never applies; pin it explicitly here. On macOS 26 ASan deadlocks pre-main, so
# sanitizers are off locally — CI runs the real thing on Linux.
fuzz:
	mkdir -p fuzz/corpus/$(FUZZ_TARGET)
	cargo +$(FUZZ_TOOLCHAIN) fuzz run --target $(FUZZ_TRIPLE) \
		$(if $(filter Darwin,$(shell uname -s)),-s none,) \
		$(FUZZ_TARGET) fuzz/corpus/$(FUZZ_TARGET) fuzz/seeds/$(FUZZ_TARGET) \
		-- -max_total_time=$(FUZZ_SECONDS) -max_len=4096 -timeout=25

blog:
	@mkdir -p site/blog/posts
	@for f in blog/*.md; do \
		name=$$(basename "$$f" .md); \
		pandoc "$$f" --template=site/blog-template.html -o "site/blog/posts/$$name.html"; \
		echo "  $$f → site/blog/posts/$$name.html"; \
	done
	@scripts/generate-blog-index.sh

blog-drafts: blog
	@if [ -d drafts ] && ls drafts/*.md >/dev/null 2>&1; then \
		for f in drafts/*.md; do \
			name=$$(basename "$$f" .md); \
			pandoc "$$f" --template=site/blog-template.html -o "site/blog/posts/$$name.html"; \
			echo "  $$f → site/blog/posts/$$name.html (draft)"; \
		done; \
		BLOG_INCLUDE_DRAFTS=1 scripts/generate-blog-index.sh; \
	else \
		echo "  No drafts found"; \
	fi

release:
ifndef VERSION
	$(error Usage: make release VERSION=0.8.0)
endif
	./scripts/release.sh $(VERSION)

clean:
	cargo clean

deploy:
	cargo build --release
	sudo cp target/release/numa /usr/local/bin/numa
ifeq ($(shell uname -s),Darwin)
	sudo codesign -f -s - /usr/local/bin/numa
	sudo kill $$(pgrep -f /usr/local/bin/numa) 2>/dev/null || true
else
	sudo systemctl restart numa 2>/dev/null || sudo kill $$(pgrep -f /usr/local/bin/numa) 2>/dev/null || true
endif
	@for i in 1 2 3 4 5 6 7 8 9 10; do \
		dig @127.0.0.1 google.com +short +time=1 +tries=1 > /dev/null 2>&1 && echo "Service restarted successfully" && exit 0; \
		sleep 1; \
	done; echo "Warning: DNS not responding after 10s"