1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-28 23:49:47 +01:00
RIOT/makefiles/cargo-settings.inc.mk
2022-07-09 21:15:29 +02:00

46 lines
2.1 KiB
Makefile

# Setting anything other than "debug" or "release" will necessitate additional
# -Z unstable-options as of 2021-03 nightlies.
CARGO_PROFILE ?= release
# Value for CARGO_CHANNEL when using nightly
#
# As different environments have different versions of nightly installed, but
# rustup / cargo does not take "the latest installed nightly" for a toolchain,
# a good value is determined dynamically. Typical values this takes are
# `nightly` (on regular installations) and `nightly-2022-03-08` (or whichever
# date it is currently pinned to) in riotbuild.
#
# Workaround-For: https://github.com/rust-lang/rustup/issues/3015
#
# This does not get evaluated unless actually used; if rustup is not installed,
# the default value will likely not be usable but at least set the user on the
# right track.
CARGO_CHANNEL_NIGHTLY = $(shell rustup toolchain list | sed 's/ .*//' |grep nightly | tail -n1 || echo nightly)
# The Rust version to use.
#
# Examples should set this to either `stable` or `$(CARGO_CHANNEL_NIGHTLY)`.
# The default is empty, which is suitable for applications that select their
# version through a `rust-toolchain.yaml` file.
CARGO_CHANNEL ?=
# Note that if we did not set this explicitly, CARGO_LIB would have to
# understand which value cargo uses in absence of CARGO_TARGET_DIR, which would
# be $(APPDIR)/target.
#
# For many cases, it would be beneficial to base this on BINDIRBASE rather than
# BINDIR, for that would allow different boards using the same CPU to share
# compiled code (unless they they build conditionally on environment variables,
# like riot-sys does). This is not done for two reasons:
#
# * Overriding BINDIR (like is done in Murdock) would not take effect,
# requiring additional overrides to enable out-of-tree building.
#
# * Switching back and forth between two boards of the same CPU requires
# riot-sys rebuilds. (On its own, this would be outweighed by the shared
# compilation of other modules).
CARGO_TARGET_DIR = $(BINDIR)/target
# The single Rust library to be built.
CARGO_LIB = $(CARGO_TARGET_DIR)/$(RUST_TARGET)/${CARGO_PROFILE}/lib$(APPLICATION_RUST_MODULE).a