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>
David Aguilar committed
Aug 26, 2025 at 16:35 UTC
0eeacde50e71cc320016f0bcf9f8b17d5168cbfd
2 files changed
+9
-16
Makefile
+5
-6
@@ -3946,13 +3946,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
3946
$(MAKE) -C t/ unit-tests
3947
3948
.PHONY: libgit-sys libgit-rs
3949
-libgit-sys libgit-rs:
3950
- $(QUIET)(\
3951
- cd contrib/$@ && \
3952
- cargo build \
3953
- )
3949
+libgit-sys:
3950
+ $(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml
3951
+libgit-rs: libgit-sys
3952
+ $(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml
3953
ifdef INCLUDE_LIBGIT_RS
3955
-all:: libgit-sys libgit-rs
3954
+all:: libgit-rs
3955
endif
3956
3957
LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
t/Makefile
+4
-10
@@ -190,15 +190,9 @@ perf:
190
191
.PHONY: libgit-sys-test libgit-rs-test
192
libgit-sys-test:
193
- $(QUIET)(\
194
- cd ../contrib/libgit-sys && \
195
- cargo test \
196
- )
197
-libgit-rs-test:
198
- $(QUIET)(\
199
- cd ../contrib/libgit-rs && \
200
- cargo test \
201
- )
193
+ $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml
194
+libgit-rs-test: libgit-sys-test
195
+ $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml
196
ifdef INCLUDE_LIBGIT_RS
203
-all:: libgit-sys-test libgit-rs-test
197
+all:: libgit-rs-test
198
endif