Skip to content

Commit

Permalink
makefiles/rust: Silence checks in QUIET=0 mode
Browse files Browse the repository at this point in the history
The checks would print their prominently colored warnings and confuse
users, and the comments are more geared to those editing the Makefiles
than to those watching which commands get executed.
  • Loading branch information
chrysn committed Jan 31, 2024
1 parent 1cc2930 commit 740f7c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion makefiles/cargo-settings.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ CARGO_LIB = $(CARGO_TARGET_DIR)/$(RUST_TARGET)/$(patsubst test,debug,$(patsubst
# Most of these are populated by RIOT modules that are backed by Rust. Popular
# options added by the user are `-Zbuild-std=core` (only available on nightly)
# to apply LTO and profile configuration to the core library.
CARGO_OPTIONS ?=
CARGO_OPTIONS ?=
16 changes: 8 additions & 8 deletions makefiles/cargo-targets.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ $(CARGO_COMPILE_COMMANDS): $(BUILDDEPS)


$(CARGO_LIB): $(RIOTBUILD_CONFIG_HEADER_C) $(BUILDDEPS) $(CARGO_COMPILE_COMMANDS) FORCE
$(Q)command -v cargo >/dev/null || ($(COLOR_ECHO) \
@command -v cargo >/dev/null || ($(COLOR_ECHO) \
'$(COLOR_RED)Error: `cargo` command missing to build Rust modules.$(COLOR_RESET) Please install as described on <https://doc.riot-os.org/using-rust.html>.' ;\
exit 1)
$(Q)command -v $${C2RUST:-c2rust} >/dev/null || ($(COLOR_ECHO) \
@command -v $${C2RUST:-c2rust} >/dev/null || ($(COLOR_ECHO) \
'$(COLOR_RED)Error: `'$${C2RUST:-c2rust}'` command missing to build Rust modules.$(COLOR_RESET) Please install as described on <https://doc.riot-os.org/using-rust.html>.' ;\
exit 1)
$(Q)command -v rustup >/dev/null || ($(COLOR_ECHO) \
@command -v rustup >/dev/null || ($(COLOR_ECHO) \
'$(COLOR_RED)Error: `rustup` command missing.$(COLOR_RESET) While it is not essential for building Rust modules, it is the only known way to install the target core libraries (or nightly for -Zbuild-std) needed to do so. If you do think that building should be possible, please edit this file, and file an issue about building Rust modules with the installation method you are using -- later checks in this file, based on rustup, will need to be adjusted for that.' ;\
exit 1)
$(Q)[ x"${RUST_TARGET}" != x"" ] || ($(COLOR_ECHO) "$(COLOR_RED)Error: No RUST_TARGET was set for this platform.$(COLOR_RESET) Set FEATURES_REQUIRED+=rust_target to catch this earlier."; exit 1)
$(Q)# If distribution installed cargos ever grow the capacity to build RIOT, this absence of `rustup` might be OK. But that'd need them to both have cross tools around and cross core libs, none of which is currently the case.
$(Q)# Ad grepping for "std": We're not *actually* checking for std but more for core -- but rust-stc-$TARGET is the name of any standard libraries that'd be available for that target.
$(Q)[ x"$(findstring build-std,$(CARGO_OPTIONS))" != x"" ] || \
@[ x"${RUST_TARGET}" != x"" ] || ($(COLOR_ECHO) "$(COLOR_RED)Error: No RUST_TARGET was set for this platform.$(COLOR_RESET) Set FEATURES_REQUIRED+=rust_target to catch this earlier."; exit 1)
@# If distribution installed cargos ever grow the capacity to build RIOT, this absence of `rustup` might be OK. But that'd need them to both have cross tools around and cross core libs, none of which is currently the case.
@# Ad grepping for "std": We're not *actually* checking for std but more for core -- but rust-stc-$TARGET is the name of any standard libraries that'd be available for that target.
@[ x"$(findstring build-std,$(CARGO_OPTIONS))" != x"" ] || \
(rustup component list --installed | grep 'rust-std-$(RUST_TARGET)$$' -q) || \
($(COLOR_ECHO) \
'$(COLOR_RED)Error: No Rust libraries are installed for the board'"'"'s CPU.$(COLOR_RESET) Run\n $(COLOR_GREEN)$$$(COLOR_RESET) rustup target add $(RUST_TARGET)\nor set `CARGO_OPTIONS=-Zbuild-std=core`.'; \
exit 1)
$(Q)# finally call out to cargo. mind the "+" to pass down make's jobserver.
@# finally call out to cargo. mind the "+" to pass down make's jobserver.
$(Q)+ CC= CFLAGS= CPPFLAGS= CXXFLAGS= \
RIOT_COMPILE_COMMANDS_JSON="$(CARGO_COMPILE_COMMANDS)" \
RIOT_USEMODULE="$(USEMODULE)" \
Expand Down

0 comments on commit 740f7c7

Please sign in to comment.