Skip to content

Commit 58ac23d

Browse files
committed
feat(build-rs): Add cargo_makeflags
1 parent e4e7a36 commit 58ac23d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

crates/build-rs/src/input.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ pub fn cargo_manifest_links() -> Option<String> {
112112
get_opt_str("CARGO_MANIFEST_LINKS")
113113
}
114114

115+
/// Contains parameters needed for Cargo’s [jobserver] implementation to parallelize
116+
/// subprocesses.
117+
///
118+
/// Rustc or cargo invocations from build.rs can already read
119+
/// `CARGO_MAKEFLAGS`, but GNU Make requires the flags to be specified either
120+
/// directly as arguments, or through the `MAKEFLAGS` environment variable.
121+
/// Currently Cargo doesn’t set the `MAKEFLAGS` variable, but it’s free for build
122+
/// scripts invoking GNU Make to set it to the contents of `CARGO_MAKEFLAGS`.
123+
///
124+
/// [jobserver]: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
125+
#[track_caller]
126+
pub fn cargo_makeflags() -> Option<String> {
127+
get_opt_str("CARGO_MAKEFLAGS")
128+
}
129+
115130
/// For each activated feature of the package being built, this will be `true`.
116131
#[track_caller]
117132
pub fn cargo_feature(name: &str) -> bool {

0 commit comments

Comments
 (0)