Makefile: build libgit-rs and libgit-sys serially

"make -JN" with INCLUDE_LIBGIT_RS enabled causes cargo lock warnings
and can trigger ld errors during the build.

The build errors are caused by two inner "make" invocations getting
triggered concurrently: once inside of libgit-sys and another inside of
libgit-rs.

Make libgit-rs depend on libgit-sys so that "make" prevents them
from running concurrently. Apply the same logic to the test invocations.
Use cargo's "--manifest-path" option instead of "cd" in the recipes.

Signed-off-by: David Aguilar <davvid@gmail.com>
Acked-by: Kyle Lippincott <spectral@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Aguilar
2025-08-26 16:35:25 -07:00
committed by Junio C Hamano
parent 16bd9f20a4
commit 0eeacde50e
2 changed files with 9 additions and 16 deletions

View File

@@ -3946,13 +3946,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
$(MAKE) -C t/ unit-tests $(MAKE) -C t/ unit-tests
.PHONY: libgit-sys libgit-rs .PHONY: libgit-sys libgit-rs
libgit-sys libgit-rs: libgit-sys:
$(QUIET)(\ $(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml
cd contrib/$@ && \ libgit-rs: libgit-sys
cargo build \ $(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml
)
ifdef INCLUDE_LIBGIT_RS ifdef INCLUDE_LIBGIT_RS
all:: libgit-sys libgit-rs all:: libgit-rs
endif endif
LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o

View File

@@ -190,15 +190,9 @@ perf:
.PHONY: libgit-sys-test libgit-rs-test .PHONY: libgit-sys-test libgit-rs-test
libgit-sys-test: libgit-sys-test:
$(QUIET)(\ $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml
cd ../contrib/libgit-sys && \ libgit-rs-test: libgit-sys-test
cargo test \ $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml
)
libgit-rs-test:
$(QUIET)(\
cd ../contrib/libgit-rs && \
cargo test \
)
ifdef INCLUDE_LIBGIT_RS ifdef INCLUDE_LIBGIT_RS
all:: libgit-sys-test libgit-rs-test all:: libgit-rs-test
endif endif