@@ -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,11 @@ 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
132+ export top_builddir
130133
131134RUST_BUILD_DIR =$(top_builddir ) /src/rust
132135RUST_BIN_DIR =$(RUST_BUILD_DIR ) /bin
@@ -233,11 +236,12 @@ rust/RustBridge.cpp: rust/src/bridge.rs $(SRC_RUST_FILES) Makefile $(RUST_CXXBRI
233236
234237$(RUST_DEP_TREE_STAMP ) : $(wildcard rust/soroban/* /Cargo.* ) Makefile $(RUST_TOOLCHAIN_FILE )
235238 rm -f $@
239+ mkdir -p $(RUST_BUILD_DIR ) /src/dep-trees
236240 for proto in $( ALL_SOROBAN_PROTOCOLS) ; \
237241 do \
238- $(CARGO ) tree --manifest-path rust/soroban/$$ {proto}/Cargo.toml --locked --package soroban-env-host --edges no-dev --target all \
242+ $(CARGO ) tree --manifest-path $( top_srcdir ) /src/ rust/soroban/$$ {proto}/Cargo.toml --locked --package soroban-env-host --edges no-dev --target all \
239243 | 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; \
244+ if ! diff -u $( top_srcdir ) /src/ rust/src/dep-trees/$$ {proto}-expect.txt $( RUST_BUILD_DIR) /src/dep-trees/$$ {proto}-actual.txt; \
241245 then \
242246 echo " dep trees differ, please update $$ {proto}-expect.txt or roll back submodule" ; \
243247 exit 1; \
@@ -346,9 +350,11 @@ $(SOROBAN_LIBS_STAMP): $(wildcard rust/soroban/p*/Cargo.lock) Makefile $(RUST_DE
346350 FEATURE_FLAGS=" $( CARGO_FEATURE_TRACY) " \
347351 ;; \
348352 esac ; \
349- cd $(abspath $(RUST_BUILD_DIR ) ) /soroban/$$ proto && \
353+ mkdir -p $(SOROBAN_BUILD_DIR ) /$$ proto/target && \
354+ cd $(abspath $(top_srcdir ) ) /src/rust/soroban/$$ proto && \
350355 CC=" $( CC) " CXX=" $( CXX) " LD=" $( LD) " CFLAGS=" $( CFLAGS) " CXXFLAGS=" $( CXXFLAGS) " CXXSTDLIB=" $( CXXSTDLIB) " LDFLAGS=" $( LDFLAGS) " \
351356 RUSTFLAGS=" -Cmetadata=$$ proto" \
357+ CARGO_TARGET_DIR=$(SOROBAN_BUILD_DIR ) /$$ proto/target \
352358 CARGO_NET_GIT_FETCH_WITH_CLI=true \
353359 $(CARGO ) build \
354360 --package soroban-env-host \
0 commit comments