aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@baylibre.com>2024-02-28 23:26:39 +0100
committerThomas Schwinge <thomas@codesourcery.com>2024-04-16 07:46:13 +0000
commit8dde956e18426b2204e660d3e7ff68bb8589a635 (patch)
treeb0d085d63ab5486fe6886e05edbd860d4e78ba5c
parent34a70f48756cb294da342245f5d2b0d622fa298c (diff)
downloadgcc-8dde956e18426b2204e660d3e7ff68bb8589a635.zip
gcc-8dde956e18426b2204e660d3e7ff68bb8589a635.tar.gz
gcc-8dde956e18426b2204e660d3e7ff68bb8589a635.tar.bz2
Rust: Move 'libformat_parser' build into the GCC build directory
Fixes #2883. * .gitignore: Remove 'libgrust/*/target/'. gcc/rust/ * Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build directory. * ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
-rw-r--r--.gitignore1
-rw-r--r--gcc/rust/Make-lang.in11
2 files changed, 9 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 1b2ecab..d0e0fd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,4 +77,3 @@ test.code-workspace
gcc/rust/test3-tiny/*
.clang-format.swap
-libgrust/*/target/
diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in
index fbd43c9..0c664b5 100644
--- a/gcc/rust/Make-lang.in
+++ b/gcc/rust/Make-lang.in
@@ -226,7 +226,8 @@ RUST_ALL_OBJS = $(GRS_OBJS) $(RUST_TARGET_OBJS)
rust_OBJS = $(RUST_ALL_OBJS) rust/rustspec.o
LIBPROC_MACRO_INTERNAL = ../libgrust/libproc_macro_internal/libproc_macro_internal.a
-LIBFORMAT_PARSER = $(srcdir)/../libgrust/libformat_parser/target/debug/liblibformat_parser.a
+LIBFORMAT_PARSER_D = rust/libformat_parser
+LIBFORMAT_PARSER = $(LIBFORMAT_PARSER_D)/debug/liblibformat_parser.a
# The compiler itself is called crab1
crab1$(exeext): $(RUST_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(LIBPROC_MACRO_INTERNAL) $(LIBFORMAT_PARSER) $(rust.prev)
@@ -423,7 +424,13 @@ rust/%.o: rust/lex/%.cc
# TODO: Improve `cargo` invocation with host specific flags, possibly creating a $(CARGO) variable?
$(LIBFORMAT_PARSER): $(srcdir)/../libgrust/libformat_parser/Cargo.toml $(wildcard $(srcdir)/../libgrust/libformat_parser/src/*.rs)
- cd $(srcdir)/../libgrust/libformat_parser && cargo build --offline # FIXME: Not always release, right?
+ cargo \
+ --config $(srcdir)/../libgrust/libformat_parser/.cargo/config \
+ build \
+ --offline \
+ --target-dir $(LIBFORMAT_PARSER_D) \
+ --manifest-path $(srcdir)/../libgrust/libformat_parser/Cargo.toml \
+ # FIXME: Not always '--release', right?
# build all rust/parse files in rust folder, add cross-folder includes
rust/%.o: rust/parse/%.cc