summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-05-05 19:32:09 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-05-05 19:32:09 +0800
commitba9b4c4da6b9117529370f402e1015bf1730ccb2 (patch)
tree13e01405c875ef18149fdb44e3c0bdd9a3dd38e2
parent8747439377381a932b4100fbcd7e7df23e4441e0 (diff)
downloadmrust-ba9b4c4da6b9117529370f402e1015bf1730ccb2.tar.gz
Docs
-rw-r--r--README.md14
-rw-r--r--docs/target.md50
2 files changed, 64 insertions, 0 deletions
diff --git a/README.md b/README.md
index 439bae83..49677984 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,18 @@ Windows
- Run `vsproject/build_rustc_minicargo.cmd` to attempt to build libstd
+Building non-rustc code
+=======================
+
+To build your own code with mrustc, first you need to build at least libcore (and probably the full standard library).
+This can be done on linux by running `make -f minicargo.mk LIBS`, or on windows with `build_std.cmd`.
+
+Next, run
+- `minicargo -L <path_to_libstd> <crate_path>` to build a cargo project.
+- or, `mrustc -L <path_to_libstd> --out-dir <output_directory> <path_to_main.rs>` to directly invoke mrustc.
+
+For additional options, both programs have a `--help` option.
+
Diagnosing Issues and Reporting Bugs
====================================
@@ -77,6 +89,8 @@ Current Features
- Functional cargo clone (minicargo)
- Includes build script support
- Procedural macros (custom derive)
+- Custom target specifications
+ - See `docs/target.md`
Plans
=====
diff --git a/docs/target.md b/docs/target.md
new file mode 100644
index 00000000..6b5b088d
--- /dev/null
+++ b/docs/target.md
@@ -0,0 +1,50 @@
+
+Target Overrides
+================
+
+Mrustc supports a few targets out of the box (of varying levels of usablity), these are listed in
+`src/trans/target.cpp`. If the built-in targets aren't suitable, a custom target can be specified with the help of a
+custom target toml file.
+
+To specify a target when running `mrustc` (or `minicaro`), pass `--target <triple>` or `--target
+./path/to/target.toml` (the presence of a slash, backwards or forwards, is what determines if the target is treated as
+a custom target file.
+
+
+Custom target format
+--------------------
+
+Recreation of the `arm-linux-gnu` target
+```toml
+[target]
+family = "unix"
+os-name = "linux"
+env-name = "gnu"
+arch = "arm"
+
+[backend.c]
+variant = "gnu"
+target = "arm-linux-gnu"
+```
+
+Recreation of the `i586-windows-gnu` target (with architecture)
+```toml
+[target]
+family = "windows"
+os-name = "windows"
+env-name = "gnu"
+
+[backend.c]
+variant = "gnu"
+target = "mingw32"
+
+[arch]
+name = "x86"
+pointer-bits = 32
+is-big-endian = false
+has-atomic-u8 = true
+has-atomic-u16 = true
+has-atomic-u32 = true
+has-atomic-u64 = false
+has-atomic-ptr = true
+```