-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
464 lines (382 loc) · 24.8 KB
/
Copy pathMakefile
File metadata and controls
464 lines (382 loc) · 24.8 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# (C) Copyright 2026- ECMWF and individual contributors.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
# Top-level Makefile dispatching builds and tests for all languages.
# Run `make help` to see available targets.
.PHONY: help all build check test lint fmt docs clean \
bump-version version-check \
release-check feature-tests crates-verify cargo-c-header-check \
python-release-check npm-pack-check \
rust-check rust-build rust-test rust-lint rust-fmt rust-clippy \
python-build python-dist python-dist-extras python-test python-lint python-fmt \
earthkit-install earthkit-test earthkit-lint \
cpp-build cpp-test \
fortran-build fortran-test fortran-fpm-test fortran-f2008-check \
cargo-c-build cargo-c-install cargo-c-test \
mutants-install mutants mutants-diff mutants-shard \
wasm-build wasm-test docs-build doc-examples \
ts-install ts-build ts-test ts-typecheck \
remote-parity-rust-build remote-parity-ts-install remote-parity-fixtures \
remote-parity-build remote-parity remote-parity-clean
# ── Defaults ──────────────────────────────────────────────────────────────
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
all: check build test lint ## Build every language surface, then run all checks, tests, and lints
# ── Rust ──────────────────────────────────────────────────────────────────
rust-check: ## Check Rust workspace compiles
cargo check --workspace
cargo check -p tensogram --no-default-features
rust-build: ## Build the Rust workspace (debug binaries + libs)
cargo build --workspace
rust-test: ## Run all Rust tests
cargo test --workspace
rust-clippy: ## Run clippy on Rust workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy -p tensogram --all-targets --features "remote,async" -- -D warnings
rust-fmt: ## Check Rust formatting
cargo fmt --check
rust-lint: rust-clippy rust-fmt ## Run all Rust lints (clippy + fmt)
# ── Python ────────────────────────────────────────────────────────────────
PYTHON ?= uv run python
RUFF ?= uv run --with ruff ruff
# `--no-project` keeps `uv run` from discovering python/bindings/pyproject.toml
# and trying to install `tensogram` (incl. its `[all]` extras) before maturin
# even starts. Without it, every minor-version release fails at wheel build
# time because the new sibling extras (tensogram-xarray / tensogram-zarr at
# the new minor) don't exist on PyPI yet — the publish flow itself is what
# uploads them. maturin still reads pyproject.toml directly for the build.
#
# Maturin must live in the project's `.venv` rather than a `uv run --with`
# ephemeral env: with `--with maturin --no-project`, uv runs maturin in a
# transient interpreter under `~/.cache/uv/builds-v0/...`, and `maturin
# develop --uv` then installs the freshly-built wheel into THAT env, not
# `.venv`. The subsequent `uv pip install ./python/tensogram-{xarray,zarr}`
# resolves `tensogram` from PyPI as a transitive dep, silently shadowing
# HEAD. The `python-build` recipe below installs maturin into `.venv`
# explicitly before invoking this macro.
MATURIN ?= uv run --no-project maturin
RUFF_CFG ?= python/bindings/pyproject.toml
# Space-separated --interpreter flags passed to maturin build; defaults to
# auto-discovery. Override in CI: MATURIN_INTERP_ARGS="--interpreter /path/to/py"
MATURIN_INTERP_ARGS ?= --find-interpreter
# Optional maturin --compatibility target (e.g. manylinux_2_28).
# Passed as --compatibility <value> when non-empty.
MATURIN_COMPAT ?=
MATURIN_COMPAT_ARG = $(if $(MATURIN_COMPAT),--compatibility $(MATURIN_COMPAT))
python-build: ## Build Python bindings via maturin (dev install into .venv)
if [ ! -d .venv ] ; then uv venv ; fi
# `[patchelf]` ships the patchelf binary maturin uses to set the
# shared-library rpath on Linux (matches release-preflight CI; without
# it maturin only warns).
uv pip install 'maturin[patchelf]'
# Force a fresh cdylib link. Across repeated `maturin develop --uv`
# runs, cargo/maturin can leave a 0-byte, hardlinked libtensogram.so in
# target/ while cargo's fingerprint still reads "fresh", so cargo never
# relinks and the next develop aborts with "Object is too small".
# Removing the artifacts makes cargo relink a valid, unshared library.
rm -f python/bindings/target/release/libtensogram.so python/bindings/target/release/deps/libtensogram*.so
rm -rf python/bindings/target/maturin
cd python/bindings && $(MATURIN) develop --release --uv
uv pip install ./python/tensogram-xarray
uv pip install ./python/tensogram-zarr
python-dist: ## Build tensogram distributable wheels for the current platform
if [ ! -d .venv ] ; then uv venv ; fi
# `python-dist` must be self-contained: install maturin into .venv (it is
# not pre-installed in a fresh CI job — locally it only worked because a
# prior `python-build` had installed it). `[patchelf]` for Linux rpath.
uv pip install 'maturin[patchelf]'
cd python/bindings && $(MATURIN) build --release --out dist $(MATURIN_INTERP_ARGS) $(MATURIN_COMPAT_ARG)
python-dist-extras: ## Build distributable wheels for pure-Python extra packages
uv build python/tensogram-xarray --out-dir dist/extras
uv build python/tensogram-zarr --out-dir dist/extras
uv build python/tensogram-anemoi --out-dir dist/extras
python-test: python-build ## Run all Python tests
# TODO pip installs should come from workspace-level pyproject
uv pip install pytest pytest-asyncio numpy
$(PYTHON) -m pytest python/tests/ -v
$(PYTHON) -m pytest python/tensogram-xarray/tests/ -v
$(PYTHON) -m pytest python/tensogram-zarr/tests/ -v
python-lint: ## Run ruff check on Python code
$(RUFF) check --config $(RUFF_CFG) python/tests/ python/tensogram-xarray/ python/tensogram-zarr/
python-fmt: ## Check Python formatting
$(RUFF) format --check --config $(RUFF_CFG) python/tests/ python/tensogram-xarray/ python/tensogram-zarr/
# ── earthkit-data integration ────────────────────────────────────────────
earthkit-install: ## Install the earthkit-data integration package (editable, with dev extras)
if [ ! -d .venv ] ; then uv venv ; fi
uv pip install earthkit-data earthkit-utils
uv pip install -e python/tensogram-xarray/
uv pip install -e "python/tensogram-earthkit/[dev]"
earthkit-test: earthkit-install ## Run tensogram-earthkit tests
$(PYTHON) -m pytest python/tensogram-earthkit/tests/ -v
earthkit-lint: ## Run ruff on the tensogram-earthkit package
$(RUFF) check python/tensogram-earthkit/
$(RUFF) format --check python/tensogram-earthkit/
# ── C++ ───────────────────────────────────────────────────────────────────
cpp-build: ## Build C++ tests via CMake
cmake -S cpp -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
cpp-test: cpp-build ## Run C++ tests
cd build && ctest --output-on-failure
# ── Fortran ───────────────────────────────────────────────────────────────
#
# The Fortran binding (fortran/) links the system libtensogram discovered via
# pkg-config (the cargo-c / release-tarball install that ships tensogram.pc).
# CMake is the system of record; fpm is retained as a devloop. Not folded into
# the default `make test` because it needs a Fortran compiler and an installed
# tensogram.pc.
fortran-build: ## Build the Fortran binding + examples + tests via CMake
cmake -S fortran -B build/fortran -DCMAKE_BUILD_TYPE=Debug
cmake --build build/fortran
fortran-test: fortran-build ## Run Fortran tests (incl. Fortran<->Python parity when available)
cd build/fortran && ctest --output-on-failure
fortran-fpm-test: ## Build the Fortran library via fpm (injects pkg-config flags)
cd fortran && fpm build \
--flag "$$(pkg-config --cflags tensogram)" \
--link-flag "$$(pkg-config --libs tensogram)"
# Fortran 2008 conformance gate: the binding LIBRARY must compile clean under
# -std=f2008 -Wall -Wextra -Werror. Examples/tests are OFF on purpose — they
# declare handle locals, which gfortran flags with an f08/0011 advisory under
# -std=f2008 (valid F2008, but -Werror-promoted; see fortran/CMakeLists.txt).
# A nonzero exit means the library regressed into an
# F2018-only construct.
fortran-f2008-check: ## Verify the binding library compiles clean under -std=f2008
cmake -S fortran -B build/fortran-f2008 -DCMAKE_BUILD_TYPE=Debug \
-DTENSOGRAM_FORTRAN_STD=f2008 \
-DTENSOGRAM_FORTRAN_TESTS=OFF -DTENSOGRAM_FORTRAN_EXAMPLES=OFF
cmake --build build/fortran-f2008
# ── cargo-c (C API distribution) ──────────────────────────────────────────
# Default prefix for `make cargo-c-install` — overrideable.
PREFIX ?= $(HOME)/.local
cargo-c-build: ## Build the C library + pkg-config + header via cargo-c
cargo cbuild --release -p tensogram-ffi
# --libdir=lib pins the layout so PREFIX/lib/pkgconfig/tensogram.pc lands at
# a predictable path. Without it cargo-c picks a multiarch libdir on
# Debian/Ubuntu (lib/x86_64-linux-gnu/...) and the smoke target breaks.
cargo-c-install: ## Install via cargo-c into PREFIX (default $HOME/.local)
cargo cinstall --release -p tensogram-ffi --prefix=$(PREFIX) --libdir=lib
cargo-c-test: cargo-c-install ## Run all C-API tests: tensogram-ffi unit/integration tests + cargo-c install smoke test
cargo test -p tensogram-ffi --features async-remote
bash cpp/tests/test_cargo_c_smoke.sh $(PREFIX)
# ── Mutation testing (cargo-mutants) ──────────────────────────────────────
#
# Three targets wrapping cargo-mutants with the project's seven concurrency
# clamps (see docs/src/dev/mutation-testing.md "Concurrency — seven nested
# layers"). Only the *mutant worker count* is exposed as a tunable knob
# via `MUTANTS_JOBS=N` (defaults to 2); TENSOGRAM_THREADS, jobserver-tasks,
# CMAKE_BUILD_PARALLEL_LEVEL, and MAKEFLAGS are pinned because they MUST
# stay at 1/-j1 during mutation testing — a 12-core laptop has experienced
# power-down events when these were unbounded.
# Mutant worker count. Override at the command line:
# make mutants-diff MUTANTS_JOBS=4
MUTANTS_JOBS ?= 2
# Common cargo-mutants prefix (env vars + jobserver-tasks).
# `cargo-mutants` is installed on demand if missing — the `--locked`
# install is idempotent (cargo skips when version already present).
mutants-install: ## Install cargo-mutants 27.0.0 if missing
@command -v cargo-mutants >/dev/null 2>&1 || \
cargo install cargo-mutants --version 27.0.0 --locked
# Build the env-var prefix once for reuse across the three sweep targets.
# Note the dollar-double-dollar: makefile-time vs shell-time expansion.
MUTANTS_ENV = \
CARGO_MUTANTS_JOBS=$(MUTANTS_JOBS) \
TENSOGRAM_THREADS=1 \
CMAKE_BUILD_PARALLEL_LEVEL=1 \
MAKEFLAGS=-j1
# Feature set enabled during mutation runs. cargo-mutants forwards
# `--features` to whatever package set it builds; for `mutants-diff` that
# set is auto-selected from the changed files, so every feature listed
# here must be defined by at least one selected package or the unmutated
# baseline build fails ("none of the selected packages contains this
# feature"). We therefore enable the async + remote surface via features
# the core `tensogram` crate defines (`async`, `remote`) rather than the
# `tensogram-ffi`-only `async-remote` alias — `remote` pulls in the same
# `tensogram/remote` code path, and a diff that actually touches
# `tensogram-ffi` selects that crate (which defines `async`) anyway.
MUTANTS_FLAGS = \
--no-shuffle \
--jobserver-tasks $(MUTANTS_JOBS) \
--timeout-multiplier 3.0 \
--features async,remote
mutants: mutants-install ## Full-workspace cargo-mutants sweep (long; use mutants-diff for PRs)
$(MUTANTS_ENV) cargo mutants $(MUTANTS_FLAGS)
# `cargo-mutants --in-diff` takes a path to a diff FILE, not a git
# revision range. Two ways to drive this target:
#
# make mutants-diff # auto-compute
# make mutants-diff DIFF_FILE=path/to/diff.patch # pre-generated
#
# The auto-compute path runs `git diff origin/main...HEAD` (three-dot
# form: PR-relative diff, ignoring main commits made after the branch
# point) with `safe.directory='*'` set so it works inside Docker
# containers where the runner's checkout safe-directory configuration
# isn't inherited. The DIFF_FILE override is the recommended path
# for CI workflows that want to compute the diff in a step that's
# already authenticated against the repo (e.g. right after
# actions/checkout) — see `.github/workflows/ci.yml`.
mutants-diff: mutants-install ## Run cargo-mutants on a diff (auto from origin/main, or DIFF_FILE=path)
@if [ -n "$(DIFF_FILE)" ]; then \
DIFF="$(DIFF_FILE)"; \
echo "[make mutants-diff] using pre-generated diff: $$DIFF"; \
$(MUTANTS_ENV) cargo mutants --in-diff "$$DIFF" $(MUTANTS_FLAGS); \
else \
DIFF=$$(mktemp -t mutants-diff.XXXXXX) && DIFF=$${DIFF}.patch && touch "$$DIFF"; \
trap "rm -f $$DIFF" EXIT; \
echo "[make mutants-diff] computing git diff origin/main...HEAD into $$DIFF"; \
git -c safe.directory='*' diff origin/main...HEAD > "$$DIFF" || { \
echo "ERROR: git diff origin/main...HEAD failed (cwd=$$(pwd))" >&2; \
echo " In CI, ensure actions/checkout uses fetch-depth: 0," >&2; \
echo " or pass a pre-computed diff via DIFF_FILE=path." >&2; \
exit 1; \
}; \
$(MUTANTS_ENV) cargo mutants --in-diff "$$DIFF" $(MUTANTS_FLAGS); \
fi
# Single-shard run. SHARD must be N/M (e.g. SHARD=1/16).
# Used by .github/workflows/mutants-weekly.yml; matrix-ed across all
# 16 shards by GitHub Actions.
mutants-shard: mutants-install ## Run a single mutant shard (SHARD=N/M, e.g. SHARD=1/16)
@test -n "$(SHARD)" || (echo "Usage: make mutants-shard SHARD=N/M (e.g. SHARD=1/16)" && exit 1)
$(MUTANTS_ENV) cargo mutants --shard $(SHARD) $(MUTANTS_FLAGS)
# ── WASM ──────────────────────────────────────────────────────────────────
# `--out-dir` is resolved relative to the crate directory, so `../../build/wasm`
# lands at <repo>/build/wasm — git-ignored and removed by `make clean`. This is
# a standalone "does the wasm crate build" target; the copy the TypeScript
# wrapper actually consumes is produced by `ts-build` into typescript/wasm.
wasm-build: ## Build the tensogram-wasm crate to a wasm package (wasm-pack)
wasm-pack build rust/tensogram-wasm --release --target web --out-dir ../../build/wasm --out-name tensogram_wasm
wasm-test: ## Run WASM tests
wasm-pack test --node rust/tensogram-wasm
# ── TypeScript ────────────────────────────────────────────────────────────
ts-install: ## Install TypeScript wrapper dependencies
cd typescript && npm ci || npm install --no-audit --no-fund
ts-build: ts-install ## Build the TypeScript wrapper (wasm-pack + tsc)
cd typescript && npm run build
ts-test: ts-build ## Run TypeScript wrapper tests (vitest)
cd typescript && npm test
ts-typecheck: ts-build ## Strict typecheck source + tests
cd typescript && npx tsc --noEmit -p tsconfig.test.json
# ── Docs ──────────────────────────────────────────────────────────────────
docs: docs-build ## Build the documentation site (alias for docs-build)
docs-build: ## Build mdbook documentation
mdbook build docs/
# Run the self-contained, runnable code examples embedded in docs/src/**/*.md
# (Rust `fn main()` blocks + self-contained Python blocks). mdbook code blocks
# are not exercised by `cargo test`, so this gate catches documented examples
# that stop working. Needs cargo on PATH and the `tensogram` Python binding
# importable by `$(PYTHON)` (plus any optional deps the examples use, e.g.
# numpy / xarray / zarr — missing optional deps are skipped, not failed).
doc-examples: ## Run the runnable code examples in docs/src (Rust + Python)
$(PYTHON) scripts/test_doc_examples.py
# ── Remote parity harness ─────────────────────────────────────────────────
#
# Cross-language HTTP parity test infra under `tests/remote-parity/`.
# Drives Rust `TensogramFile::open_remote` and TS `TensogramFile.fromUrl`
# against a Python mock server and diffs the request sequences. Not
# folded into `make test` because it needs the TS WASM build, an extra
# `npm install`, and a Rust release binary built outside the main
# workspace.
_PARITY_DIR = tests/remote-parity
_PARITY_RUST_MANIFEST = $(_PARITY_DIR)/drivers/rust_driver/Cargo.toml
_PARITY_DRIVERS_DIR = $(_PARITY_DIR)/drivers
# The Rust driver is its own cargo project (empty `[workspace]`) so it
# must be built explicitly — `cargo build --workspace` won't see it.
remote-parity-rust-build: ## Build the parity-harness Rust driver (isolated cargo project)
cargo build --release --manifest-path $(_PARITY_RUST_MANIFEST)
remote-parity-ts-install: ts-build ## Install parity-harness TS driver deps (uses npm ci)
cd $(_PARITY_DRIVERS_DIR) && npm ci || npm install --no-audit --no-fund
# Fixtures are committed binary artefacts — regenerating produces
# different bytes (encoder stamps fresh timestamp + UUID). The pytest
# suite computes expected offsets live from the fixture, so it
# survives intentional regenerations. Run only on intentional changes.
remote-parity-fixtures: python-build ## (Re)generate .tgm fixtures — commit the diff after review
$(PYTHON) $(_PARITY_DIR)/tools/gen_fixtures.py
remote-parity-build: remote-parity-rust-build remote-parity-ts-install python-build ## Build every parity-harness driver
@echo "parity harness drivers ready"
remote-parity: remote-parity-build ## Run the full parity harness (rebuilds drivers + pytest)
uv pip install pytest numpy
$(PYTHON) -m pytest $(_PARITY_DIR)/ -v
remote-parity-clean: ## Remove parity-harness build artefacts (keeps fixtures)
rm -rf $(_PARITY_DIR)/drivers/rust_driver/target/
rm -rf $(_PARITY_DRIVERS_DIR)/node_modules/
find $(_PARITY_DIR) -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
# ── Versioning ────────────────────────────────────────────────────────────
bump-version: ## Bump the project version everywhere: make bump-version VERSION=X.Y.Z
@test -n "$(VERSION)" || { echo "usage: make bump-version VERSION=X.Y.Z"; exit 2; }
python3 scripts/bump_version.py $(VERSION)
version-check: ## Verify every manifest matches the VERSION file (CI guard)
python3 scripts/bump_version.py --check
# ── Release readiness ─────────────────────────────────────────────────────
#
# `make release-check` runs the release-only gates that `make all` does NOT,
# so run it AFTER a green `make all`, before tagging. It mirrors the locally
# runnable subset of .github/workflows/release-preflight.yml (the authoritative
# pre-tag CI gate, which additionally runs the grib/netcdf + macOS matrices and
# the real dry-run publishes on a clean checkout). Full procedure:
# docs/src/dev/releasing.md.
# Host target triple — cargo-c emits its artefacts under target/<triple>/.
_HOST_TRIPLE = $(shell rustc -vV | sed -n 's/^host: //p')
feature-tests: ## Test the optional-feature surface that make-all's default-feature run skips
cargo test -p tensogram --features remote
cargo test -p tensogram --features "remote,async"
crates-verify: ## List every workspace crate tarball + dry-run publish the leaf crates
# `--allow-dirty`: release-check is meant to run before the final release
# commit (version bump / changelog edits may still be uncommitted). The
# real publish runs on the clean tagged commit via publish-crates.yml.
for crate in tensogram-szip tensogram-sz3-sys tensogram-sz3 \
tensogram-encodings tensogram tensogram-ffi tensogram-cli; do \
echo "==> cargo package -p $$crate --list"; \
cargo package -p "$$crate" --list --allow-dirty >/dev/null || exit 1; \
done
# Leaf crates have no path-only deps, so a real dry-run publish compiles
# the packaged tarball — catching missing `include` files or bad metadata.
# (Crates with sibling path deps cannot be dry-run-published until the deps
# are on crates.io; the publish-crates workflow handles their ordering.)
cargo publish --dry-run --allow-dirty -p tensogram-szip
cargo publish --dry-run --allow-dirty -p tensogram-sz3-sys
cargo-c-header-check: cargo-c-build ## Diff the in-tree FFI header against cargo-c's generated header (drift guard)
diff -u rust/tensogram-ffi/tensogram.h \
target/$(_HOST_TRIPLE)/release/include/tensogram/tensogram.h
python-release-check: python-dist python-dist-extras ## Build all wheels + validate their metadata with twine
uv pip install twine
$(PYTHON) -m twine check python/bindings/dist/*.whl dist/extras/*
npm-pack-check: ts-build ## Verify the published npm tarball would include the wasm blob
cd typescript && set -o pipefail && npm pack --dry-run --json 2>/dev/null | \
node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{const f=JSON.parse(d)[0].files.map(x=>x.path); if(!f.includes('wasm/tensogram_wasm_bg.wasm')){console.error('FATAL: wasm blob missing from npm tarball');process.exit(1)} console.log('ok: wasm blob present in npm tarball')})"
release-check: version-check feature-tests crates-verify cargo-c-header-check python-release-check npm-pack-check ## Release-readiness gate — run AFTER `make all`, before tagging
@echo ""
@echo "release-check: all release gates passed."
@echo "Next: see docs/src/dev/releasing.md for the bump / tag / publish steps."
# ── Aggregates ────────────────────────────────────────────────────────────
check: rust-check ## Check all builds
# `build` compiles every language surface in one shot: Rust, Python (maturin),
# TypeScript (wasm-pack + tsc), C++ (CMake), WASM (wasm-pack), and the cargo-c C
# library. The Fortran binding links that C ABI via pkg-config, so it is built
# last against a repo-local install prefix (build/ffi-prefix — no writes outside
# the tree; `make clean` removes it). The build/fortran CMake dir is wiped first
# so the configure always re-queries pkg-config against the freshly installed
# prefix; otherwise a stale cache can pin an absolute include dir from an earlier
# prefix and fail the generate step. Heavier system prerequisites than the other
# aggregates: a C/C++ toolchain + CMake, gfortran + pkg-config, wasm-pack,
# cargo-c, uv, and Node.
build: rust-build python-build ts-build cpp-build wasm-build cargo-c-build ## Build every language surface (Rust, Python, TS, C++, WASM, cargo-c, Fortran)
$(MAKE) cargo-c-install PREFIX=$(CURDIR)/build/ffi-prefix
rm -rf $(CURDIR)/build/fortran
PKG_CONFIG_PATH="$(CURDIR)/build/ffi-prefix/lib/pkgconfig:$$PKG_CONFIG_PATH" $(MAKE) fortran-build
test: rust-test python-test ts-test ## Run all tests
lint: rust-lint python-lint python-fmt ts-typecheck ## Run all lints
fmt: rust-fmt python-fmt ## Check all formatting
# ── Cleanup ───────────────────────────────────────────────────────────────
clean: remote-parity-clean ## Remove build artifacts (delegates parity-harness cleanup to remote-parity-clean)
cargo clean
rm -rf build/
rm -rf .venv/
rm -rf docs/book/
rm -rf python/bindings/target/
find python/bindings/python -name '*.so' -o -name '*.pyd' | xargs rm -f 2>/dev/null || true
rm -rf typescript/dist/ typescript/wasm/ typescript/node_modules/
rm -rf examples/typescript/node_modules/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true