Build and Make Variables
This project uses a modular Makefile layout:
Makefile: entrypoint; includes allscripts/makefiles/*.mkfragments.scripts/makefiles/00-vars.mk: shared defaults and derived variables.scripts/makefiles/05-help.mk:make helpand quick usage guidance.scripts/makefiles/10-deps.mk: dependency bootstrap (ffi,blst,supraseal, submodules).scripts/makefiles/20-test.mk: test and coverage targets.scripts/makefiles/30-build.mk: binary build/install/cleanup targets.scripts/makefiles/40-gen.mk: code/doc generation targets.scripts/makefiles/50-docker.mk: docker/devnet targets.scripts/makefiles/60-abi.mk: ABI to Go generation pattern rule.
The refactor preserves behavior but makes execution paths easier to reason about.
How overrides work
You can override variables at invocation time:
make build FFI_USE_OPENCL=1
make gen GOCC=gotip GOCACHE_CLEAN=1
make docker/devnet build_lotus=1 lotus_version=v1.35.0You can also export them from the environment:
Command-line values take precedence over file defaults.
Build target matrix
These targets share the same pipeline and differ only in tags:
make buildBuilds:
curio,sptoolTag behavior: uses
CURIO_TAGSas-is.Default tags:
CURIO_TAGS_BASE(cunative) plus conditional extras.
make calibnetBuilds:
curio,sptool(mainnet-calibration network)Tag behavior: appends
calibnettoCURIO_TAGSthen runsbuild.
make debugBuilds:
curio,sptoolTag behavior: appends
debugtoCURIO_TAGSthen runsbuild.
make 2kBuilds:
curio,sptool(dev-net / 2k)Tag behavior: appends
2ktoCURIO_TAGSthen runsbuild.
make curio-pdp(synonym:make skiff)Builds:
curio(PDP-only daemon from./cmd/skiff; no worker RPC or deal market)Uses
SKIFF_TAGS(CURIO_TAGS+nosupraseal+skiff) and skips filecoin-ffiBUILD_DEPS.Overwrites the
curiobinary produced bymake curio.
Equivalent one-off forms are also available:
make calibnet-curiomake calibnet-sptoolmake calibnet-curio-pdp(synonym:make calibnet-skiff)make cu2kmake 2k-curio-pdp(synonym:make 2k-skiff)
Important default context
On Linux, the default
make buildpath does not add thenosuprasealtag. That meanslib/supraffiLinux implementations (//go:build linux && !nosupraseal) are compiled in.On CUDA-capable Linux hosts, Curio can use the SupraSeal-backed fast TreeR path for snap encode. If prerequisites are not met, Curio falls back to filecoin-ffi TreeR logic at runtime.
See
lib/ffiselect/ffidirect/ffi-direct.go(TreeRFile) for the fast-path + fallback decision.
Even if you do not plan to run SupraSeal batch sealing, keeping default (non-
nosupraseal) builds is still useful for snap encode performance paths.On Linux CUDA builds, filecoin-ffi now defaults
FFI_USE_CUDA_SUPRASEAL=1(FFI-internal feature selection only).
FFI_USE_OPENCL and FFI_USE_CUDA_SUPRASEAL behavior by OS and CUDA availability
FFI_USE_OPENCL controls Curio-side build routing:
filecoin-ffi backend selection inputs (
FFI_USE_CUDA/OpenCL direction),whether linux supraseal dependency build is included,
whether
nosuprasealis auto-added toCURIO_TAGS.
FFI_USE_CUDA_SUPRASEAL controls only filecoin-ffi's internal GPU feature choice:
it does not affect Curio
nosuprasealtagging,it does not affect whether linux
build/.supraseal-installis included.
Defaults and guardrails:
FFI_USE_CUDAis derived as1unlessFFI_USE_OPENCL=1.FFI_USE_CUDA_SUPRASEALdefaults to1only whenUNAME_S=LinuxandFFI_USE_CUDA=1; otherwise default0.effective value is forced to
0wheneverFFI_USE_CUDA=0.
Behavior matrix
OS
nvcc in PATH
FFI_USE_OPENCL value
default FFI_USE_CUDA_SUPRASEAL
Result
Linux
Yes
unset/empty
1
Build succeeds. FFI_USE_CUDA=1, FFI defaults to cuda-supraseal, linux supraseal dep included unless DISABLE_SUPRASEAL=1, tags default to cunative (or cunative nosupraseal when DISABLE_SUPRASEAL=1).
Linux
No
unset/empty
1
Build fails early in curio-libfilecoin with CUDA-required error.
Linux
Yes/No
1
0
Build succeeds. FFI_USE_CUDA=0, effective FFI_USE_CUDA_SUPRASEAL=0, direct filecoin-ffi OpenCL install path (prebuilt eligible), supraseal dep skipped, nosupraseal auto-added to tags, build.IsOpencl=1.
Linux
Yes
0
1
Build succeeds. FFI_USE_CUDA=1 (unambiguous CUDA), FFI defaults to cuda-supraseal, supraseal dep included unless DISABLE_SUPRASEAL=1.
Linux
No
0
1
Build fails (same CUDA-required guard as default).
macOS
Yes/No
unset/empty
0
Build succeeds. Darwin filecoin-ffi install path is used, linux supraseal dep block not applicable, tags default to cunative (or cunative nosupraseal when DISABLE_SUPRASEAL=1).
macOS
Yes/No
1
0
Build succeeds. Mainly affects Curio tags/ldflags (nosupraseal, build.IsOpencl=1). Darwin path does not have Linux CUDA guard.
Notes:
On macOS, presence/absence of CUDA libraries does not drive Curio's Makefile decision flow.
In filecoin-ffi source builds, Darwin already chooses OpenCL feature path by default.
If either
FFI_USE_OPENCL=1orDISABLE_SUPRASEAL=1, linuxbuild/.supraseal-installis not added.FFI_USE_CUDA_SUPRASEALcan be overridden (for exampleFFI_USE_CUDA_SUPRASEAL=0) without changing Curio tags/dependency gating.
Detailed make build scenarios
This section answers "what exactly is in the binary and what path was taken?" for common cases.
Quick outcome table
Scenario
Example command
CURIO_TAGS used by curio/sptool
FFI dependency path
FFI GPU feature
build/.supraseal-install step
build.IsOpencl ldflag in curio
Linux default (CUDA path)
make build
cunative
Linux curio-libfilecoin path, FFI_USE_CUDA=1
cuda-supraseal (default)
Yes
empty string
macOS default
make build
cunative
Darwin direct make -C extern/filecoin-ffi .install-filcrypto
Darwin OpenCL-style default in filecoin-ffi
No (linux-only dep block)
empty string
Linux OpenCL path
make build FFI_USE_OPENCL=1
cunative nosupraseal
Linux direct make -C extern/filecoin-ffi .install-filcrypto
opencl
No
1
Linux CUDA but disable supraseal in Curio binary
make build FFI_USE_OPENCL=0 DISABLE_SUPRASEAL=1
cunative nosupraseal
Linux curio-libfilecoin path, FFI_USE_CUDA=1
cuda-supraseal (default unless overridden)
No
0
1. Linux + make build (default CUDA-style path)
Command:
Resulting behavior:
buildinvokescurioandsptool.BUILD_DEPSincludes:setup-cgo-envbuild/.filecoin-installffi-version-checkbuild/.blst-installbuild/.supraseal-install(because linux andFFI_USE_OPENCL != 1)
build/.filecoin-installusescurio-libfilecoin(linux path), which:requires
nvccon this CUDA pathpasses
FFI_USE_CUDA=1whenFFI_USE_OPENCLis unset/emptydefaults
FFI_USE_CUDA_SUPRASEAL=1on Linux CUDA path
tags default to
CURIO_TAGS="cunative"(nonosupraseal)curiocompile specifics:GOAMD64=v3is set in the build commandCGO_LDFLAGS_ALLOW='.*'is set on Linux forcurio-X github.com/filecoin-project/curio/build.IsOpencl=(empty)
sptoolbuilds with the same tag set (cunative)sptooluses the defaultCGO_LDFLAGS_ALLOWpattern (not Linuxcuriooverride)
2. macOS + make build
Command:
Resulting behavior:
BUILD_DEPSstill runs setup/version/blst checks.build/.filecoin-installuses Darwin-specific path:make -C extern/filecoin-ffi .install-filcryptoit does not use
curio-libfilecoinruntimenvccgate.
linux-only supraseal dependency block is not added.
build/.blst-installstill runs (bash scripts/build-blst.sh) because BLST is always inBUILD_DEPS.tags are still
CURIO_TAGS="cunative"by default.curioldflagbuild.IsOpenclremains empty unless you setFFI_USE_OPENCL.even without
nosuprasealtag, non-linux builds compile non-linux supraffi stubs by file-level build constraints (!linux).
3. Linux + OpenCL GPU path
Command:
Resulting behavior:
FFI_USE_OPENCL=1changes both deps and tags:linux supraseal dependency block is skipped
CURIO_TAGS_EXTRAaddsnosuprasealfinal tags become
CURIO_TAGS="cunative nosupraseal"
build/.filecoin-installuses direct filecoin-ffi install path on Linux OpenCL:make -C extern/filecoin-ffi .install-filcryptoprebuilt libfilcrypto is eligible (unless
FFI_BUILD_FROM_SOURCE=1is set externally)
curioldflag embedsbuild.IsOpencl=1.
4. Linux + CUDA, but you do not want supraseal in the Curio binary
If your goal is "CUDA filecoin-ffi path, but compile binary without supraseal code", use:
What this does:
FFI_USE_OPENCL=0keeps CUDA mode explicit (FFI_USE_CUDA=1).DISABLE_SUPRASEAL=1addsnosupraseal, so supraffi linux implementations are excluded at compile time.linux supraseal dependency build step is skipped.
FFI still defaults to
FFI_USE_CUDA_SUPRASEAL=1unless you override it.
What nosupraseal means
nosupraseal is a Go build tag that selects non-supraseal code paths in lib/supraffi.
Relevant files:
supraseal-enabled linux files:
lib/supraffi/seal.golib/supraffi/cuda_linux.golib/supraffi/seal_nvme.golib/supraffi/spdk_setup.go
fallback/stub files selected by
!linux || nosupraseal:lib/supraffi/seal_nonlinux.golib/supraffi/cuda_nonlinux.go
Practical effect:
with
nosupraseal, linux supraseal integration code is not linked into the binary.calls into supraffi functionality will use stub behavior (errors/panics for unavailable operations).
on non-linux, those stub files are selected even without explicitly adding
nosupraseal.
Common make build use cases
Linux host without CUDA toolkit:
Build calibnet binary set with OpenCL path:
Build debug variant with explicit Go flags:
Linux CUDA path, but disable filecoin-ffi
cuda-suprasealfeature only:
Build with fully explicit tags (overrides computed tag composition):
Build host-optimized native curio at a fixed ISA level:
Variables you are expected to override
Build and toolchain
GOCC(default:go)Purpose: Go command used for
build/run/generate.Override when: testing with a non-default Go binary (
gotip, custom wrapper).Example:
make build GOCC=/usr/local/go/bin/go
GOFLAGS(default: empty)Purpose: standard Go flags propagated into
go build/go run/go generate.Override when: changing module behavior, enabling race, changing trimpath, etc.
Example:
make build GOFLAGS='-mod=mod -trimpath'
FFI_USE_OPENCL(default: unset)Purpose: controls GPU backend assumptions for FFI-related dependency builds.
Expected values:
unset/empty or any value other than
1: CUDA path (FFI_USE_CUDA=1).1: OpenCL path (FFI_USE_CUDA=0).
Override when:
Linux host has no CUDA toolkit (
nvcc) and you want OpenCL.Running
make genis already forced toFFI_USE_OPENCL=1by target export.
Examples:
make deps FFI_USE_OPENCL=1make build FFI_USE_OPENCL=0
FFI_USE_CUDA_SUPRASEAL(default: computed)Purpose: controls whether filecoin-ffi uses
cuda-suprasealin CUDA builds.Default behavior:
Linux with
FFI_USE_CUDA=1: defaults to1.all other cases: defaults to
0.if
FFI_USE_CUDA=0, effective value is forced to0.
Override when: you want CUDA FFI build path but want the non-
cuda-suprasealFFI feature set.Example:
make build FFI_USE_OPENCL=0 FFI_USE_CUDA_SUPRASEAL=0Important: this variable does not affect Curio
nosuprasealtags or linux supraseal dependency gating.
DISABLE_SUPRASEAL(default:0)Purpose: force
nosuprasealtag and skip Linux supraseal dependency build.Expected values:
0: default behavior.1: disable supraseal in Curio build/tag flow.
Override when: Linux host has CUDA and you want CUDA-backed FFI build but a Curio binary compiled without supraseal paths.
Example:
make build FFI_USE_OPENCL=0 DISABLE_SUPRASEAL=1
CGO_LDFLAGS_ALLOW(default: quoted value ofCGO_LDFLAGS_ALLOW_PATTERN)Purpose: linker flag allowlist for cgo.
Override when: integrating custom toolchains requiring different allow patterns.
Usually do not override directly; prefer default.
CURIO_TAGS_BASE(default:cunative)Purpose: baseline build tags for binaries.
Override when: customizing feature profile globally.
Example:
make build CURIO_TAGS_BASE='cunative debug'
CURIO_TAGS(default: computed fromCURIO_TAGS_BASEplus conditional extras)Purpose: final tag string passed to most builds.
Override when: you need exact control and do not want computed defaults.
Example:
make curio CURIO_TAGS='cunative calibnet debug'
GOAMD64_NATIVE(default: auto-detected on linux/amd64 via/proc/cpuinfo)Purpose: ISA level for
curio-nativetarget.Override when: reproducibility across hosts or intentionally targeting older CPUs.
Example:
make curio-native GOAMD64_NATIVE=v2
Generation and caching
GOCACHE_CLEAN(default: unset)Purpose: when set to
1,make gensimplerunsgo clean -cachefirst.Override when: generation repeatedly fails due Go build cache contention/corruption.
Example:
make gen GOCACHE_CLEAN=1
Testing and coverage
COVERAGE_DIR(default:coverage)Purpose: output directory for coverage artifacts.
Override when: CI artifact path conventions differ.
Example:
make cov COVERAGE_DIR=build/coverage
Docker/devnet
build_lotus(default:0)Purpose:
0: use prebuilt lotus image.1: clone/build lotus image locally.
Override when: testing against a custom lotus branch/tag implementation.
lotus_version(default:v1.35.1)Purpose: lotus version for prebuilt image tag or local clone branch/tag.
Override when: validating compatibility with another lotus version.
curio_docker_user(default:curio)Purpose: image name prefix for locally built images.
Override when: publishing/testing in your own registry namespace.
curio_base_image(default:$(curio_docker_user)/curio-all-in-one:latest-debug)Purpose: base image reference passed into docker builds.
Override when: pinning to an alternate base image/tag.
ffi_from_source(default:0)Purpose: docker build arg controlling FFI source build behavior in image builds.
Override when: image tests require source-built FFI.
lotus_base_image(default whenbuild_lotus=0: prebuilt GHCR image)Purpose: lotus image consumed by curio docker build flow.
Override when: testing against a custom already-built lotus image.
docker_args(default: empty)Purpose: appended raw args to docker build commands.
Override when: injecting platform/buildkit/cache args.
Example:
make docker/curio docker_args='--platform linux/amd64 --no-cache'
Variables that are internal/derived (usually do not override)
FFI_PATH,BLST_PATH,SUPRA_FFI_PATHBUILD_DEPS,MODULES,BINS,CLEANUNAME_S,NVCC_PATH,CUDA_PATH,CUDA_LIB_PATHFFI_USE_CUDA,FFI_USE_CUDA_SUPRASEAL_EFFECTIVECURIO_TAGS_EXTRA,CURIO_TAGS_CSVTEST_ENV_VARSCGO_LDFLAGS_ALLOW_PATTERN
If you override internal variables, do so only when actively developing the Makefile itself. If you need these overridden as a regular pattern, consider opening a Github issue or talking with support.
About make test
Current state in this repository:
make testRunsgo test -v -tags="cgo,fvm" -timeout 30m ./itests/.... It can be used to run integration tests locally.
Safe override recipes
Linux without CUDA:
make deps FFI_USE_OPENCL=1make build FFI_USE_OPENCL=1
Build calibnet binaries with explicit tags:
make calibnet CURIO_TAGS='cunative calibnet'
Linux CUDA path but compile Curio without supraseal:
make build FFI_USE_OPENCL=0 DISABLE_SUPRASEAL=1
Linux CUDA path but disable only filecoin-ffi
cuda-supraseal:make build FFI_USE_OPENCL=0 FFI_USE_CUDA_SUPRASEAL=0
Recover from unstable generation cache:
make gen GOCACHE_CLEAN=1
Build docker devnet with locally built lotus:
make docker/devnet build_lotus=1 lotus_version=v1.35.1
Last updated