@@ -10,14 +10,31 @@ FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
1010
1111$(FFI_DEPS ) : build/.filecoin-install ;
1212
13+ # When enabled, build size-optimized libfilcrypto by default
14+ CURIO_OPTIMAL_LIBFILCRYPTO ?= 1
15+
1316build/.filecoin-install : $(FFI_PATH )
14- $(MAKE ) -C $(FFI_PATH ) $(FFI_DEPS:$(FFI_PATH ) %=% )
17+ @if [ " $( CURIO_OPTIMAL_LIBFILCRYPTO) " = " 1" ]; then \
18+ FFI_DISABLE_FVM=1 $(MAKE ) curio-libfilecoin; \
19+ else \
20+ $(MAKE ) -C $(FFI_PATH ) $(FFI_DEPS:$(FFI_PATH ) %=% ) ; \
21+ fi
1522 @touch $@
1623
1724MODULES+ =$(FFI_PATH )
1825BUILD_DEPS+ =build/.filecoin-install
1926CLEAN+ =build/.filecoin-install
2027
28+ # # Custom libfilcrypto build for Curio (size-optimized, no FVM)
29+ .PHONY : curio-libfilecoin
30+ curio-libfilecoin :
31+ FFI_BUILD_FROM_SOURCE=1 \
32+ FFI_USE_GPU=1 \
33+ FFI_USE_MULTICORE_SDR=1 \
34+ RUSTFLAGS=' -C codegen-units=1 -C opt-level=3 -C strip=symbols' \
35+ $(MAKE ) -C $(FFI_PATH ) clean .install-filcrypto
36+ @echo " Rebuilt libfilcrypto for Curio (OpenCL+multicore, no default features)."
37+
2138ffi-version-check :
2239 @[[ " $$ (awk '/const Version/{print $$ 5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo " FFI version mismatch, update submodules" ; exit 1)
2340BUILD_DEPS+ =ffi-version-check
@@ -82,6 +99,17 @@ CLEAN+=build/.update-modules
8299deps : $(BUILD_DEPS )
83100.PHONY : deps
84101
102+ # # Test targets
103+
104+ test-deps : CURIO_OPTIMAL_LIBFILCRYPTO=0
105+ test-deps : $(BUILD_DEPS )
106+ @echo " Built dependencies with FVM support for testing"
107+ .PHONY : test-deps
108+
109+ test : test-deps
110+ go test -v -tags=" cgo,fvm" -timeout 30m ./itests/...
111+ .PHONY : test
112+
85113# # ldflags -s -w strips binary
86114
87115CURIO_TAGS ?= cunative
@@ -273,10 +301,24 @@ marketgen:
273301 swag init -dir market/mk20/http -g http.go -o market/mk20/http --parseDependencyLevel 3 --parseDependency
274302.PHONY : marketgen
275303
276- gensimple : api-gen go-generate cfgdoc-gen docsgen marketgen docsgen-cli
304+ # Run gen steps sequentially in a single shell to avoid Go build cache race conditions.
305+ # The "unlinkat: directory not empty" error occurs when multiple go processes
306+ # contend for the same build cache simultaneously.
307+ # Set GOCACHE_CLEAN=1 to clear the build cache before running (fixes persistent issues).
308+ gensimple :
309+ ifeq ($(GOCACHE_CLEAN ) ,1)
310+ $(GOCC) clean -cache
311+ endif
312+ $(MAKE) deps
313+ $(MAKE) api-gen
314+ $(MAKE) go-generate
315+ $(MAKE) cfgdoc-gen
316+ $(MAKE) docsgen
317+ $(MAKE) marketgen
318+ $(MAKE) docsgen-cli
277319 $(GOCC) run ./scripts/fiximports
278320 go mod tidy
279- .PHONY : gen
321+ .PHONY : gensimple
280322
281323fiximports :
282324 $(GOCC ) run ./scripts/fiximports
0 commit comments