-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (39 loc) · 1.61 KB
/
Makefile
File metadata and controls
51 lines (39 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.PHONY: build test bench bench-perf fuzz spec lint fmt clean help unpack-compat-tests
# Build variables
LDFLAGS_PKG := github.com/pk910/dynamic-ssz/codegen
BUILD_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w -X $(LDFLAGS_PKG).BuildCommit=$(BUILD_COMMIT) -X $(LDFLAGS_PKG).BuildTime=$(BUILD_TIME)
help: ## Show available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'
build: ## Build dynssz-gen binary
@mkdir -p bin
go build -ldflags="$(LDFLAGS)" -o bin/dynssz-gen ./dynssz-gen
test: ## Run unit tests
go test -race ./...
bench: ## Run library benchmarks
go test -run=^$$ -bench=. -benchmem ./...
bench-perf: ## Run performance benchmarks (perftests)
cd tests/perftests && ./setup_testdata.sh && go test -run=^$$ -bench=. -benchmem -v
fuzz: ## Run fuzz smoke test (30s)
$(MAKE) -C tests/fuzz smoke EXTENDED=true
spec: ## Run consensus spec tests
cd tests/spectests && ./run_tests.sh
lint: ## Run go vet and format check
go vet ./...
gofmt -l .
fmt: ## Format code
gofmt -w .
unpack-compat-tests: ## Unpack codegen compat-test archives for testing
@for archive in codegen/compat-tests/codegen_v*.tar.gz; do \
[ -f "$$archive" ] || continue; \
ver=$$(basename "$$archive" .tar.gz | sed 's/^codegen_//'); \
dest="codegen/compat-tests/$$ver"; \
mkdir -p "$$dest"; \
tar -xzf "$$archive" -C "$$dest"; \
rm -f "$$dest/generate.go"; \
echo "Unpacked $$archive -> $$dest"; \
done
clean: ## Remove build artifacts
rm -rf bin/
go clean -testcache