@@ -246,9 +246,9 @@ corresponding environment variable is set to the empty string, `""`.
246246* ` CARGO_BIN_NAME ` --- The name of the binary that is currently being compiled.
247247 Only set for [ binaries] or binary [ examples] . This name does not include any
248248 file extension, such as ` .exe ` .
249- * ` OUT_DIR ` --- If the package has a build script, this is set to the folder where the build
250- script should place its output. See below for more information.
251- (Only set during compilation.)
249+ * ` OUT_DIR ` --- If the package has a build script, this is set to the folder
250+ where the build script should place its output. See below for more information.
251+ (Only set during compilation.)
252252* ` CARGO_BIN_EXE_<name> ` --- The absolute path to a binary target's executable.
253253 This is only set when building an [ integration test] or benchmark. This may
254254 be used with the [ ` env ` macro] to find the executable to run for testing
@@ -318,24 +318,19 @@ let out_dir = env::var("OUT_DIR").unwrap();
318318
319319* ` CARGO ` --- Path to the ` cargo ` binary performing the build.
320320* ` CARGO_MANIFEST_DIR ` --- The directory containing the manifest for the package
321- being built (the package containing the build
322- script). Also note that this is the value of the
323- current working directory of the build script when it
324- starts.
321+ being built (the package containing the build script). Also note that this is
322+ the value of the current working directory of the build script when it starts.
325323* ` CARGO_MANIFEST_LINKS ` --- the manifest ` links ` value.
326324* ` CARGO_MAKEFLAGS ` --- Contains parameters needed for Cargo's [ jobserver]
327- implementation to parallelize subprocesses.
328- Rustc or cargo invocations from build.rs can already
329- read ` CARGO_MAKEFLAGS ` , but GNU Make requires the
330- flags to be specified either directly as arguments,
331- or through the ` MAKEFLAGS ` environment variable.
332- Currently Cargo doesn't set the ` MAKEFLAGS ` variable,
333- but it's free for build scripts invoking GNU Make
334- to set it to the contents of ` CARGO_MAKEFLAGS ` .
335- * ` CARGO_FEATURE_<name> ` --- For each activated feature of the package being
336- built, this environment variable will be present
337- where ` <name> ` is the name of the feature uppercased
338- and having ` - ` translated to ` _ ` .
325+ implementation to parallelize subprocesses. Rustc or cargo invocations from
326+ build.rs can already read ` CARGO_MAKEFLAGS ` , but GNU Make requires the flags
327+ to be specified either directly as arguments, or through the ` MAKEFLAGS `
328+ environment variable. Currently Cargo doesn't set the ` MAKEFLAGS ` variable,
329+ but it's free for build scripts invoking GNU Make to set it to the contents
330+ of ` CARGO_MAKEFLAGS ` .
331+ * ` CARGO_FEATURE_<name> ` --- For each activated feature of the package being built,
332+ this environment variable will be present where ` <name> ` is the name of the
333+ feature uppercased and having ` - ` translated to ` _ ` .
339334* ` CARGO_CFG_<cfg> ` --- For each [ configuration option] [ configuration ] of the
340335 package being built, this environment variable will contain the value of the
341336 configuration, where ` <cfg> ` is the name of the configuration uppercased and
@@ -358,42 +353,35 @@ let out_dir = env::var("OUT_DIR").unwrap();
358353 > Note that different [ target triples] [ Target Triple ] have different sets of ` cfg ` values,
359354 > hence variables present in one target triple might not be available in the other.
360355* ` OUT_DIR ` --- the folder in which all output and intermediate artifacts should
361- be placed. This folder is inside the build directory for the
362- package being built, and it is unique for the package in question.
356+ be placed. This folder is inside the build directory for the package being built,
357+ and it is unique for the package in question.
363358* ` TARGET ` --- the target triple that is being compiled for. Native code should be
364- compiled for this triple. See the [ Target Triple] description
365- for more information.
359+ compiled for this triple. See the [ Target Triple] description for more information.
366360* ` HOST ` --- the host triple of the Rust compiler.
367361* ` NUM_JOBS ` --- the parallelism specified as the top-level parallelism. This can
368- be useful to pass a ` -j ` parameter to a system like ` make ` . Note
369- that care should be taken when interpreting this environment
370- variable. For historical purposes this is still provided but
371- recent versions of Cargo, for example, do not need to run `make
372- -j` , and instead can set the ` MAKEFLAGS` env var to the content
373- of ` CARGO_MAKEFLAGS ` to activate the use of Cargo's GNU Make
374- compatible [ jobserver] for sub-make invocations.
375- * ` OPT_LEVEL ` , ` DEBUG ` --- values of the corresponding variables for the
376- profile currently being built.
362+ be useful to pass a ` -j ` parameter to a system like ` make ` . Note that care
363+ should be taken when interpreting this environment variable. For historical
364+ purposes this is still provided but recent versions of Cargo, for example, do
365+ not need to run ` make -j ` , and instead can set the ` MAKEFLAGS ` env var to the
366+ content of ` CARGO_MAKEFLAGS ` to activate the use of Cargo's GNU Make compatible
367+ [ jobserver] for sub-make invocations.
368+ * ` OPT_LEVEL ` , ` DEBUG ` --- values of the corresponding variables for the profile currently being built.
377369* ` PROFILE ` --- ` release ` for release builds, ` debug ` for other builds. This is
378370 determined based on if the [ profile] inherits from the [ ` dev ` ] or
379371 [ ` release ` ] profile. Using this environment variable is not recommended.
380372 Using other environment variables like ` OPT_LEVEL ` provide a more correct
381373 view of the actual settings being used.
382- * ` DEP_<name>_<key> ` --- For more information about this set of environment
383- variables, see build script documentation about [ ` links ` ] [ links ] .
374+ * ` DEP_<name>_<key> ` --- For more information about this set of environment variables,
375+ see build script documentation about [ ` links ` ] [ links ] .
384376* ` RUSTC ` , ` RUSTDOC ` --- the compiler and documentation generator that Cargo has
385- resolved to use, passed to the build script so it might
386- use it as well.
387- * ` RUSTC_WRAPPER ` --- the ` rustc ` wrapper, if any, that Cargo is using.
388- See [ ` build.rustc-wrapper ` ] .
389- * ` RUSTC_WORKSPACE_WRAPPER ` --- the ` rustc ` wrapper, if any, that Cargo is
390- using for workspace members. See
391- [`build.rustc-workspace-wrapper`].
377+ resolved to use, passed to the build script so it might use it as well.
378+ * ` RUSTC_WRAPPER ` --- the ` rustc ` wrapper, if any, that Cargo is using. See [ ` build.rustc-wrapper ` ] .
379+ * ` RUSTC_WORKSPACE_WRAPPER ` --- the ` rustc ` wrapper, if any, that Cargo is using
380+ for workspace members. See [ ` build.rustc-workspace-wrapper ` ] .
392381* ` RUSTC_LINKER ` --- The path to the linker binary that Cargo has resolved to use
393- for the current target, if specified. The linker can be
394- changed by editing ` .cargo/config.toml ` ; see the documentation
395- about [ cargo configuration] [ cargo-config ] for more
396- information.
382+ for the current target, if specified. The linker can be changed by editing
383+ ` .cargo/config.toml ` ; see the documentation about [ cargo configuration] [ cargo-config ]
384+ for more information.
397385* ` CARGO_ENCODED_RUSTFLAGS ` --- extra flags that Cargo invokes ` rustc ` with,
398386 separated by a ` 0x1f ` character (ASCII Unit Separator). See
399387 [ ` build.rustflags ` ] . Note that since Rust 1.55, ` RUSTFLAGS ` is removed from
@@ -428,5 +416,8 @@ Cargo exposes this environment variable to 3rd party subcommands
428416(ie. programs named ` cargo-foobar ` placed in ` $PATH ` ):
429417
430418* ` CARGO ` --- Path to the ` cargo ` binary performing the build.
419+ * ` CARGO_MAKEFLAGS ` --- Contains parameters needed for Cargo's [ jobserver]
420+ implementation to parallelize subprocesses.
421+ This is set only when Cargo detects the existence of a jobserver.
431422
432423For extended information about your environment you may run ` cargo metadata ` .
0 commit comments