-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (80 loc) · 4.02 KB
/
Copy pathMakefile
File metadata and controls
101 lines (80 loc) · 4.02 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
###############################################################################
# Configuration and Variables
################################################################################
ZIG_LOCAL := $(HOME)/.local/share/zig/0.16.0/zig
ZIG ?= $(shell test -x $(ZIG_LOCAL) && echo $(ZIG_LOCAL) || which zig)
BUILD_TYPE ?= Debug
BUILD_OPTS = -Doptimize=$(BUILD_TYPE)
JOBS ?= $(shell nproc || echo 2)
BUILD_DIR := zig-out
CACHE_DIR := .zig-cache
DOCS_DIR := docs
DOCS_PORT ?= 8085
RELEASE_MODE := ReleaseSmall
SHELL := /usr/bin/env bash
.SHELLFLAGS := -eu -o pipefail -c
################################################################################
# Targets
################################################################################
.PHONY: all build rebuild test format docs docs-serve clean release help shell setup-hooks test-hooks c-api interop corpus interop-nanoarrow golden
.DEFAULT_GOAL := help
help: ## Show the help messages for all targets
@grep -E '^[a-zA-Z0-9_-]+:.*?## ' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
all: build test ## Build and test
build: ## Build the static library (Mode=$(BUILD_TYPE))
@echo "Building project in $(BUILD_TYPE) mode with $(JOBS) concurrent jobs..."
$(ZIG) build $(BUILD_OPTS) -j$(JOBS)
rebuild: clean build ## Clean and build
test: ## Run unit tests
@echo "Running tests..."
$(ZIG) build test $(BUILD_OPTS) -j$(JOBS)
c-api: ## Build the C Data Interface shared library (libzarr_c)
@echo "Building the C Data Interface shared library..."
$(ZIG) build c-api $(BUILD_OPTS) -j$(JOBS)
interop: c-api ## Round-trip the C Data Interface and the IPC stream against pyarrow (skips if pyarrow absent)
@echo "Running the pyarrow C Data Interface round-trip..."
uv run python test/interop/roundtrip.py
@echo "Running the pyarrow IPC stream round-trip..."
uv run python test/interop/ipc_stream.py
@echo "Running the pyarrow IPC file round-trip..."
uv run python test/interop/ipc_file.py
corpus: ## Run the arrow-testing IPC fuzz corpus through the IPC readers (skips if the submodule is absent)
@echo "Running the arrow-testing IPC fuzz-regression corpus..."
$(ZIG) build corpus-check $(BUILD_OPTS) -j$(JOBS)
golden: ## Verify the Arrow integration golden files against their JSON values (skips if the submodule is absent)
@echo "Running the Arrow integration golden-file check..."
$(ZIG) build golden-check $(BUILD_OPTS) -j$(JOBS)
interop-nanoarrow: ## Run the differential IPC test against nanoarrow (skips if the submodule is absent)
@if [ ! -f external/nanoarrow/src/nanoarrow/nanoarrow.h ]; then \
echo "SKIP: nanoarrow submodule not initialized; run 'git submodule update --init'"; \
else \
echo "Running the nanoarrow IPC differential test..."; \
$(ZIG) build interop-nanoarrow $(BUILD_OPTS) -j$(JOBS); \
fi
release: ## Build in Release mode
@echo "Building the project in Release mode..."
@$(MAKE) BUILD_TYPE=$(RELEASE_MODE) build
format: ## Format Zig files
@echo "Formatting Zig files..."
$(ZIG) fmt .
docs: ## Generate API documentation into docs/api from src/lib.zig
@echo "Generating API documentation into $(DOCS_DIR)/api..."
@mkdir -p $(DOCS_DIR)/api
$(ZIG) build docs --prefix $(DOCS_DIR) -j$(JOBS)
docs-serve: docs ## Serve the API documentation on http://localhost:$(DOCS_PORT)
@echo "Serving docs at http://localhost:$(DOCS_PORT) (Ctrl-C to stop)..."
python3 -m http.server $(DOCS_PORT) --directory $(DOCS_DIR)/api
clean: ## Remove build artifacts, cache, and generated docs
@echo "Removing build artifacts, cache, and generated docs..."
rm -rf $(BUILD_DIR) $(CACHE_DIR) $(DOCS_DIR)/api
shell: ## Enter the Nix development shell (requires Nix with flakes)
@echo "Entering the Nix development shell..."
nix develop
setup-hooks: ## Install Git hooks (pre-commit and pre-push)
@echo "Installing Git hooks..."
@pre-commit install --hook-type pre-commit
@pre-commit install --hook-type pre-push
@pre-commit install-hooks
test-hooks: ## Run Git hooks on all files manually
@echo "Running Git hooks..."
@pre-commit run --all-files