File tree 3 files changed +38
-0
lines changed
src/doc/rustc/src/targets
3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Built-in Targets
2
+
3
+ ` rustc ` ships with the ability to compile to many targets automatically, we
4
+ call these "built-in" targets, and they generally correspond to targets that
5
+ the team is supporting directly.
6
+
7
+ To see the list of built-in targets, you can run ` rustc --print target-list ` ,
8
+ or look at [ the API
9
+ docs] ( https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/#modules ) .
10
+ Each module there defines a builder for a particular target.
Original file line number Diff line number Diff line change 1
1
# Custom Targets
2
+
3
+ If you'd like to build for a target that is not yet supported by ` rustc ` , you can use a
4
+ "custom target specification" to define a target. These target specification files
5
+ are JSON. To see the JSON for the host target, you can run:
6
+
7
+ ``` bash
8
+ $ rustc +nightly -Z unstable-options --print target-spec-json
9
+ ```
10
+
11
+ To see it for a different target, add the ` --target ` flag:
12
+
13
+ ``` bash
14
+ $ rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json
15
+ ```
16
+
17
+ To use a custom target, see [ ` xargo ` ] ( https://github.com/japaric/xargo ) .
Original file line number Diff line number Diff line change 1
1
# Targets
2
+
3
+ ` rustc ` is a cross-compiler by default. This means that you can use any compiler to build for any
4
+ architecture. The list of * targets* are the possible architectures that you can build for.
5
+
6
+ You can see the API docs for a given target
7
+ [ here] ( https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/struct.Target.html ) , all
8
+ of these options can be set on a per-target basis.
9
+
10
+ To compile to a particular target, use the ` --target ` flag:
11
+
12
+ ``` bash
13
+ $ rustc src/main.rs --target=wasm32-unknown-unknown
14
+ ```
You can’t perform that action at this time.
0 commit comments