Skip to content

Conversation

@ArtiomTr
Copy link
Contributor

No description provided.

This Makefile provides convenient targets for:
- Building all backends and creating static libraries
- Running tests (default, parallel, wasm, and c-kzg-4844 integration tests)
- Running benchmarks with different feature combinations
- Linting with clippy and formatting checks
- All targets support individual backend selection

Targets are organized by functionality with clear help text. Supports all
seven backends (blst, zkcrypto, arkworks5, arkworks4, arkworks3, constantine, mcl)
and includes special handling for wasm and c-kzg-4844 integration.
- Export C_KZG_4844_GIT_HASH environment variable required for c-kzg-4844 tests
- Remove --release flag from cargo bench (not supported, release is implicit)
- All build, test, lint, format, and clean targets verified working
Allows users to disable colored output by setting NOCOLOR=1:
  make NOCOLOR=1 help
  make NOCOLOR=1 test-blst

Useful for CI pipelines, redirecting to files, or user preference.
Colors are enabled by default for better readability in terminals.
Automatically disables colors when:
- NO_COLOR environment variable is set (https://no-color.org standard)
- Running in CI environments (CI, GITHUB_ACTIONS, GITLAB_CI, CIRCLECI, TRAVIS, etc)
- Output is piped/redirected (not a TTY)
- TERM is set to 'dumb'

Colors are enabled by default for interactive terminals. Users can still:
- Force colors: make NOCOLOR=0 target
- Force no colors: make NOCOLOR=1 target

Respects both de facto (NO_COLOR) and proposed user preferences.
Simplified both workflows by replacing raw cargo commands with Makefile targets:

backend-tests.yml:
- Replaced individual kzg/kzg-bench clippy checks with make lint-kzg and lint-kzg-bench
- Replaced format checks with make format-check
- Replaced backend clippy/format with make lint-BACKEND
- Replaced wasm32 builds with make build-wasm-BACKEND
- Replaced test runs with make test-BACKEND, test-parallel-BACKEND
- Replaced c-kzg-4844 tests with make test-c-kzg-BACKEND, test-c-kzg-parallel-BACKEND

backend-benchmarks.yml:
- Replaced benchmark runs with make bench-BACKEND, bench-parallel-BACKEND
- Replaced c-kzg-4844 benchmarks with make bench-c-kzg-BACKEND, bench-c-kzg-parallel-BACKEND

Benefits:
- Much cleaner and more maintainable workflows
- Consistent with local development (developers can run same commands locally)
- Reduced duplication of build commands
- Auto-color detection in CI (colors automatically disabled by CI detection)
Adds targets for building cross-compiled static libraries and release artifacts:

New targets:
- make build-cross-BACKEND-TARGET: Build static libraries for specific backend/target
  (e.g., make build-cross-blst-linux, make build-cross-arkworks4-windows)
- make archive-BACKEND-TARGET: Create a release zip archive for backend/target
- make archive-BACKEND: Create zip archives for all targets (linux, windows)

Supported targets:
- linux: x86_64-unknown-linux-gnu
- windows: x86_64-pc-windows-gnu

Each build creates both parallel and non-parallel variants and organizes them in:
  staging/BACKEND/TARGET/{parallel,non-parallel}/

Archives include LICENSE and patch files from the backend directory.

This enables the release.yml workflow to use: make archive-BACKEND-TARGET
instead of raw cargo rustc commands.
Simplified release-build job from 45+ lines to just 2 key lines:
- Removed individual cargo rustc commands for parallel/non-parallel builds
- Removed manual artifact staging and zip creation
- Uses: make archive-BACKEND-TARGET

Benefits:
- Much cleaner workflow (45% reduction in lines)
- Single source of truth for cross-compilation (Makefile)
- Easier to maintain and update build logic
- Consistent with local development workflow

Note: Removed mcl from matrix since it doesn't support Windows builds
(it was already excluded with exclude clause).
@ArtiomTr ArtiomTr closed this Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants