|
6 | 6 | //! to a new platform, and allows for an unprecedented level of control over how |
7 | 7 | //! the compiler works. |
8 | 8 | //! |
9 | | -//! # Using custom targets |
| 9 | +//! # Using targets and target.json |
10 | 10 | //! |
11 | | -//! A target tuple, as passed via `rustc --target=TUPLE`, will first be |
12 | | -//! compared against the list of built-in targets. This is to ease distributing |
13 | | -//! rustc (no need for configuration files) and also to hold these built-in |
14 | | -//! targets as immutable and sacred. If `TUPLE` is not one of the built-in |
15 | | -//! targets, rustc will check if a file named `TUPLE` exists. If it does, it |
16 | | -//! will be loaded as the target configuration. If the file does not exist, |
17 | | -//! rustc will search each directory in the environment variable |
18 | | -//! `RUST_TARGET_PATH` for a file named `TUPLE.json`. The first one found will |
19 | | -//! be loaded. If no file is found in any of those directories, a fatal error |
20 | | -//! will be given. |
| 11 | +//! Invoking "rustc --target=${TUPLE}" will result in rustc initiating the [`Target::search`] by |
| 12 | +//! - checking if "$TUPLE" is a complete path to a json (ending with ".json") and loading if so |
| 13 | +//! - checking builtin targets for "${TUPLE}" |
| 14 | +//! - checking directories in "${RUST_TARGET_PATH}" for "${TUPLE}.json" |
| 15 | +//! - checking for "${RUSTC_SYSROOT}/lib/rustlib/${TUPLE}/target.json" |
21 | 16 | //! |
22 | | -//! Projects defining their own targets should use |
23 | | -//! `--target=path/to/my-awesome-platform.json` instead of adding to |
24 | | -//! `RUST_TARGET_PATH`. |
| 17 | +//! Code will then be compiled using the first discovered target spec. |
25 | 18 | //! |
26 | 19 | //! # Defining a new target |
27 | 20 | //! |
|
0 commit comments