@@ -65,11 +65,11 @@ endif # !BUILD_TESTS
6565if ENABLE_NEXT_PROTOCOL_VERSION_UNSAFE_FOR_PRODUCTION
6666CARGO_FEATURE_NEXT = --features next
6767main/XDRFilesSha256.cpp : $(SRC_X_FILES ) Makefile $(top_srcdir ) /hash-xdrs.sh
68- $(top_srcdir ) /hash-xdrs.sh protocol-next > $@
68+ $(top_srcdir ) /hash-xdrs.sh $( top_srcdir ) /src/ protocol-next > $@
6969else
7070CARGO_FEATURE_NEXT =
7171main/XDRFilesSha256.cpp : $(SRC_X_FILES ) Makefile $(top_srcdir ) /hash-xdrs.sh
72- $(top_srcdir ) /hash-xdrs.sh protocol-curr > $@
72+ $(top_srcdir ) /hash-xdrs.sh $( top_srcdir ) /src/ protocol-curr > $@
7373endif
7474
7575stellar_core_LDADD = $(soci_LIBS ) $(libmedida_LIBS ) \
@@ -89,6 +89,7 @@ BUILT_SOURCES = $(SRC_X_FILES:.x=.h) main/StellarCoreVersion.cpp main/XDRFilesSh
8989$(SRC_X_FILES:.x =.h): $(XDRC )
9090SUFFIXES = .x .h .rs
9191.x.h :
92+ mkdir -p $(@D )
9293 $(XDRC ) -hh -pedantic -o $@ $<
9394
9495BISON =bison
@@ -124,9 +125,10 @@ RUST_TOOLCHAIN_CHANNEL=$(shell sed -n 's/channel *= *"\([^"]*\)"/\1/p' $(RUST_TO
124125endif
125126CARGO =cargo +$(RUST_TOOLCHAIN_CHANNEL )
126127
127- # we pass RUST_TOOLCHAIN_CHANNEL by environment variable
128+ # we pass some configuration by environment variable
128129# to tests since they can't take command-line arguments.
129130export RUST_TOOLCHAIN_CHANNEL
131+ export top_srcdir
130132
131133RUST_BUILD_DIR =$(top_builddir ) /src/rust
132134RUST_BIN_DIR =$(RUST_BUILD_DIR ) /bin
@@ -233,11 +235,12 @@ rust/RustBridge.cpp: rust/src/bridge.rs $(SRC_RUST_FILES) Makefile $(RUST_CXXBRI
233235
234236$(RUST_DEP_TREE_STAMP ) : $(wildcard rust/soroban/* /Cargo.* ) Makefile $(RUST_TOOLCHAIN_FILE )
235237 rm -f $@
238+ mkdir -p $(RUST_BUILD_DIR ) /src/dep-trees
236239 for proto in $( ALL_SOROBAN_PROTOCOLS) ; \
237240 do \
238- $(CARGO ) tree --manifest-path rust/soroban/$$ {proto}/Cargo.toml --locked --package soroban-env-host --edges no-dev --target all \
241+ $(CARGO ) tree --manifest-path $( top_srcdir ) /src/ rust/soroban/$$ {proto}/Cargo.toml --locked --package soroban-env-host --edges no-dev --target all \
239242 | sed -e " s@$( abspath $( top_srcdir) ) /@@g" > $(RUST_BUILD_DIR ) /src/dep-trees/$$ {proto}-actual.txt ; \
240- if ! diff -u rust/src/dep-trees/$$ {proto}-expect.txt $( RUST_BUILD_DIR) /src/dep-trees/$$ {proto}-actual.txt; \
243+ if ! diff -u $( top_srcdir ) /src/ rust/src/dep-trees/$$ {proto}-expect.txt $( RUST_BUILD_DIR) /src/dep-trees/$$ {proto}-actual.txt; \
241244 then \
242245 echo " dep trees differ, please update $$ {proto}-expect.txt or roll back submodule" ; \
243246 exit 1; \
@@ -346,9 +349,11 @@ $(SOROBAN_LIBS_STAMP): $(wildcard rust/soroban/p*/Cargo.lock) Makefile $(RUST_DE
346349 FEATURE_FLAGS=" $( CARGO_FEATURE_TRACY) " \
347350 ;; \
348351 esac ; \
349- cd $(abspath $(RUST_BUILD_DIR ) ) /soroban/$$ proto && \
352+ mkdir -p $(SOROBAN_BUILD_DIR ) /$$ proto/target && \
353+ cd $(abspath $(top_srcdir ) ) /src/rust/soroban/$$ proto && \
350354 CC=" $( CC) " CXX=" $( CXX) " LD=" $( LD) " CFLAGS=" $( CFLAGS) " CXXFLAGS=" $( CXXFLAGS) " CXXSTDLIB=" $( CXXSTDLIB) " LDFLAGS=" $( LDFLAGS) " \
351355 RUSTFLAGS=" -Cmetadata=$$ proto" \
356+ CARGO_TARGET_DIR=$(SOROBAN_BUILD_DIR ) /$$ proto/target \
352357 CARGO_NET_GIT_FETCH_WITH_CLI=true \
353358 $(CARGO ) build \
354359 --package soroban-env-host \
0 commit comments