about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml8
-rw-r--r--CONTRIBUTING.md5
-rw-r--r--Makefile.in297
-rw-r--r--appveyor.yml12
-rwxr-xr-xconfigure858
-rw-r--r--mk/cfg/aarch64-apple-ios.mk33
-rw-r--r--mk/cfg/aarch64-linux-android.mk26
-rw-r--r--mk/cfg/aarch64-unknown-fuchsia.mk1
-rw-r--r--mk/cfg/aarch64-unknown-linux-gnu.mk26
-rw-r--r--mk/cfg/arm-linux-androideabi.mk25
-rw-r--r--mk/cfg/arm-unknown-linux-gnueabi.mk26
-rw-r--r--mk/cfg/arm-unknown-linux-gnueabihf.mk26
-rw-r--r--mk/cfg/arm-unknown-linux-musleabi.mk26
-rw-r--r--mk/cfg/arm-unknown-linux-musleabihf.mk3
-rw-r--r--mk/cfg/armv5te-unknown-linux-gnueabi.mk26
-rw-r--r--mk/cfg/armv7-apple-ios.mk30
-rw-r--r--mk/cfg/armv7-linux-androideabi.mk25
-rw-r--r--mk/cfg/armv7-unknown-linux-gnueabihf.mk26
-rw-r--r--mk/cfg/armv7-unknown-linux-musleabihf.mk3
-rw-r--r--mk/cfg/armv7s-apple-ios.mk30
-rw-r--r--mk/cfg/asmjs-unknown-emscripten.mk24
-rw-r--r--mk/cfg/i386-apple-ios.mk30
-rw-r--r--mk/cfg/i586-pc-windows-msvc.mk28
-rw-r--r--mk/cfg/i586-unknown-linux-gnu.mk23
-rw-r--r--mk/cfg/i686-apple-darwin.mk23
-rw-r--r--mk/cfg/i686-linux-android.mk25
-rw-r--r--mk/cfg/i686-pc-windows-gnu.mk27
-rw-r--r--mk/cfg/i686-pc-windows-msvc.mk28
-rw-r--r--mk/cfg/i686-unknown-freebsd.mk22
-rw-r--r--mk/cfg/i686-unknown-haiku.mk27
-rw-r--r--mk/cfg/i686-unknown-linux-gnu.mk23
-rw-r--r--mk/cfg/i686-unknown-linux-musl.mk29
-rw-r--r--mk/cfg/i686-unknown-openbsd.mk24
-rw-r--r--mk/cfg/le32-unknown-nacl.mk40
-rw-r--r--mk/cfg/mips-unknown-linux-gnu.mk24
-rw-r--r--mk/cfg/mips-unknown-linux-musl.mk24
-rw-r--r--mk/cfg/mips-unknown-linux-uclibc.mk1
-rw-r--r--mk/cfg/mips64-unknown-linux-gnuabi64.mk1
-rw-r--r--mk/cfg/mips64el-unknown-linux-gnuabi64.mk1
-rw-r--r--mk/cfg/mipsel-unknown-linux-gnu.mk24
-rw-r--r--mk/cfg/mipsel-unknown-linux-musl.mk24
-rw-r--r--mk/cfg/mipsel-unknown-linux-uclibc.mk1
-rw-r--r--mk/cfg/powerpc-unknown-linux-gnu.mk24
-rw-r--r--mk/cfg/powerpc64-unknown-linux-gnu.mk25
-rw-r--r--mk/cfg/powerpc64le-unknown-linux-gnu.mk24
-rw-r--r--mk/cfg/s390x-unknown-linux-gnu.mk24
-rw-r--r--mk/cfg/sparc64-unknown-linux-gnu.mk1
-rw-r--r--mk/cfg/sparc64-unknown-netbsd.mk3
-rw-r--r--mk/cfg/wasm32-unknown-emscripten.mk24
-rw-r--r--mk/cfg/x86_64-apple-darwin.mk23
-rw-r--r--mk/cfg/x86_64-apple-ios.mk32
-rw-r--r--mk/cfg/x86_64-pc-windows-gnu.mk27
-rw-r--r--mk/cfg/x86_64-pc-windows-msvc.mk28
-rw-r--r--mk/cfg/x86_64-rumprun-netbsd.mk25
-rw-r--r--mk/cfg/x86_64-sun-solaris.mk23
-rw-r--r--mk/cfg/x86_64-unknown-bitrig.mk23
-rw-r--r--mk/cfg/x86_64-unknown-dragonfly.mk22
-rw-r--r--mk/cfg/x86_64-unknown-freebsd.mk22
-rw-r--r--mk/cfg/x86_64-unknown-fuchsia.mk1
-rw-r--r--mk/cfg/x86_64-unknown-haiku.mk27
-rw-r--r--mk/cfg/x86_64-unknown-linux-gnu.mk23
-rw-r--r--mk/cfg/x86_64-unknown-linux-musl.mk29
-rw-r--r--mk/cfg/x86_64-unknown-netbsd.mk23
-rw-r--r--mk/cfg/x86_64-unknown-openbsd.mk24
-rw-r--r--mk/cfg/x86_64-unknown-redox.mk1
-rw-r--r--mk/clean.mk122
-rw-r--r--mk/crates.mk228
-rw-r--r--mk/ctags.mk35
-rw-r--r--mk/debuggers.mk145
-rw-r--r--mk/dist.mk382
-rw-r--r--mk/docs.mk222
-rw-r--r--mk/grammar.mk117
-rw-r--r--mk/host.mk84
-rw-r--r--mk/install.mk138
-rw-r--r--mk/llvm.mk124
-rw-r--r--mk/main.mk641
-rw-r--r--mk/platform.mk250
-rw-r--r--mk/prepare.mk251
-rw-r--r--mk/reconfig.mk43
-rw-r--r--mk/rt.mk721
-rw-r--r--mk/rustllvm.mk71
-rw-r--r--mk/stage0.mk49
-rw-r--r--mk/target.mk209
-rw-r--r--mk/tests.mk1057
-rw-r--r--mk/util.mk23
-rw-r--r--src/Cargo.lock1
-rw-r--r--src/bootstrap/channel.rs40
-rw-r--r--src/bootstrap/dist.rs2
-rw-r--r--src/bootstrap/mk/Makefile.in3
-rw-r--r--src/ci/docker/x86_64-gnu-make/Dockerfile26
-rw-r--r--src/etc/Dockerfile27
-rw-r--r--src/etc/apple-darwin.supp75
-rw-r--r--src/etc/check-sanitycheck.py58
-rwxr-xr-xsrc/etc/check-summary.py57
-rw-r--r--src/etc/get-stage0.py46
-rwxr-xr-xsrc/etc/local_stage0.sh79
-rw-r--r--src/etc/mklldeps.py113
-rw-r--r--src/etc/x86.supp65
-rw-r--r--src/liballoc_jemalloc/build.rs1
-rw-r--r--src/liballoc_jemalloc/lib.rs16
-rw-r--r--src/libflate/build.rs1
-rw-r--r--src/libflate/lib.rs4
-rw-r--r--src/libpanic_unwind/gcc.rs4
-rw-r--r--src/librustc_llvm/build.rs2
-rw-r--r--src/librustc_llvm/lib.rs10
-rw-r--r--src/librustdoc/build.rs1
-rw-r--r--src/librustdoc/html/markdown.rs5
-rw-r--r--src/libstd/build.rs1
-rw-r--r--src/libstd/lib.rs3
-rw-r--r--src/libstd/panicking.rs6
-rw-r--r--src/libstd/rtdeps.rs68
-rw-r--r--src/libstd/sys/unix/args.rs5
-rw-r--r--src/libstd/sys/unix/mod.rs2
-rw-r--r--src/libstd/sys/unix/rand.rs4
-rw-r--r--src/libstd/sys/windows/c.rs7
-rw-r--r--src/libstd/sys_common/gnu/libbacktrace.rs3
-rw-r--r--src/libstd/sys_common/mod.rs4
-rw-r--r--src/libunwind/build.rs2
-rw-r--r--src/libunwind/libunwind.rs31
-rw-r--r--src/tools/compiletest/Cargo.toml2
-rw-r--r--src/tools/compiletest/build.rs13
-rw-r--r--src/tools/compiletest/src/header.rs6
-rw-r--r--src/tools/compiletest/src/main.rs53
-rw-r--r--src/tools/compiletest/src/runtest.rs2
124 files changed, 75 insertions, 8148 deletions
diff --git a/.travis.yml b/.travis.yml
index f9e80343251..a776f1b1e10 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,7 +33,6 @@ matrix:
     - env: IMAGE=x86_64-gnu-aux
     - env: IMAGE=x86_64-gnu-debug
     - env: IMAGE=x86_64-gnu-nopt
-    - env: IMAGE=x86_64-gnu-make
     - env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
     - env: IMAGE=x86_64-gnu-distcheck
     - env: IMAGE=x86_64-gnu-incremental
@@ -58,13 +57,6 @@ matrix:
       osx_image: xcode8.2
       install: *osx_install_sccache
     - env: >
-        RUST_CHECK_TARGET=check
-        RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin --disable-rustbuild
-        SRC=.
-      os: osx
-      osx_image: xcode8.2
-      install: *osx_install_sccache
-    - env: >
         RUST_CHECK_TARGET=dist
         RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended"
         SRC=.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cdbabeaddfb..429996126f9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -93,11 +93,6 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
 
 [bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/
 
-> **Note**: the build system was recently rewritten from a jungle of makefiles
-> to the current incarnation you'll see in `src/bootstrap`. If you experience
-> bugs you can temporarily revert back to the makefiles with
-> `--disable-rustbuild` passed to `./configure`.
-
 ### Configuration
 
 Before you can start building the compiler you need to configure the build for
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 8dbe2421390..00000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,297 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# <help> \(^o^)/
-#
-# Greetings, adventurer! The Rust Build System is at your service.
-#
-# Whether you want a genuine copy of `rustc`, access to the latest and
-# most authoritative Rust documentation, or even to investigate the
-# most intimate workings of the compiler itself, you've come to the
-# right place. Let's see what's on the menu.
-#
-# Please note that most of these options only work if configure was
-# run with --disable-rustbuild. For documentation on the new build
-# system, see CONTRIBUTING.md.
-#
-# First, start with one of these build targets:
-#
-#   * all - The default. Build a complete, bootstrapped compiler.
-#           `rustc` will be in `${target-triple}/stage2/bin/`. Run it
-#           directly from the build directory if you like. This also
-#           comes with docs in `doc/`.
-#
-#   * check - Run the complete test suite
-#
-#   * clean - Clean the build repository. It is advised to run this
-#             command if you want to build Rust again, after an update
-#             of the git repository.
-#
-#   * install - Install Rust. Note that installation is not necessary
-#               to use the compiler.
-#
-#   * uninstall - Uninstall the binaries
-#
-# For tips on working with The Rust Build System, just:
-#
-#     run `make tips`
-#
-# Otherwise
-#
-#     run `make`
-#
-# </help>
-#
-# <tips>
-#
-# # The Rust Build System Tip Line
-#
-# There are a bazillion different targets you might want to build. Here
-# are a few ideas.
-#
-#   * docs - Build gobs of HTML documentation and put it into `doc/`
-#   * check-$(crate) - Test a crate, e.g. `check-std`
-#   * check-ref - Run the language reference tests
-#   * check-docs - Test the documentation examples
-#   * check-stage$(stage)-$(crate) - Test a crate in a specific stage
-#   * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/
-#   * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests
-#   * tidy - Basic style check, show highest rustc error code and
-#     the status of language and lib features
-#   * rustc-stage$(stage) - Only build up to a specific stage
-#   * $host/stage1/bin/rustc - Only build stage1 rustc, not libstd. For further
-#     information see "Rust recipes for build system success" below.
-#
-# Then mix in some of these environment variables to harness the
-# ultimate power of The Rust Build System.
-#
-#   * `VERBOSE=1` - Print all commands. Use this to see what's going on.
-#   * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
-#   * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
-#
-#   * `TESTNAME=...` - Specify the name of tests to run
-#   * `CHECK_IGNORED=1` - Run normally-ignored tests
-#   * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag)
-#
-#   * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
-#   * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
-#                            (requires `CFG_ENABLE_VALGRIND`)
-#
-#   * `NO_REBUILD=1` - Don't rebootstrap when testing std
-#                      (and possibly other crates)
-#   * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files
-#
-#   * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
-#   * `ASM_COMMENTS=1` - Use `-Z asm-comments`
-#   * `TIME_PASSES=1` - Use `-Z time-passes`
-#   * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
-#   * `TRACE=1` - Use `-Z trace`
-#
-# # Rust recipes for build system success
-#
-#     // Modifying libstd? Use this command to run unit tests just on your change
-#     make check-stage1-std NO_REBUILD=1 NO_BENCH=1
-#
-#     // Modifying just rustc?
-#     // Compile rustc+libstd once
-#     make rustc-stage1
-#     // From now on use this command to rebuild just rustc and reuse the previously built libstd
-#     // $host is a target triple, eg. x86_64-unknown-linux-gnu
-#     // The resulting binary is located at $host/stage1/bin/rustc.
-#     // If there are any issues with libstd recompile it with the command above.
-#     make $host/stage1/bin/rustc
-#
-#     // Added a run-pass test? Use this to test running your test
-#     make check-stage1-rpass TESTNAME=my-shiny-new-test
-#
-#     // Having trouble figuring out which test is failing? Turn off parallel tests
-#     make check-stage1-std RUST_TEST_THREADS=1
-#
-#     // To make debug!() and other logging calls visible, reconfigure:
-#     ./configure --enable-debug-assertions
-#     make ....
-#
-# If you really feel like getting your hands dirty, then:
-#
-#     run `make nitty-gritty`
-#
-# # Make command examples
-#
-# ## Docs linked commands
-#
-# * make check-stage1-rustdocck: Builds rustdoc. It has the advantage to compile
-#                                quite quickly since we're only using stage1
-#                                executables.
-# * make doc/error-index.md: Gets all doc blocks from doc comments and error
-#                            explanations to put them in a markdown file. You
-#                            can then test them by running
-#                            "rustdoc --test error-index.md".
-#
-# And of course, the wonderfully useful 'make tidy'! Always run it before opening a pull request to rust!
-#
-# </tips>
-#
-# <nitty-gritty>
-#
-# # The Rust Build System
-#
-# Gosh I wish there was something useful here (TODO).
-#
-# # An (old) explanation of how the build is structured:
-#
-# *Note: Hey, like, this is probably inaccurate, and is definitely
-# an outdated and insufficient explanation of the remarkable
-# Rust Build System.*
-#
-# There are multiple build stages (0-3) needed to verify that the
-# compiler is properly self-hosting. Each stage is divided between
-# 'host' artifacts and 'target' artifacts, where the stageN host
-# compiler builds artifacts for 1 or more stageN target architectures.
-# Once the stageN target compiler has been built for the host
-# architecture it is promoted (copied) to a stageN+1 host artifact.
-#
-# The stage3 host compiler is a compiler that successfully builds
-# itself and should (in theory) be bitwise identical to the stage2
-# host compiler. The process is bootstrapped using a stage0 host
-# compiler downloaded from a previous snapshot.
-#
-# At no time should stageN artifacts be interacting with artifacts
-# from other stages. For consistency, we use the 'promotion' logic
-# for all artifacts, even those that don't make sense on non-host
-# architectures.
-#
-# The directory layout for a stage is intended to match the layout
-# of the installed compiler, and looks like the following:
-#
-# stageN - this is the system root, corresponding to, e.g. /usr
-#   bin - binaries compiled for the host
-#   lib - libraries used by the host compiler
-#     rustlib - rustc's own place to organize libraries
-#       $(target) - target-specific artifacts
-#         bin - binaries for target architectures
-#         lib - libraries for target architectures
-#
-# A note about host libraries:
-#
-# The only libraries that get promoted to stageN/lib are those needed
-# by rustc. In general, rust programs, even those compiled for the
-# host architecture will use libraries from the target
-# directories. This gives rust some freedom to experiment with how
-# libraries are managed and versioned without polluting the common
-# areas of the filesystem.
-#
-# General rust binaries may still live in the host bin directory; they
-# will just link against the libraries in the target lib directory.
-#
-# Admittedly this is a little convoluted.
-#
-# If you find yourself working on the make infrastructure itself, and trying to
-# find the value of a given variable after expansion, you can use:
-#
-# make print-VARIABLE_NAME
-#
-# To extract it
-#
-# </nitty-gritty>
-#
-
-######################################################################
-# Primary rules
-######################################################################
-
-# Issue #9531: If you change the order of any of the following (or add
-# new definitions), make sure definitions always precede their uses,
-# especially for the dependency lists of recipes.
-
-# First, load the variables exported by the configure script
-include config.mk
-
-# Just a few macros used everywhere
-include $(CFG_SRC_DIR)mk/util.mk
-# Reconfiguring when the makefiles or submodules change
-include $(CFG_SRC_DIR)mk/reconfig.mk
-# All crates and their dependencies
-include $(CFG_SRC_DIR)mk/crates.mk
-# Various bits of setup, common macros, and top-level rules
-include $(CFG_SRC_DIR)mk/main.mk
-# C and assembly components that are not LLVM
-include $(CFG_SRC_DIR)mk/rt.mk
-# Rules for crates in the target directories
-include $(CFG_SRC_DIR)mk/target.mk
-# Rules for crates in the host directories
-include $(CFG_SRC_DIR)mk/host.mk
-# Special rules for bootstrapping stage0
-include $(CFG_SRC_DIR)mk/stage0.mk
-# Rust-specific LLVM extensions
-include $(CFG_SRC_DIR)mk/rustllvm.mk
-# Documentation
-include $(CFG_SRC_DIR)mk/docs.mk
-# LLVM
-include $(CFG_SRC_DIR)mk/llvm.mk
-# Rules for installing debugger scripts
-include $(CFG_SRC_DIR)mk/debuggers.mk
-
-######################################################################
-# Secondary makefiles, conditionalized for speed
-######################################################################
-
-# The test suite
-ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
-               $(findstring test,$(MAKECMDGOALS))  \
-               $(findstring tidy,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including test rules)
-  include $(CFG_SRC_DIR)mk/tests.mk
-  include $(CFG_SRC_DIR)mk/grammar.mk
-endif
-
-# Copy all the distributables to another directory for binary install
-ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
-               $(findstring dist,$(MAKECMDGOALS)) \
-               $(findstring install,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including prepare rules)
-  include $(CFG_SRC_DIR)mk/prepare.mk
-endif
-
-# Source and binary distribution artifacts
-ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
-               $(findstring install,$(MAKECMDGOALS)) \
-               $(findstring clean,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including dist rules)
-  include $(CFG_SRC_DIR)mk/dist.mk
-endif
-
-# (Unix) Installation from the build directory
-ifneq ($(findstring install,$(MAKECMDGOALS)),)
-  CFG_INFO := $(info cfg: including install rules)
-  include $(CFG_SRC_DIR)mk/install.mk
-endif
-
-# Cleaning
-ifneq ($(findstring clean,$(MAKECMDGOALS)),)
-  CFG_INFO := $(info cfg: including clean rules)
-  include $(CFG_SRC_DIR)mk/clean.mk
-endif
-
-# CTAGS building
-ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
-               $(findstring TAGS.vi,$(MAKECMDGOALS)) \
-               $(findstring TAGS.rustc.emacs,$(MAKECMDGOALS)) \
-               $(findstring TAGS.rustc.vi,$(MAKECMDGOALS))),)
-  CFG_INFO := $(info cfg: including ctags rules)
-  include $(CFG_SRC_DIR)mk/ctags.mk
-endif
-
-.DEFAULT:
-	@echo
-	@echo "======================================================"
-	@echo "== If you need help, run 'make help' or 'make tips' =="
-	@echo "======================================================"
-	@echo
-	exit 1
diff --git a/appveyor.yml b/appveyor.yml
index c617ac8a4e3..2183d8da95f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -15,11 +15,6 @@ environment:
     SCRIPT: python x.py test --host i686-pc-windows-msvc --target i686-pc-windows-msvc && python x.py dist
     DEPLOY: 1
 
-  # MSVC makefiles
-  - MSYS_BITS: 64
-    RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --disable-rustbuild
-    RUST_CHECK_TARGET: check
-
   # MSVC cargotest
   - MSYS_BITS: 64
     NO_VENDOR: 1
@@ -58,13 +53,6 @@ environment:
     MINGW_DIR: mingw32
     DEPLOY: 1
 
-  - MSYS_BITS: 32
-    RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --disable-rustbuild
-    RUST_CHECK_TARGET: check
-    MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
-    MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
-    MINGW_DIR: mingw32
-
   - MSYS_BITS: 64
     SCRIPT: python x.py test && python x.py dist
     RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended
diff --git a/configure b/configure
index a23b050ff2c..597f0076336 100755
--- a/configure
+++ b/configure
@@ -994,191 +994,12 @@ then
     putvar CFG_LOCAL_RUST_ROOT
 fi
 
-# Force bitrig to build with clang; gcc doesn't like us there
-if [ $CFG_OSTYPE = unknown-bitrig ]
-then
-    step_msg "on Bitrig, forcing use of clang"
-    CFG_ENABLE_CLANG=1
-fi
-
-# default gcc version under OpenBSD maybe too old, try using egcc, which is a
-# gcc version from ports
-if [ $CFG_OSTYPE = unknown-openbsd ]
-then
-    if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
-        step_msg "older GCC found, try with egcc instead"
-
-        # probe again but using egcc
-        probe CFG_GCC egcc
-
-        # and use egcc/eg++ for CC/CXX too if it was found
-        # (but user setting has priority)
-        if [ -n "$CFG_GCC" ]; then
-            CC="${CC:-egcc}"
-            CXX="${CXX:-eg++}"
-        fi
-    fi
-fi
-
-# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
-# system, so if we find that gcc is clang, we should just use clang directly.
-if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]
-then
-    CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
-    if [ $? -eq 0 ]
-    then
-        step_msg "on OS X >=10.9, forcing use of clang"
-        CFG_ENABLE_CLANG=1
-    else
-        if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
-            step_msg "older GCC found, using clang instead"
-            CFG_ENABLE_CLANG=1
-        else
-            # on OS X, with xcode 5 and newer, certain developers may have
-            # cc, gcc and g++ point to a  mixture of clang and gcc
-            # if so, this will create very strange build errors
-            # this last stanza is to detect some such problems and save the future rust
-            # contributor some time solving that issue.
-            # this detection could be generalized to other OSes aside from OS X
-            # but the issue seems most likely to happen on OS X
-
-            chk_cc () {
-                $1 --version 2> /dev/null | grep -q $2
-            }
-            # check that gcc, cc and g++ all point to the same compiler.
-            # note that for xcode 5, g++ points to clang, not clang++
-            if !((chk_cc gcc clang  && chk_cc g++ clang) ||
-                (chk_cc gcc gcc  &&( chk_cc g++ g++ || chk g++ gcc))); then
-                err "the gcc and g++ in your path point to different compilers.
-    Check which versions are in your path with gcc --version and g++ --version.
-    To resolve this problem, either fix your PATH  or run configure with --enable-clang"
-            fi
-
-        fi
-    fi
-fi
-
-# If the clang isn't already enabled, check for GCC, and if it is missing, turn
-# on clang as a backup.
-if [ -z "$CFG_ENABLE_CLANG" ]
-then
-  CFG_GCC_VERSION=$("$CFG_GCC" --version 2>&1)
-  if [ $? -ne 0 ]
-  then
-    step_msg "GCC not installed, will try using Clang"
-    CFG_ENABLE_CLANG=1
-  fi
-fi
-
-# Okay, at this point, we have made up our minds about whether we are
-# going to force CFG_ENABLE_CLANG or not; save the setting if so.
-if [ -n "$CFG_ENABLE_CLANG" ]
-then
-    putvar CFG_ENABLE_CLANG
-fi
-
-if [ -z "$CFG_DISABLE_LIBCPP" -a -n "$CFG_ENABLE_CLANG" ]
-then
-    CFG_USING_LIBCPP="1"
-else
-    CFG_USING_LIBCPP="0"
-fi
-
 # Same with jemalloc.  save the setting here.
 if [ -n "$CFG_DISABLE_JEMALLOC" ]
 then
     putvar CFG_DISABLE_JEMALLOC
 fi
 
-if [ -n "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
-then
-    step_msg "using custom LLVM at $CFG_LLVM_ROOT"
-
-    LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config"
-    LLVM_VERSION=$($LLVM_CONFIG --version)
-
-    case $LLVM_VERSION in
-        (3.[7-9]*)
-            msg "found ok version of LLVM: $LLVM_VERSION"
-            ;;
-        (*)
-            err "bad LLVM version: $LLVM_VERSION, need >=3.7"
-            ;;
-    esac
-
-    if "$CFG_LLVM_ROOT/bin/llvm-mc" -help | grep -- "-relocation-model"; then
-        msg "found older llvm-mc"
-        CFG_LLVM_MC_HAS_RELOCATION_MODEL=1
-        putvar CFG_LLVM_MC_HAS_RELOCATION_MODEL
-    fi
-fi
-
-# Even when the user overrides the choice of CC, still try to detect
-# clang to disable some clang-specific warnings.  We here draw a
-# distinction between:
-#
-#  CFG_ENABLE_CLANG : passed --enable-clang, or host "requires" clang,
-#  CFG_USING_CLANG : compiler (clang / gcc / $CC) looks like clang.
-#
-# This distinction is important because there are some safeguards we
-# would prefer to skip when merely CFG_USING_CLANG is set; but when
-# CFG_ENABLE_CLANG is set, that indicates that we are opting into
-# running such safeguards.
-
-if [ -n "$CC" ]
-then
-    msg "skipping compiler inference steps; using provided CC=$CC"
-    CFG_CC="$CC"
-
-    CFG_OSX_CC_VERSION=$("$CFG_CC" --version 2>&1 | grep "clang")
-    if [ $? -eq 0 ]
-    then
-        step_msg "note, user-provided CC looks like clang; CC=$CC."
-        CFG_USING_CLANG=1
-        putvar CFG_USING_CLANG
-    fi
-else
-    if [ -n "$CFG_ENABLE_CLANG" ]
-    then
-        if [ -z "$CFG_CLANG" ]
-        then
-            err "clang requested but not found"
-        fi
-        CFG_CC="$CFG_CLANG"
-        CFG_USING_CLANG=1
-        putvar CFG_USING_CLANG
-    else
-        CFG_CC="gcc"
-    fi
-fi
-
-if [ -n "$CFG_ENABLE_CLANG" ]
-then
-    case "$CC" in
-        (''|*clang)
-        if [ -z "$CC" ]
-        then
-            CFG_CC="clang"
-            CFG_CXX="clang++"
-        fi
-    esac
-fi
-
-if [ -n "$CFG_ENABLE_CCACHE" ]
-then
-    if [ -z "$CFG_CCACHE" ]
-    then
-        err "ccache requested but not found"
-    fi
-
-    CFG_CC="ccache $CFG_CC"
-fi
-
-if [ -z "$CC" -a -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
-then
-    err "either clang or gcc is required"
-fi
-
 # All safeguards based on $CFG_ENABLE_CLANG should occur before this
 # point in the script; after this point, script logic should inspect
 # $CFG_USING_CLANG rather than $CFG_ENABLE_CLANG.
@@ -1191,12 +1012,6 @@ envopt CFLAGS
 envopt CXXFLAGS
 envopt LDFLAGS
 
-# stdc++ name in use
-# used to manage non-standard name (on OpenBSD for example)
-program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")
-CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}")
-putvar CFG_STDCPP_NAME
-
 # a little post-processing of various config values
 CFG_PREFIX=${CFG_PREFIX%/}
 CFG_MANDIR=${CFG_MANDIR%/}
@@ -1224,651 +1039,6 @@ do
 done
 CFG_TARGET=$V_TEMP
 
-# check target-specific tool-chains
-for i in $CFG_TARGET
-do
-    L_CHECK=false
-    for j in $CFG_SUPPORTED_TARGET
-    do
-        if [ $i = $j ]
-        then
-            L_CHECK=true
-        fi
-    done
-
-    if [ $L_CHECK = false ]
-    then
-        err "unsupported target triples \"$i\" found"
-    fi
-
-    case $i in
-        *android*)
-            case $i in
-                armv7-linux-androideabi)
-                    cmd_prefix="arm-linux-androideabi"
-                    ;;
-                *)
-                    cmd_prefix=$i
-                    ;;
-            esac
-
-            upper_snake_target=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
-            eval ndk=\$"CFG_${upper_snake_target}_NDK"
-            if [ -z "$ndk" ]
-            then
-                ndk=$CFG_ANDROID_CROSS_PATH
-                eval "CFG_${upper_snake_target}_NDK"=$CFG_ANDROID_CROSS_PATH
-                warn "generic/default Android NDK option is deprecated (use --$i-ndk option instead)"
-            fi
-
-            # Perform a basic sanity check of the NDK
-            for android_ndk_tool in "$ndk/bin/$cmd_prefix-gcc" "$ndk/bin/$cmd_prefix-g++" "$ndk/bin/$cmd_prefix-ar"
-            do
-                if [ ! -f $android_ndk_tool ]
-                then
-                    err "NDK tool $android_ndk_tool not found (bad or missing --$i-ndk option?)"
-                fi
-            done
-            ;;
-        *-unknown-nacl)
-	    if [ -z "$CFG_NACL_CROSS_PATH" ]
-	    then
-		err "I need the NaCl SDK path! (use --nacl-cross-path)"
-	    fi
-	    ;;
-        arm-apple-darwin)
-            if [ $CFG_OSTYPE != apple-darwin ]
-            then
-                err "The iOS target is only supported on Mac OS X"
-            fi
-            ;;
-
-        *-msvc)
-            # There are three builds of cmake on windows: MSVC, MinGW and Cygwin
-            # The Cygwin build does not have generators for Visual Studio, so
-            # detect that here and error.
-            if ! "$CFG_CMAKE" --help | sed -n '/^Generators/,$p' | grep 'Visual Studio' > /dev/null
-            then
-                err "
-
-cmake does not support Visual Studio generators.
-
-This is likely due to it being an msys/cygwin build of cmake, \
-rather than the required windows version, built using MinGW \
-or Visual Studio.
-
-If you are building under msys2 try installing the mingw-w64-x86_64-cmake \
-package instead of cmake:
-
-$ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
-"
-            fi
-
-            # Use the REG program to figure out where VS is installed
-            # We need to figure out where cl.exe and link.exe are, so we do some
-            # munging and some probing here. We also look for the default
-            # INCLUDE and LIB variables for MSVC so we can set those in the
-            # build system as well.
-            install=$(cmd //c reg QUERY \
-                       'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \
-                       -v InstallDir)
-            if [ -z "$install" ]; then
-              install=$(cmd //c reg QUERY \
-                         'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
-                         -v InstallDir)
-            fi
-            need_ok "couldn't find visual studio install root"
-            CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
-            CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
-            CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
-            putvar CFG_MSVC_ROOT
-
-            case $i in
-                x86_64-*)
-                    bits=x86_64
-                    msvc_part=amd64
-                    ;;
-                i*86-*)
-                    bits=i386
-                    msvc_part=
-                    ;;
-                *)
-                    err "can only target x86 targets for MSVC"
-                    ;;
-            esac
-            bindir="${CFG_MSVC_ROOT}/VC/bin"
-            if [ -n "$msvc_part" ]; then
-                bindir="$bindir/$msvc_part"
-            fi
-            eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
-            eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\""
-            eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\""
-            eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""
-
-            vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
-            include_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !INCLUDE!)
-            need_ok "failed to learn about MSVC's INCLUDE"
-            lib_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !LIB!)
-            need_ok "failed to learn about MSVC's LIB"
-
-            eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""
-            eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\""
-
-            putvar CFG_MSVC_BINDIR_${bits}
-            putvar CFG_MSVC_CL_${bits}
-            putvar CFG_MSVC_LIB_${bits}
-            putvar CFG_MSVC_LINK_${bits}
-            putvar CFG_MSVC_INCLUDE_PATH_${bits}
-            putvar CFG_MSVC_LIB_PATH_${bits}
-            ;;
-
-        *)
-            ;;
-    esac
-done
-
-if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
-then
-    # There are some MSYS python builds which will auto-translate
-    # windows-style paths to MSYS-style paths in Python itself.
-    # Unfortunately this breaks LLVM's build system as somewhere along
-    # the line LLVM prints a path into a file from Python and then CMake
-    # later tries to interpret that path. If Python prints a MSYS path
-    # and CMake tries to use it as a Windows path, you're gonna have a
-    # Bad Time.
-    #
-    # Consequently here we try to detect when that happens and print an
-    # error if it does.
-    if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null
-    then
-        err "
-
-python is silently translating windows paths to MSYS paths \
-and the build will fail if this python is used.
-
-Either an official python install must be used or an \
-alternative python package in MinGW must be used.
-
-If you are building under msys2 try installing the mingw-w64-x86_64-python2 \
-package instead of python2:
-
-$ pacman -S mingw-w64-x86_64-python2
-"
-    fi
-fi
-
-if [ -n "$CFG_PERF" ]
-then
-    HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
-    if [ -z "$HAVE_PERF_LOGFD" ];
-    then
-        CFG_PERF_WITH_LOGFD=1
-        putvar CFG_PERF_WITH_LOGFD
-    fi
-fi
-
-if [ -n "$CFG_DISABLE_RUSTBUILD" ]; then
-
-  step_msg "making directories"
-
-  for i in \
-      doc doc/std doc/extra \
-      dl tmp dist
-  do
-      make_dir $i
-  done
-
-  for t in $CFG_HOST
-  do
-      make_dir $t/llvm
-  done
-
-  for t in $CFG_HOST
-  do
-      make_dir $t/rustllvm
-  done
-
-  for t in $CFG_TARGET
-  do
-    make_dir $t/rt
-    for s in 0 1 2 3
-    do
-      make_dir $t/rt/stage$s
-      make_dir $t/rt/jemalloc
-      make_dir $t/rt/compiler-rt
-      for i in                                          \
-        isaac sync test \
-        arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips arch/powerpc
-      do
-        make_dir $t/rt/stage$s/$i
-      done
-    done
-  done
-
-  for h in $CFG_HOST
-  do
-      for t in $CFG_TARGET
-      do
-          # host bin dir stage0
-          make_dir $h/stage0/bin
-
-          # host lib dir stage0
-          make_dir $h/stage0/lib
-
-          # host test dir stage0
-          make_dir $h/stage0/test
-
-          # target bin dir stage0
-          make_dir $h/stage0/lib/rustlib/$t/bin
-
-          # target lib dir stage0
-          make_dir $h/stage0/lib/rustlib/$t/lib
-
-          for i in 1 2 3
-          do
-              # host bin dir
-              make_dir $h/stage$i/bin
-
-              # host lib dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE
-
-              # host test dir
-              make_dir $h/stage$i/test
-
-              # target bin dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin
-
-              # target lib dir
-              make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib
-          done
-      done
-
-      make_dir $h/test/run-pass
-      make_dir $h/test/run-pass-valgrind
-      make_dir $h/test/run-pass-fulldeps
-      make_dir $h/test/run-fail
-      make_dir $h/test/run-fail-fulldeps
-      make_dir $h/test/compile-fail
-      make_dir $h/test/parse-fail
-      make_dir $h/test/compile-fail-fulldeps
-      make_dir $h/test/bench
-      make_dir $h/test/perf
-      make_dir $h/test/pretty
-      make_dir $h/test/debuginfo-gdb
-      make_dir $h/test/debuginfo-lldb
-      make_dir $h/test/codegen
-      make_dir $h/test/codegen-units
-      make_dir $h/test/rustdoc
-  done
-
-fi
-
-# Configure submodules
-step_msg "configuring submodules"
-
-# Have to be in the top of src directory for this
-if [ -z "$CFG_DISABLE_MANAGE_SUBMODULES" ] && [ -n "$CFG_DISABLE_RUSTBUILD" ]
-then
-    cd ${CFG_SRC_DIR}
-
-    msg "git: submodule sync"
-    "${CFG_GIT}" submodule sync
-
-    msg "git: submodule init"
-    "${CFG_GIT}" submodule init
-
-    # Disable submodules that we're not using
-    if [ -n "${CFG_LLVM_ROOT}" ]; then
-        msg "git: submodule deinit src/llvm"
-        "${CFG_GIT}" submodule deinit src/llvm
-    fi
-    if [ -n "${CFG_JEMALLOC_ROOT}" ]; then
-        msg "git: submodule deinit src/jemalloc"
-        "${CFG_GIT}" submodule deinit src/jemalloc
-    fi
-
-    msg "git: submodule update"
-    "${CFG_GIT}" submodule update
-    need_ok "git failed"
-
-    msg "git: submodule foreach sync"
-    "${CFG_GIT}" submodule foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi'
-    need_ok "git failed"
-
-    msg "git: submodule foreach update"
-    "${CFG_GIT}" submodule update --recursive
-    need_ok "git failed"
-
-    # NB: this is just for the sake of getting the submodule SHA1 values
-    # and status written into the build log.
-    msg "git: submodule status"
-    "${CFG_GIT}" submodule status --recursive
-
-    msg "git: submodule clobber"
-    "${CFG_GIT}" submodule foreach --recursive git clean -dxf
-    need_ok "git failed"
-    "${CFG_GIT}" submodule foreach --recursive git checkout .
-    need_ok "git failed"
-
-    cd ${CFG_BUILD_DIR}
-fi
-
-# Do a sanity check that the submodule source exists. Because GitHub
-# automatically publishes broken tarballs that can't be disabled, and
-# people download them and try to use them.
-if [ ! -e "${CFG_SRC_DIR}/src/liblibc" ]; then
-    err "some submodules are missing. Is this a broken tarball?
-
-If you downloaded this tarball from the GitHub release pages at
-https://github.com/rust-lang/rust/releases,
-then please delete it and instead download the source from
-https://www.rust-lang.org/downloads.html"
-
-fi
-
-# Configure llvm, only if necessary
-step_msg "looking at LLVM"
-CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
-for t in $CFG_HOST
-do
-    do_reconfigure=1
-    is_msvc=0
-    case "$t" in
-        (*-msvc)
-        is_msvc=1
-        ;;
-    esac
-
-    if [ -z "$CFG_DISABLE_RUSTBUILD" ]
-    then
-        msg "not configuring LLVM, rustbuild in use"
-        do_reconfigure=0
-    elif [ -z "$CFG_LLVM_ROOT" ]
-    then
-        LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
-        LLVM_INST_DIR=$LLVM_BUILD_DIR
-        # For some weird reason the MSVC output dir is different than Unix
-        if [ ${is_msvc} -ne 0 ]; then
-            if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]
-            then
-                # Just use LLVM straight from its build directory to
-                # avoid 'make install' time
-                LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug
-            else
-                LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
-            fi
-        fi
-    else
-        msg "not reconfiguring LLVM, external LLVM root"
-        # The user is using their own LLVM
-        LLVM_BUILD_DIR=
-        LLVM_INST_DIR=$CFG_LLVM_ROOT
-        do_reconfigure=0
-        # Check that LLVm FileCheck is available. Needed for the tests
-        if [ -z "$CFG_DISABLE_CODEGEN_TESTS" ]; then
-            need_cmd $LLVM_INST_DIR/bin/FileCheck
-        fi
-    fi
-
-    if [ ${do_reconfigure} -ne 0 ]
-    then
-    # because git is hilarious, it might have put the module index
-    # in a couple places.
-        index1="${CFG_SRC_DIR}.git/modules/src/llvm/index"
-        index2="${CFG_SRC_DIR}src/llvm/.git/index"
-        for index in ${index1} ${index2}
-        do
-            config_status="${LLVM_BUILD_DIR}/config.status"
-            if test -e ${index} -a \
-                    -e ${config_status} -a \
-                    ${config_status} -nt ${index}
-            then
-                msg "not reconfiguring LLVM, config.status is fresh"
-                do_reconfigure=0
-            fi
-        done
-    fi
-
-    # We need the generator later on for compiler-rt even if LLVM's not built
-    if [ -n "$CFG_NINJA" ]
-    then
-        generator="Ninja"
-    elif [ ${is_msvc} -ne 0 ]
-    then
-        case "$CFG_MSVC_ROOT" in
-            *14.0*)
-                generator="Visual Studio 14 2015"
-                ;;
-            *12.0*)
-                generator="Visual Studio 12 2013"
-                ;;
-            *)
-                err "can't determine generator for LLVM cmake"
-                ;;
-        esac
-        case "$t" in
-            x86_64-*)
-                generator="$generator Win64"
-                ;;
-            i686-*)
-                ;;
-            *)
-                err "can only build LLVM for x86 platforms"
-                ;;
-        esac
-    else
-        generator="Unix Makefiles"
-    fi
-    CFG_CMAKE_GENERATOR=$generator
-    putvar CFG_CMAKE_GENERATOR
-
-    msg "configuring LLVM for $t"
-
-    LLVM_CFLAGS_32=""
-    LLVM_CXXFLAGS_32=""
-    LLVM_LDFLAGS_32=""
-    LLVM_CFLAGS_64=""
-    LLVM_CXXFLAGS_64=""
-    LLVM_LDFLAGS_64=""
-
-    case "$CFG_CC" in
-        ("ccache clang")
-            LLVM_CXX_32="ccache"
-            LLVM_CC_32="ccache"
-            LLVM_CXX_32_ARG1="clang++"
-            LLVM_CC_32_ARG1="clang"
-            LLVM_CFLAGS_32="-Qunused-arguments"
-            LLVM_CXXFLAGS_32="-Qunused-arguments"
-
-            LLVM_CXX_64="ccache"
-            LLVM_CC_64="ccache"
-            LLVM_CXX_64_ARG1="clang++"
-            LLVM_CC_64_ARG1="clang"
-            LLVM_CFLAGS_64="-Qunused-arguments"
-            LLVM_CXXFLAGS_64="-Qunused-arguments"
-            ;;
-        ("clang")
-            LLVM_CXX_32="clang++"
-            LLVM_CC_32="clang"
-            LLVM_CFLAGS_32="-Qunused-arguments"
-            LLVM_CXXFLAGS_32="-Qunused-arguments"
-
-            LLVM_CXX_64="clang++"
-            LLVM_CC_64="clang"
-            LLVM_CFLAGS_64="-Qunused-arguments"
-            LLVM_CXXFLAGS_64="-Qunused-arguments"
-            ;;
-        ("ccache gcc")
-            LLVM_CXX_32="ccache"
-            LLVM_CC_32="ccache"
-            LLVM_CXX_32_ARG1="g++"
-            LLVM_CC_32_ARG1="gcc"
-
-            LLVM_CXX_64="ccache"
-            LLVM_CC_64="ccache"
-            LLVM_CXX_64_ARG1="g++"
-            LLVM_CC_64_ARG1="gcc"
-            ;;
-        ("gcc")
-            if [ -z "$CFG_ENABLE_SCCACHE" ]; then
-                LLVM_CXX_32="g++"
-                LLVM_CC_32="gcc"
-
-                LLVM_CXX_64="g++"
-                LLVM_CC_64="gcc"
-            else
-                LLVM_CXX_32="sccache"
-                LLVM_CC_32="sccache"
-                LLVM_CXX_32_ARG1="g++"
-                LLVM_CC_32_ARG1="gcc"
-
-                LLVM_CXX_64="sccache"
-                LLVM_CC_64="sccache"
-                LLVM_CXX_64_ARG1="g++"
-                LLVM_CC_64_ARG1="gcc"
-            fi
-            ;;
-
-        (*)
-            msg "inferring LLVM_CXX/CC from CXX/CC = $CXX/$CC"
-            if [ -n "$CFG_ENABLE_CCACHE" ]
-            then
-                if [ -z "$CFG_CCACHE" ]
-                then
-                    err "ccache requested but not found"
-                fi
-
-                LLVM_CXX_32="ccache"
-                LLVM_CC_32="ccache"
-                LLVM_CXX_32_ARG1="$CXX"
-                LLVM_CC_32_ARG1="$CC"
-
-                LLVM_CXX_64="ccache"
-                LLVM_CC_64="ccache"
-                LLVM_CXX_64_ARG1="$CXX"
-                LLVM_CC_64_ARG1="$CC"
-            else
-                LLVM_CXX_32="$CXX"
-                LLVM_CC_32="$CC"
-
-                LLVM_CXX_64="$CXX"
-                LLVM_CC_64="$CC"
-            fi
-
-            ;;
-    esac
-
-    case "$CFG_CPUTYPE" in
-        (x86*)
-            LLVM_CFLAGS_32="$LLVM_CFLAGS_32 -m32"
-            LLVM_CXXFLAGS_32="$LLVM_CXXFLAGS_32 -m32"
-            LLVM_LDFLAGS_32="$LLVM_LDFLAGS_32 -m32"
-            ;;
-    esac
-
-    if echo $t | grep -q x86_64
-    then
-        LLVM_CXX=$LLVM_CXX_64
-        LLVM_CC=$LLVM_CC_64
-        LLVM_CXX_ARG1=$LLVM_CXX_64_ARG1
-        LLVM_CC_ARG1=$LLVM_CC_64_ARG1
-        LLVM_CFLAGS=$LLVM_CFLAGS_64
-        LLVM_CXXFLAGS=$LLVM_CXXFLAGS_64
-        LLVM_LDFLAGS=$LLVM_LDFLAGS_64
-    else
-        LLVM_CXX=$LLVM_CXX_32
-        LLVM_CC=$LLVM_CC_32
-        LLVM_CXX_ARG1=$LLVM_CXX_32_ARG1
-        LLVM_CC_ARG1=$LLVM_CC_32_ARG1
-        LLVM_CFLAGS=$LLVM_CFLAGS_32
-        LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32
-        LLVM_LDFLAGS=$LLVM_LDFLAGS_32
-    fi
-
-    if [ "$CFG_USING_LIBCPP" != "0" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBCXX=ON"
-    fi
-
-    # Turn off things we don't need
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_TESTS=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_EXAMPLES=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_DOCS=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ZLIB=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DWITH_POLY=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_TERMINFO=OFF"
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBEDIT=OFF"
-
-    arch="$(echo "$t" | cut -d - -f 1)"
-
-    if [ "$arch" = i686 ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_BUILD_32_BITS=ON"
-    fi
-
-    if [ "$t" != "$CFG_BUILD" ]; then
-        # see http://llvm.org/docs/HowToCrossCompileLLVM.html
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CROSSCOMPILING=True"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGET_ARCH=$arch"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TABLEGEN=$CFG_BUILD_DIR/$CFG_BUILD/llvm/bin/llvm-tblgen"
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=$t"
-    fi
-
-    # MSVC handles compiler business itself
-    if [ ${is_msvc} -eq 0 ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$LLVM_CC"
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$LLVM_CXX"
-        CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_C_FLAGS=$LLVM_CFLAGS'"
-        CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_CXX_FLAGS=$LLVM_CXXFLAGS'"
-        if [ -n "$LLVM_CC_ARG1" ]; then
-            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER_ARG1=$LLVM_CC_ARG1"
-        fi
-        if [ -n "$LLVM_CXX_ARG1" ]; then
-            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=$LLVM_CXX_ARG1"
-        fi
-        # FIXME: What about LDFLAGS?
-    fi
-
-    if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
-    elif [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=RelWithDebInfo"
-    else
-        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
-    fi
-    if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
-    then
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF"
-    else
-        CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON"
-    fi
-
-    CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc'"
-    CMAKE_ARGS="$CMAKE_ARGS -G '$CFG_CMAKE_GENERATOR'"
-    CMAKE_ARGS="$CMAKE_ARGS $CFG_LLVM_SRC_DIR"
-
-    if [ ${do_reconfigure} -ne 0 ]
-    then
-        msg "configuring LLVM for $t with cmake"
-
-        msg "configuring LLVM with:"
-        msg "$CMAKE_ARGS"
-
-        (cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
-        need_ok "LLVM cmake configure failed"
-    fi
-
-    # Construct variables for LLVM build and install directories for
-    # each target. These will be named
-    # CFG_LLVM_BUILD_DIR_${target_triple} but all the hyphens in
-    # target_triple will be converted to underscore, because bash
-    # variables can't contain hyphens. The makefile will then have to
-    # convert back.
-    CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
-    CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)
-    eval ${CFG_LLVM_BUILD_DIR}="'$LLVM_BUILD_DIR'"
-    eval ${CFG_LLVM_INST_DIR}="'$LLVM_INST_DIR'"
-done
-
-
 step_msg "writing configuration"
 
 putvar CFG_SRC_DIR
@@ -1916,15 +1086,8 @@ do
     putvar $CFG_LLVM_INST_DIR
 done
 
-if [ -z "$CFG_DISABLE_RUSTBUILD" ]
-then
-    INPUT_MAKEFILE=src/bootstrap/mk/Makefile.in
-else
-    INPUT_MAKEFILE=Makefile.in
-fi
-
 msg
-copy_if_changed ${CFG_SRC_DIR}${INPUT_MAKEFILE} ./Makefile
+copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile
 move_if_changed config.tmp config.mk
 rm -f config.tmp
 touch config.stamp
@@ -1941,22 +1104,5 @@ else
     X_PY=${CFG_SRC_DIR_RELATIVE}x.py
 fi
 
-if [ -z "$CFG_DISABLE_RUSTBUILD" ]; then
-    msg "NOTE you have now configured rust to use a rewritten build system"
-    msg "     called rustbuild, and as a result this may have bugs that "
-    msg "     you did not see before. If you experience any issues you can"
-    msg "     go back to the old build system with --disable-rustbuild and"
-    msg "     please feel free to report any bugs!"
-    msg ""
-    msg "run \`python ${X_PY} --help\`"
-else
-    warn "the makefile-based build system is deprecated in favor of rustbuild"
-    msg ""
-    msg "It is recommended you avoid passing --disable-rustbuild to get your"
-    msg "build working as the makefiles will be deleted on 2017-02-02. If you"
-    msg "encounter bugs with rustbuild please file issues against rust-lang/rust"
-    msg ""
-    msg "run \`make help\`"
-fi
-
+msg "run \`python ${X_PY} --help\`"
 msg
diff --git a/mk/cfg/aarch64-apple-ios.mk b/mk/cfg/aarch64-apple-ios.mk
deleted file mode 100644
index 5d822f1b1ab..00000000000
--- a/mk/cfg/aarch64-apple-ios.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# aarch64-apple-ios configuration
-CFG_SDK_NAME_aarch64-apple-ios := iphoneos
-CFG_SDK_ARCHS_aarch64-apple-ios := arm64
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_aarch64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_aarch64-apple-ios := -target aarch64-apple-darwin -isysroot $(CFG_IOS_SDK_aarch64-apple-ios) -mios-version-min=7.0 -arch arm64
-CC_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-LINK_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a
-CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_aarch64-apple-ios = 1
-CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM
-CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_JEMALLOC_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_GCCISH_CFLAGS_aarch64-apple-ios :=  -fPIC $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
-CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8
-CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios =
-CFG_EXE_SUFFIX_aarch64-apple-ios :=
-CFG_WINDOWSY_aarch64-apple-ios :=
-CFG_UNIXY_aarch64-apple-ios := 1
-CFG_LDPATH_aarch64-apple-ios :=
-CFG_RUN_aarch64-apple-ios = $(2)
-CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2))
-CFG_GNU_TRIPLE_aarch64-apple-ios := aarch64-apple-ios
diff --git a/mk/cfg/aarch64-linux-android.mk b/mk/cfg/aarch64-linux-android.mk
deleted file mode 100644
index 274f73834d4..00000000000
--- a/mk/cfg/aarch64-linux-android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# aarch64-linux-android configuration
-# CROSS_PREFIX_aarch64-linux-android-
-CC_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc
-CXX_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-g++
-CPP_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -E
-AR_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-ar
-CFG_LIB_NAME_aarch64-linux-android=lib$(1).so
-CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a
-CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_aarch64-linux-android=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_aarch64-linux-android := -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_aarch64-linux-android :=
-CFG_INSTALL_NAME_aarch64-linux-android =
-CFG_EXE_SUFFIX_aarch64-linux-android :=
-CFG_WINDOWSY_aarch64-linux-android :=
-CFG_UNIXY_aarch64-linux-android := 1
-CFG_LDPATH_aarch64-linux-android :=
-CFG_RUN_aarch64-linux-android=
-CFG_RUN_TARG_aarch64-linux-android=
-RUSTC_FLAGS_aarch64-linux-android :=
-RUSTC_CROSS_FLAGS_aarch64-linux-android :=
-CFG_GNU_TRIPLE_aarch64-linux-android := aarch64-linux-android
diff --git a/mk/cfg/aarch64-unknown-fuchsia.mk b/mk/cfg/aarch64-unknown-fuchsia.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/aarch64-unknown-fuchsia.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/aarch64-unknown-linux-gnu.mk b/mk/cfg/aarch64-unknown-linux-gnu.mk
deleted file mode 100644
index 6637423e495..00000000000
--- a/mk/cfg/aarch64-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# aarch64-unknown-linux-gnu configuration
-CROSS_PREFIX_aarch64-unknown-linux-gnu=aarch64-linux-gnu-
-CC_aarch64-unknown-linux-gnu=gcc
-CXX_aarch64-unknown-linux-gnu=g++
-CPP_aarch64-unknown-linux-gnu=gcc -E
-AR_aarch64-unknown-linux-gnu=ar
-CFG_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_aarch64-unknown-linux-gnu := -D__aarch64__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_aarch64-unknown-linux-gnu := -Wall -g -fPIC -D__aarch64__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_aarch64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_aarch64-unknown-linux-gnu := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_aarch64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_aarch64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_aarch64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_aarch64-unknown-linux-gnu :=
-CFG_WINDOWSY_aarch64-unknown-linux-gnu :=
-CFG_UNIXY_aarch64-unknown-linux-gnu := 1
-CFG_LDPATH_aarch64-unknown-linux-gnu :=
-CFG_RUN_aarch64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_aarch64-unknown-linux-gnu=$(call CFG_RUN_aarch64-unknown-linux-gnu,,$(2))
-RUSTC_FLAGS_aarch64-unknown-linux-gnu :=
-RUSTC_CROSS_FLAGS_aarch64-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_aarch64-unknown-linux-gnu := aarch64-unknown-linux-gnu
diff --git a/mk/cfg/arm-linux-androideabi.mk b/mk/cfg/arm-linux-androideabi.mk
deleted file mode 100644
index c084954f2e9..00000000000
--- a/mk/cfg/arm-linux-androideabi.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# arm-linux-androideabi configuration
-CC_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc
-CXX_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++
-CPP_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E
-AR_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar
-CFG_LIB_NAME_arm-linux-androideabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-linux-androideabi=lib$(1).a
-CFG_LIB_GLOB_arm-linux-androideabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-linux-androideabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_arm-linux-androideabi := -Wall -g -fPIC -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-linux-androideabi :=
-CFG_INSTALL_NAME_arm-linux-androideabi =
-CFG_EXE_SUFFIX_arm-linux-androideabi :=
-CFG_WINDOWSY_arm-linux-androideabi :=
-CFG_UNIXY_arm-linux-androideabi := 1
-CFG_LDPATH_arm-linux-androideabi :=
-CFG_RUN_arm-linux-androideabi=
-CFG_RUN_TARG_arm-linux-androideabi=
-RUSTC_FLAGS_arm-linux-androideabi :=
-RUSTC_CROSS_FLAGS_arm-linux-androideabi :=
-CFG_GNU_TRIPLE_arm-linux-androideabi := arm-linux-androideabi
diff --git a/mk/cfg/arm-unknown-linux-gnueabi.mk b/mk/cfg/arm-unknown-linux-gnueabi.mk
deleted file mode 100644
index f66ad04eefe..00000000000
--- a/mk/cfg/arm-unknown-linux-gnueabi.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-gnueabi configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi-
-CC_arm-unknown-linux-gnueabi=gcc
-CXX_arm-unknown-linux-gnueabi=g++
-CPP_arm-unknown-linux-gnueabi=gcc -E
-AR_arm-unknown-linux-gnueabi=ar
-CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
-CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
-CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=
-CFG_WINDOWSY_arm-unknown-linux-gnueabi :=
-CFG_UNIXY_arm-unknown-linux-gnueabi := 1
-CFG_LDPATH_arm-unknown-linux-gnueabi :=
-CFG_RUN_arm-unknown-linux-gnueabi=$(2)
-CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-gnueabi :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi :=
-CFG_GNU_TRIPLE_arm-unknown-linux-gnueabi := arm-unknown-linux-gnueabi
diff --git a/mk/cfg/arm-unknown-linux-gnueabihf.mk b/mk/cfg/arm-unknown-linux-gnueabihf.mk
deleted file mode 100644
index defe0dc3e70..00000000000
--- a/mk/cfg/arm-unknown-linux-gnueabihf.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-gnueabihf configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-
-CC_arm-unknown-linux-gnueabihf=gcc
-CXX_arm-unknown-linux-gnueabihf=g++
-CPP_arm-unknown-linux-gnueabihf=gcc -E
-AR_arm-unknown-linux-gnueabihf=ar
-CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-gnueabihf :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
-CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf :=
-CFG_WINDOWSY_arm-unknown-linux-gnueabihf :=
-CFG_UNIXY_arm-unknown-linux-gnueabihf := 1
-CFG_LDPATH_arm-unknown-linux-gnueabihf :=
-CFG_RUN_arm-unknown-linux-gnueabihf=$(2)
-CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-gnueabihf := -C target-feature=+v6,+vfp2
-RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf :=
-CFG_GNU_TRIPLE_arm-unknown-linux-gnueabihf := arm-unknown-linux-gnueabihf
diff --git a/mk/cfg/arm-unknown-linux-musleabi.mk b/mk/cfg/arm-unknown-linux-musleabi.mk
deleted file mode 100644
index 4d1438d592e..00000000000
--- a/mk/cfg/arm-unknown-linux-musleabi.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# arm-unknown-linux-musleabi configuration
-CROSS_PREFIX_arm-unknown-linux-musleabi=arm-linux-musleabi-
-CC_arm-unknown-linux-musleabi=gcc
-CXX_arm-unknown-linux-musleabi=g++
-CPP_arm-unknown-linux-musleabi=gcc -E
-AR_arm-unknown-linux-musleabi=ar
-CFG_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).so
-CFG_STATIC_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).a
-CFG_LIB_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-musleabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-musleabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CXXFLAGS_arm-unknown-linux-musleabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-musleabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_arm-unknown-linux-musleabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_arm-unknown-linux-musleabi :=
-CFG_INSTALL_NAME_arm-unknown-linux-musleabi =
-CFG_EXE_SUFFIX_arm-unknown-linux-musleabi :=
-CFG_WINDOWSY_arm-unknown-linux-musleabi :=
-CFG_UNIXY_arm-unknown-linux-musleabi := 1
-CFG_LDPATH_arm-unknown-linux-musleabi :=
-CFG_RUN_arm-unknown-linux-musleabi=$(2)
-CFG_RUN_TARG_arm-unknown-linux-musleabi=$(call CFG_RUN_arm-unknown-linux-musleabi,,$(2))
-RUSTC_FLAGS_arm-unknown-linux-musleabi :=
-RUSTC_CROSS_FLAGS_arm-unknown-linux-musleabi :=
-CFG_GNU_TRIPLE_arm-unknown-linux-musleabi := arm-unknown-linux-musleabi
diff --git a/mk/cfg/arm-unknown-linux-musleabihf.mk b/mk/cfg/arm-unknown-linux-musleabihf.mk
deleted file mode 100644
index 8120250150d..00000000000
--- a/mk/cfg/arm-unknown-linux-musleabihf.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
\ No newline at end of file
diff --git a/mk/cfg/armv5te-unknown-linux-gnueabi.mk b/mk/cfg/armv5te-unknown-linux-gnueabi.mk
deleted file mode 100644
index 98567a03c28..00000000000
--- a/mk/cfg/armv5te-unknown-linux-gnueabi.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# armv5-unknown-linux-gnueabi configuration
-CROSS_PREFIX_armv5te-unknown-linux-gnueabi=arm-linux-gnueabi-
-CC_armv5te-unknown-linux-gnueabi=gcc
-CXX_armv5te-unknown-linux-gnueabi=g++
-CPP_armv5te-unknown-linux-gnueabi=gcc -E
-AR_armv5te-unknown-linux-gnueabi=ar
-CFG_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).so
-CFG_STATIC_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).a
-CFG_LIB_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv5te-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft  $(CFLAGS) -march=armv5te -marm
-CFG_GCCISH_CFLAGS_armv5te-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv5te -marm
-CFG_GCCISH_CXXFLAGS_armv5te-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv5te-unknown-linux-gnueabi := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_armv5te-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv5te-unknown-linux-gnueabi :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabi =
-CFG_EXE_SUFFIX_armv5te-unknown-linux-gnueabi :=
-CFG_WINDOWSY_armv5te-unknown-linux-gnueabi :=
-CFG_UNIXY_armv5te-unknown-linux-gnueabi := 1
-CFG_LDPATH_armv5te-unknown-linux-gnueabi :=
-CFG_RUN_armv5te-unknown-linux-gnueabi=$(2)
-CFG_RUN_TARG_armv5te-unknown-linux-gnueabi=$(call CFG_RUN_armv5te-unknown-linux-gnueabi,,$(2))
-RUSTC_FLAGS_armv5te-unknown-linux-gnueabi :=
-RUSTC_CROSS_FLAGS_armv5te-unknown-linux-gnueabi :=
-CFG_GNU_TRIPLE_armv5te-unknown-linux-gnueabi := armv5te-unknown-linux-gnueabi
diff --git a/mk/cfg/armv7-apple-ios.mk b/mk/cfg/armv7-apple-ios.mk
deleted file mode 100644
index 34ca4de6563..00000000000
--- a/mk/cfg/armv7-apple-ios.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# armv7-apple-ios configuration
-CFG_SDK_NAME_armv7-apple-ios := iphoneos
-CFG_SDK_ARCHS_armv7-apple-ios := armv7
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_armv7-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_armv7-apple-ios := -target armv7-apple-ios -isysroot $(CFG_IOS_SDK_armv7-apple-ios) -mios-version-min=7.0
-CC_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_armv7-apple-ios = lib$(1).a
-CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_armv7-apple-ios = 1
-CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios)
-CFG_GCCISH_CFLAGS_armv7-apple-ios :=  -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -mfpu=vfp3 -arch armv7
-CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm
-CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_armv7-apple-ios :=
-CFG_WINDOWSY_armv7-apple-ios :=
-CFG_UNIXY_armv7-apple-ios := 1
-CFG_LDPATH_armv7-apple-ios :=
-CFG_RUN_armv7-apple-ios = $(2)
-CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2))
-CFG_GNU_TRIPLE_armv7-apple-ios := armv7-apple-ios
diff --git a/mk/cfg/armv7-linux-androideabi.mk b/mk/cfg/armv7-linux-androideabi.mk
deleted file mode 100644
index e5bf2e4df7a..00000000000
--- a/mk/cfg/armv7-linux-androideabi.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# armv7-linux-androideabi configuration
-CC_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc
-CXX_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++
-CPP_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E
-AR_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar
-CFG_LIB_NAME_armv7-linux-androideabi=lib$(1).so
-CFG_STATIC_LIB_NAME_armv7-linux-androideabi=lib$(1).a
-CFG_LIB_GLOB_armv7-linux-androideabi=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv7-linux-androideabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_armv7-linux-androideabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=softfp -march=armv7-a -mfpu=vfpv3-d16 -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_armv7-linux-androideabi := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv7-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_armv7-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv7-linux-androideabi :=
-CFG_INSTALL_NAME_armv7-linux-androideabi =
-CFG_EXE_SUFFIX_armv7-linux-androideabi :=
-CFG_WINDOWSY_armv7-linux-androideabi :=
-CFG_UNIXY_armv7-linux-androideabi := 1
-CFG_LDPATH_armv7-linux-androideabi :=
-CFG_RUN_armv7-linux-androideabi=
-CFG_RUN_TARG_armv7-linux-androideabi=
-RUSTC_FLAGS_armv7-linux-androideabi :=
-RUSTC_CROSS_FLAGS_armv7-linux-androideabi :=
-CFG_GNU_TRIPLE_armv7-linux-androideabi := arm-linux-androideabi
diff --git a/mk/cfg/armv7-unknown-linux-gnueabihf.mk b/mk/cfg/armv7-unknown-linux-gnueabihf.mk
deleted file mode 100644
index a8e39668ded..00000000000
--- a/mk/cfg/armv7-unknown-linux-gnueabihf.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# armv7-unknown-linux-gnueabihf configuration
-CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf-
-CC_armv7-unknown-linux-gnueabihf=gcc
-CXX_armv7-unknown-linux-gnueabihf=g++
-CPP_armv7-unknown-linux-gnueabihf=gcc -E
-AR_armv7-unknown-linux-gnueabihf=ar
-CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so
-CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a
-CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7-a
-CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7-a
-CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g
-CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_armv7-unknown-linux-gnueabihf :=
-CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
-CFG_EXE_SUFFIX_armv7-unknown-linux-gnueabihf :=
-CFG_WINDOWSY_armv7-unknown-linux-gnueabihf :=
-CFG_UNIXY_armv7-unknown-linux-gnueabihf := 1
-CFG_LDPATH_armv7-unknown-linux-gnueabihf :=
-CFG_RUN_armv7-unknown-linux-gnueabihf=$(2)
-CFG_RUN_TARG_armv7-unknown-linux-gnueabihf=$(call CFG_RUN_armv7-unknown-linux-gnueabihf,,$(2))
-RUSTC_FLAGS_armv7-unknown-linux-gnueabihf :=
-RUSTC_CROSS_FLAGS_armv7-unknown-linux-gnueabihf :=
-CFG_GNU_TRIPLE_armv7-unknown-linux-gnueabihf := armv7-unknown-linux-gnueabihf
diff --git a/mk/cfg/armv7-unknown-linux-musleabihf.mk b/mk/cfg/armv7-unknown-linux-musleabihf.mk
deleted file mode 100644
index 8120250150d..00000000000
--- a/mk/cfg/armv7-unknown-linux-musleabihf.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
\ No newline at end of file
diff --git a/mk/cfg/armv7s-apple-ios.mk b/mk/cfg/armv7s-apple-ios.mk
deleted file mode 100644
index 6da7905a700..00000000000
--- a/mk/cfg/armv7s-apple-ios.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# armv7s-apple-ios configuration
-CFG_SDK_NAME_armv7s-apple-ios := iphoneos
-CFG_SDK_ARCHS_armv7s-apple-ios := armv7s
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOS_SDK_armv7s-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
-CFG_IOS_SDK_FLAGS_armv7s-apple-ios := -target armv7s-apple-ios -isysroot $(CFG_IOS_SDK_armv7s-apple-ios) -mios-version-min=7.0
-CC_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
-CXX_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-CPP_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
-AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
-endif
-CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a
-CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1
-CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM
-CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)
-CFG_GCCISH_CFLAGS_armv7s-apple-ios :=  -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -arch armv7s
-CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind
-CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon
-CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_armv7s-apple-ios :=
-CFG_WINDOWSY_armv7s-apple-ios :=
-CFG_UNIXY_armv7s-apple-ios := 1
-CFG_LDPATH_armv7s-apple-ios :=
-CFG_RUN_armv7s-apple-ios = $(2)
-CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2))
-CFG_GNU_TRIPLE_armv7s-apple-ios := armv7s-apple-ios
diff --git a/mk/cfg/asmjs-unknown-emscripten.mk b/mk/cfg/asmjs-unknown-emscripten.mk
deleted file mode 100644
index a98a51b06b5..00000000000
--- a/mk/cfg/asmjs-unknown-emscripten.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# asmjs-unknown-emscripten configuration
-CC_asmjs-unknown-emscripten=emcc
-CXX_asmjs-unknown-emscripten=em++
-CPP_asmjs-unknown-emscripten=$(CPP)
-AR_asmjs-unknown-emscripten=emar
-CFG_LIB_NAME_asmjs-unknown-emscripten=lib$(1).so
-CFG_STATIC_LIB_NAME_asmjs-unknown-emscripten=lib$(1).a
-CFG_LIB_GLOB_asmjs-unknown-emscripten=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_asmjs-unknown-emscripten=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_asmjs-unknown-emscripten := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_asmjs-unknown-emscripten :=  -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_asmjs-unknown-emscripten := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_asmjs-unknown-emscripten := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_asmjs-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_asmjs-unknown-emscripten :=
-CFG_INSTALL_NAME_asmjs-unknown-emscripten =
-CFG_EXE_SUFFIX_asmjs-unknown-emscripten =
-CFG_WINDOWSY_asmjs-unknown-emscripten :=
-CFG_UNIXY_asmjs-unknown-emscripten := 1
-CFG_LDPATH_asmjs-unknown-emscripten :=
-CFG_RUN_asmjs-unknown-emscripten=$(2)
-CFG_RUN_TARG_asmjs-unknown-emscripten=$(call CFG_RUN_asmjs-unknown-emscripten,,$(2))
-CFG_GNU_TRIPLE_asmjs-unknown-emscripten := asmjs-unknown-emscripten
-CFG_DISABLE_JEMALLOC_asmjs-unknown-emscripten := 1
diff --git a/mk/cfg/i386-apple-ios.mk b/mk/cfg/i386-apple-ios.mk
deleted file mode 100644
index bfb7fa281f2..00000000000
--- a/mk/cfg/i386-apple-ios.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# i386-apple-ios configuration
-CFG_SDK_NAME_i386-apple-ios := iphonesimulator
-CFG_SDK_ARCHS_i386-apple-ios := i386
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOSSIM_SDK_i386-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
-CFG_IOSSIM_FLAGS_i386-apple-ios := -m32 -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK_i386-apple-ios) -mios-simulator-version-min=7.0
-CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
-CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-AR_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
-endif
-CFG_LIB_NAME_i386-apple-ios = lib$(1).a
-CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib
-CFG_INSTALL_ONLY_RLIB_i386-apple-ios = 1
-CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM
-CFG_GCCISH_CFLAGS_i386-apple-ios :=  -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios)
-CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios)
-CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_i386-apple-ios =
-CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_i386-apple-ios :=
-CFG_WINDOWSY_i386-apple-ios :=
-CFG_UNIXY_i386-apple-ios := 1
-CFG_LDPATH_i386-apple-ios =
-CFG_RUN_i386-apple-ios = $(2)
-CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2))
-CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS_i386-apple-ios) -target i386-apple-ios #-Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -Wl,-no_compact_unwind
-CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios
diff --git a/mk/cfg/i586-pc-windows-msvc.mk b/mk/cfg/i586-pc-windows-msvc.mk
deleted file mode 100644
index 48f1ecec3a7..00000000000
--- a/mk/cfg/i586-pc-windows-msvc.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# i586-pc-windows-msvc configuration
-CC_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-LINK_i586-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
-CXX_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-CPP_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-AR_i586-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
-CFG_LIB_NAME_i586-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_i586-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_i586-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_i586-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i586-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
-CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
-CFG_GCCISH_LINK_FLAGS_i586-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_i586-pc-windows-msvc :=
-CFG_LLC_FLAGS_i586-pc-windows-msvc :=
-CFG_INSTALL_NAME_i586-pc-windows-msvc =
-CFG_EXE_SUFFIX_i586-pc-windows-msvc := .exe
-CFG_WINDOWSY_i586-pc-windows-msvc := 1
-CFG_UNIXY_i586-pc-windows-msvc :=
-CFG_LDPATH_i586-pc-windows-msvc :=
-CFG_RUN_i586-pc-windows-msvc=$(2)
-CFG_RUN_TARG_i586-pc-windows-msvc=$(call CFG_RUN_i586-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_i586-pc-windows-msvc := i586-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_i586-pc-windows-msvc := 1
diff --git a/mk/cfg/i586-unknown-linux-gnu.mk b/mk/cfg/i586-unknown-linux-gnu.mk
deleted file mode 100644
index fa2909196dc..00000000000
--- a/mk/cfg/i586-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# i586-unknown-linux-gnu configuration
-CC_i586-unknown-linux-gnu=$(CC)
-CXX_i586-unknown-linux-gnu=$(CXX)
-CPP_i586-unknown-linux-gnu=$(CPP)
-AR_i586-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -march=pentium
-CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i586-unknown-linux-gnu :=
-CFG_INSTALL_NAME_i586-unknown-linux-gnu =
-CFG_EXE_SUFFIX_i586-unknown-linux-gnu =
-CFG_WINDOWSY_i586-unknown-linux-gnu :=
-CFG_UNIXY_i586-unknown-linux-gnu := 1
-CFG_LDPATH_i586-unknown-linux-gnu :=
-CFG_RUN_i586-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_i586-unknown-linux-gnu=$(call CFG_RUN_i586-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_i586-unknown-linux-gnu := i586-unknown-linux-gnu
diff --git a/mk/cfg/i686-apple-darwin.mk b/mk/cfg/i686-apple-darwin.mk
deleted file mode 100644
index e4b3431e8b6..00000000000
--- a/mk/cfg/i686-apple-darwin.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# i686-apple-darwin configuration
-CC_i686-apple-darwin=$(CC)
-CXX_i686-apple-darwin=$(CXX)
-CPP_i686-apple-darwin=$(CPP)
-AR_i686-apple-darwin=$(AR)
-CFG_LIB_NAME_i686-apple-darwin=lib$(1).dylib
-CFG_STATIC_LIB_NAME_i686-apple-darwin=lib$(1).a
-CFG_LIB_GLOB_i686-apple-darwin=lib$(1)-*.dylib
-CFG_LIB_DSYM_GLOB_i686-apple-darwin=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-apple-darwin := -m32 -arch i386 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-apple-darwin :=  -g -fPIC -m32 -arch i386 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-apple-darwin := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-apple-darwin := -dynamiclib -pthread  -framework CoreServices -m32
-CFG_GCCISH_DEF_FLAG_i686-apple-darwin := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_i686-apple-darwin :=
-CFG_INSTALL_NAME_i686-apple-darwin = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_i686-apple-darwin :=
-CFG_WINDOWSY_i686-apple-darwin :=
-CFG_UNIXY_i686-apple-darwin := 1
-CFG_LDPATH_i686-apple-darwin :=
-CFG_RUN_i686-apple-darwin=$(2)
-CFG_RUN_TARG_i686-apple-darwin=$(call CFG_RUN_i686-apple-darwin,,$(2))
-CFG_GNU_TRIPLE_i686-apple-darwin := i686-apple-darwin
diff --git a/mk/cfg/i686-linux-android.mk b/mk/cfg/i686-linux-android.mk
deleted file mode 100644
index 2843a8e9be5..00000000000
--- a/mk/cfg/i686-linux-android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# i686-linux-android configuration
-CC_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc
-CXX_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-g++
-CPP_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -E
-AR_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-ar
-CFG_LIB_NAME_i686-linux-android=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-linux-android=lib$(1).a
-CFG_LIB_GLOB_i686-linux-android=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-linux-android=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-linux-android := -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-linux-android := -Wall -g -fPIC -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-linux-android := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
-CFG_GCCISH_DEF_FLAG_i686-linux-android := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-linux-android :=
-CFG_INSTALL_NAME_i686-linux-android =
-CFG_EXE_SUFFIX_i686-linux-android :=
-CFG_WINDOWSY_i686-linux-android :=
-CFG_UNIXY_i686-linux-android := 1
-CFG_LDPATH_i686-linux-android :=
-CFG_RUN_i686-linux-android=
-CFG_RUN_TARG_i686-linux-android=
-RUSTC_FLAGS_i686-linux-android :=
-RUSTC_CROSS_FLAGS_i686-linux-android :=
-CFG_GNU_TRIPLE_i686-linux-android := i686-linux-android
diff --git a/mk/cfg/i686-pc-windows-gnu.mk b/mk/cfg/i686-pc-windows-gnu.mk
deleted file mode 100644
index 50c2b8c98ac..00000000000
--- a/mk/cfg/i686-pc-windows-gnu.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# i686-pc-windows-gnu configuration
-CROSS_PREFIX_i686-pc-windows-gnu=i686-w64-mingw32-
-CC_i686-pc-windows-gnu=gcc
-CXX_i686-pc-windows-gnu=g++
-CPP_i686-pc-windows-gnu=gcc -E
-AR_i686-pc-windows-gnu=ar
-CFG_LIB_NAME_i686-pc-windows-gnu=$(1).dll
-CFG_STATIC_LIB_NAME_i686-pc-windows-gnu=$(1).lib
-CFG_LIB_GLOB_i686-pc-windows-gnu=$(1)-*.dll
-CFG_LIB_DSYM_GLOB_i686-pc-windows-gnu=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-pc-windows-gnu := -march=i686 -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-pc-windows-gnu :=  -g -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-pc-windows-gnu := -shared -g -m32
-CFG_GCCISH_DEF_FLAG_i686-pc-windows-gnu :=
-CFG_LLC_FLAGS_i686-pc-windows-gnu :=
-CFG_INSTALL_NAME_i686-pc-windows-gnu =
-CFG_EXE_SUFFIX_i686-pc-windows-gnu := .exe
-CFG_WINDOWSY_i686-pc-windows-gnu := 1
-CFG_UNIXY_i686-pc-windows-gnu :=
-CFG_LDPATH_i686-pc-windows-gnu :=
-CFG_RUN_i686-pc-windows-gnu=$(2)
-CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2))
-CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
-CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
-CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
-CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1
diff --git a/mk/cfg/i686-pc-windows-msvc.mk b/mk/cfg/i686-pc-windows-msvc.mk
deleted file mode 100644
index b0289b9892e..00000000000
--- a/mk/cfg/i686-pc-windows-msvc.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# i686-pc-windows-msvc configuration
-CC_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-LINK_i686-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
-CXX_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-CPP_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
-AR_i686-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
-CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc :=
-CFG_LLC_FLAGS_i686-pc-windows-msvc :=
-CFG_INSTALL_NAME_i686-pc-windows-msvc =
-CFG_EXE_SUFFIX_i686-pc-windows-msvc := .exe
-CFG_WINDOWSY_i686-pc-windows-msvc := 1
-CFG_UNIXY_i686-pc-windows-msvc :=
-CFG_LDPATH_i686-pc-windows-msvc :=
-CFG_RUN_i686-pc-windows-msvc=$(2)
-CFG_RUN_TARG_i686-pc-windows-msvc=$(call CFG_RUN_i686-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_i686-pc-windows-msvc := i686-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_i686-pc-windows-msvc := 1
diff --git a/mk/cfg/i686-unknown-freebsd.mk b/mk/cfg/i686-unknown-freebsd.mk
deleted file mode 100644
index a9d4446d5d4..00000000000
--- a/mk/cfg/i686-unknown-freebsd.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# i686-unknown-freebsd configuration
-CC_i686-unknown-freebsd=$(CC)
-CXX_i686-unknown-freebsd=$(CXX)
-CPP_i686-unknown-freebsd=$(CPP)
-AR_i686-unknown-freebsd=$(AR)
-CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-freebsd :=  -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt
-CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-freebsd :=
-CFG_INSTALL_NAME_i686-unknown-freebsd =
-CFG_EXE_SUFFIX_i686-unknown-freebsd :=
-CFG_WINDOWSY_i686-unknown-freebsd :=
-CFG_UNIXY_i686-unknown-freebsd := 1
-CFG_LDPATH_i686-unknown-freebsd :=
-CFG_RUN_i686-unknown-freebsd=$(2)
-CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd
diff --git a/mk/cfg/i686-unknown-haiku.mk b/mk/cfg/i686-unknown-haiku.mk
deleted file mode 100644
index cbacbff070e..00000000000
--- a/mk/cfg/i686-unknown-haiku.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# i686-unknown-haiku configuration
-CROSS_PREFIX_i686-unknown-haiku=i586-pc-haiku-
-CC_i686-unknown-haiku=$(CC)
-CXX_i686-unknown-haiku=$(CXX)
-CPP_i686-unknown-haiku=$(CPP)
-AR_i686-unknown-haiku=$(AR)
-CFG_LIB_NAME_i686-unknown-haiku=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-haiku=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-haiku=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-haiku=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_i686-unknown-haiku := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-haiku := -Wall -Werror -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_i686-unknown-haiku := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-haiku := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-haiku := -Wl,-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-haiku := -Wl,-no-whole-archive
-CFG_DEF_SUFFIX_i686-unknown-haiku := .linux.def
-CFG_LLC_FLAGS_i686-unknown-haiku :=
-CFG_INSTALL_NAME_i686-unknown-haiku =
-CFG_EXE_SUFFIX_i686-unknown-haiku =
-CFG_WINDOWSY_i686-unknown-haiku :=
-CFG_UNIXY_i686-unknown-haiku := 1
-CFG_PATH_MUNGE_i686-unknown-haiku := true
-CFG_LDPATH_i686-unknown-haiku :=
-CFG_RUN_i686-unknown-haiku=$(2)
-CFG_RUN_TARG_i686-unknown-haiku=$(call CFG_RUN_i686-unknown-haiku,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-haiku := i686-unknown-haiku
diff --git a/mk/cfg/i686-unknown-linux-gnu.mk b/mk/cfg/i686-unknown-linux-gnu.mk
deleted file mode 100644
index 9e2312008a1..00000000000
--- a/mk/cfg/i686-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# i686-unknown-linux-gnu configuration
-CC_i686-unknown-linux-gnu=$(CC)
-CXX_i686-unknown-linux-gnu=$(CXX)
-CPP_i686-unknown-linux-gnu=$(CPP)
-AR_i686-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_i686-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-linux-gnu := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS) -march=i686
-CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-linux-gnu :=
-CFG_INSTALL_NAME_i686-unknown-linux-gnu =
-CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
-CFG_WINDOWSY_i686-unknown-linux-gnu :=
-CFG_UNIXY_i686-unknown-linux-gnu := 1
-CFG_LDPATH_i686-unknown-linux-gnu :=
-CFG_RUN_i686-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-linux-gnu := i686-unknown-linux-gnu
diff --git a/mk/cfg/i686-unknown-linux-musl.mk b/mk/cfg/i686-unknown-linux-musl.mk
deleted file mode 100644
index d6c1ce8967a..00000000000
--- a/mk/cfg/i686-unknown-linux-musl.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# i686-unknown-linux-musl configuration
-CC_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
-CXX_i686-unknown-linux-musl=$(CXX)
-CPP_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
-AR_i686-unknown-linux-musl=$(AR)
-CFG_INSTALL_ONLY_RLIB_i686-unknown-linux-musl = 1
-CFG_LIB_NAME_i686-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-linux-musl=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_i686-unknown-linux-musl :=  -g -fPIC -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_i686-unknown-linux-musl :=
-CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-musl :=
-CFG_GCCISH_DEF_FLAG_i686-unknown-linux-musl :=
-CFG_LLC_FLAGS_i686-unknown-linux-musl :=
-CFG_INSTALL_NAME_i686-unknown-linux-musl =
-CFG_EXE_SUFFIX_i686-unknown-linux-musl =
-CFG_WINDOWSY_i686-unknown-linux-musl :=
-CFG_UNIXY_i686-unknown-linux-musl := 1
-CFG_LDPATH_i686-unknown-linux-musl :=
-CFG_RUN_i686-unknown-linux-musl=$(2)
-CFG_RUN_TARG_i686-unknown-linux-musl=$(call CFG_RUN_i686-unknown-linux-musl,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-linux-musl := i686-unknown-linux-musl
-CFG_THIRD_PARTY_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o
-CFG_INSTALLED_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o
-
-NATIVE_DEPS_libc_T_i686-unknown-linux-musl += libc.a
-NATIVE_DEPS_std_T_i686-unknown-linux-musl += crt1.o crti.o crtn.o
-NATIVE_DEPS_unwind_T_i686-unknown-linux-musl += libunwind.a
diff --git a/mk/cfg/i686-unknown-openbsd.mk b/mk/cfg/i686-unknown-openbsd.mk
deleted file mode 100644
index b839937c976..00000000000
--- a/mk/cfg/i686-unknown-openbsd.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# i686-unknown-openbsd configuration
-CC_i686-unknown-openbsd=$(CC)
-CXX_i686-unknown-openbsd=$(CXX)
-CPP_i686-unknown-openbsd=$(CPP)
-AR_i686-unknown-openbsd=$(AR)
-CFG_LIB_NAME_i686-unknown-openbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_i686-unknown-openbsd=lib$(1).a
-CFG_LIB_GLOB_i686-unknown-openbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_i686-unknown-openbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_i686-unknown-openbsd := -m32 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_i686-unknown-openbsd :=  -g -fPIC -m32 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_i686-unknown-openbsd := -shared -fPIC -g -pthread -m32
-CFG_GCCISH_DEF_FLAG_i686-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_i686-unknown-openbsd :=
-CFG_INSTALL_NAME_i686-unknown-openbsd =
-CFG_EXE_SUFFIX_i686-unknown-openbsd :=
-CFG_WINDOWSY_i686-unknown-openbsd :=
-CFG_UNIXY_i686-unknown-openbsd := 1
-CFG_LDPATH_i686-unknown-openbsd :=
-CFG_RUN_i686-unknown-openbsd=$(2)
-CFG_RUN_TARG_i686-unknown-openbsd=$(call CFG_RUN_i686-unknown-openbsd,,$(2))
-CFG_GNU_TRIPLE_i686-unknown-openbsd := i686-unknown-openbsd
-RUSTC_FLAGS_i686-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))
-CFG_DISABLE_JEMALLOC_i686-unknown-openbsd := 1
diff --git a/mk/cfg/le32-unknown-nacl.mk b/mk/cfg/le32-unknown-nacl.mk
deleted file mode 100644
index a7336729174..00000000000
--- a/mk/cfg/le32-unknown-nacl.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# le32-unknown-nacl (portable, PNaCl)
-ifneq ($(CFG_NACL_CROSS_PATH),)
-
-CC_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool cc)
-CXX_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool c++)
-CPP_le32-unknown-nacl=$(CXX_le32-unknown-nacl) -E
-AR_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool ar)
-
-CFG_PNACL_TOOLCHAIN := $(abspath $(dir $(AR_le32-unknown-nacl)/../))
-
-# Note: pso's aren't supported by PNaCl.
-CFG_LIB_NAME_le32-unknown-nacl=lib$(1).pso
-CFG_STATIC_LIB_NAME_le32-unknown-nacl=lib$(1).a
-CFG_LIB_GLOB_le32-unknown-nacl=lib$(1)-*.pso
-CFG_LIB_DSYM_GLOB_le32-unknown-nacl=lib$(1)-*.dylib.dSYM
-CFG_GCCISH_CFLAGS_le32-unknown-nacl := -Wall -Wno-unused-variable -Wno-unused-value $(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --cflags) -D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0
-CFG_GCCISH_CXXFLAGS_le32-unknown-nacl := -stdlib=libc++ $(CFG_GCCISH_CFLAGS_le32-unknown-nacl)
-CFG_GCCISH_LINK_FLAGS_le32-unknown-nacl := -static -pthread -lm
-CFG_GCCISH_DEF_FLAG_le32-unknown-nacl := -Wl,--export-dynamic,--dynamic-list=
-CFG_GCCISH_PRE_LIB_FLAGS_le32-unknown-nacl := -Wl,-no-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_le32-unknown-nacl :=
-CFG_DEF_SUFFIX_le32-unknown-nacl := .le32.nacl.def
-CFG_INSTALL_NAME_le32-unknown-nacl =
-CFG_EXE_SUFFIX_le32-unknown-nacl = .pexe
-CFG_WINDOWSY_le32-unknown-nacl :=
-CFG_UNIXY_le32-unknown-nacl := 1
-CFG_NACLY_le32-unknown-nacl := 1
-CFG_PATH_MUNGE_le32-unknown-nacl := true
-CFG_LDPATH_le32-unknown-nacl :=
-CFG_RUN_le32-unknown-nacl=$(2)
-CFG_RUN_TARG_le32-unknown-nacl=$(call CFG_RUN_le32-unknown-nacl,,$(2))
-RUSTC_FLAGS_le32-unknown-nacl:=
-RUSTC_CROSS_FLAGS_le32-unknown-nacl=-L $(CFG_NACL_CROSS_PATH)/lib/pnacl/Release -L $(CFG_PNACL_TOOLCHAIN)/lib/clang/3.7.0/lib/le32-nacl -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/usr/lib -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/lib
-CFG_GNU_TRIPLE_le32-unknown-nacl := le32-unknown-nacl
-
-# strdup isn't defined unless -std=gnu++11 is used :/
-LLVM_FILTER_CXXFLAGS_le32-unknown-nacl := -std=c++11
-LLVM_EXTRA_CXXFLAGS_le32-unknown-nacl := -std=gnu++11
-
-endif
diff --git a/mk/cfg/mips-unknown-linux-gnu.mk b/mk/cfg/mips-unknown-linux-gnu.mk
deleted file mode 100644
index 0783a4c17a4..00000000000
--- a/mk/cfg/mips-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# mips-unknown-linux-gnu configuration
-CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
-CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++
-CPP_mips-unknown-linux-gnu=mips-linux-gnu-gcc -E
-AR_mips-unknown-linux-gnu=mips-linux-gnu-ar
-CFG_LIB_NAME_mips-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_mips-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_mips-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mips-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mips-unknown-linux-gnu := -mips32r2 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -mabi=32
-CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mips-unknown-linux-gnu :=
-CFG_INSTALL_NAME_mips-unknown-linux-gnu =
-CFG_EXE_SUFFIX_mips-unknown-linux-gnu :=
-CFG_WINDOWSY_mips-unknown-linux-gnu :=
-CFG_UNIXY_mips-unknown-linux-gnu := 1
-CFG_LDPATH_mips-unknown-linux-gnu :=
-CFG_RUN_mips-unknown-linux-gnu=
-CFG_RUN_TARG_mips-unknown-linux-gnu=
-RUSTC_FLAGS_mips-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_mips-unknown-linux-gnu := mips-unknown-linux-gnu
diff --git a/mk/cfg/mips-unknown-linux-musl.mk b/mk/cfg/mips-unknown-linux-musl.mk
deleted file mode 100644
index 33528b986f6..00000000000
--- a/mk/cfg/mips-unknown-linux-musl.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# mips-unknown-linux-musl configuration
-CC_mips-unknown-linux-musl=mips-linux-musl-gcc
-CXX_mips-unknown-linux-musl=mips-linux-musl-g++
-CPP_mips-unknown-linux-musl=mips-linux-musl-gcc -E
-AR_mips-unknown-linux-musl=mips-linux-musl-ar
-CFG_LIB_NAME_mips-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_mips-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_mips-unknown-linux-musl=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mips-unknown-linux-musl=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mips-unknown-linux-musl := -mips32r2 -msoft-float -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mips-unknown-linux-musl := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mips-unknown-linux-musl := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-musl := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32
-CFG_GCCISH_DEF_FLAG_mips-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mips-unknown-linux-musl :=
-CFG_INSTALL_NAME_mips-unknown-linux-musl =
-CFG_EXE_SUFFIX_mips-unknown-linux-musl =
-CFG_WINDOWSY_mips-unknown-linux-musl :=
-CFG_UNIXY_mips-unknown-linux-musl := 1
-CFG_LDPATH_mips-unknown-linux-musl :=
-CFG_RUN_mips-unknown-linux-musl=
-CFG_RUN_TARG_mips-unknown-linux-musl=
-RUSTC_FLAGS_mips-unknown-linux-musl :=
-CFG_GNU_TRIPLE_mips-unknown-linux-musl := mips-unknown-linux-musl
diff --git a/mk/cfg/mips-unknown-linux-uclibc.mk b/mk/cfg/mips-unknown-linux-uclibc.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/mips-unknown-linux-uclibc.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mips64-unknown-linux-gnuabi64.mk b/mk/cfg/mips64-unknown-linux-gnuabi64.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/mips64-unknown-linux-gnuabi64.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mips64el-unknown-linux-gnuabi64.mk b/mk/cfg/mips64el-unknown-linux-gnuabi64.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/mips64el-unknown-linux-gnuabi64.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/mipsel-unknown-linux-gnu.mk b/mk/cfg/mipsel-unknown-linux-gnu.mk
deleted file mode 100644
index f15a086b64e..00000000000
--- a/mk/cfg/mipsel-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# mipsel-unknown-linux-gnu configuration
-CC_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc
-CXX_mipsel-unknown-linux-gnu=mipsel-linux-gnu-g++
-CPP_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc
-AR_mipsel-unknown-linux-gnu=mipsel-linux-gnu-ar
-CFG_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-gnu := -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mipsel-unknown-linux-gnu := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-gnu := -shared -fPIC -g -mips32
-CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mipsel-unknown-linux-gnu :=
-CFG_INSTALL_NAME_mipsel-unknown-linux-gnu =
-CFG_EXE_SUFFIX_mipsel-unknown-linux-gnu :=
-CFG_WINDOWSY_mipsel-unknown-linux-gnu :=
-CFG_UNIXY_mipsel-unknown-linux-gnu := 1
-CFG_LDPATH_mipsel-unknown-linux-gnu :=
-CFG_RUN_mipsel-unknown-linux-gnu=
-CFG_RUN_TARG_mipsel-unknown-linux-gnu=
-RUSTC_FLAGS_mipsel-unknown-linux-gnu :=
-CFG_GNU_TRIPLE_mipsel-unknown-linux-gnu := mipsel-unknown-linux-gnu
diff --git a/mk/cfg/mipsel-unknown-linux-musl.mk b/mk/cfg/mipsel-unknown-linux-musl.mk
deleted file mode 100644
index db836b81c5f..00000000000
--- a/mk/cfg/mipsel-unknown-linux-musl.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# mipsel-unknown-linux-musl configuration
-CC_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc
-CXX_mipsel-unknown-linux-musl=mipsel-linux-musl-g++
-CPP_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc
-AR_mipsel-unknown-linux-musl=mipsel-linux-musl-ar
-CFG_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-musl := -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_mipsel-unknown-linux-musl := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-musl := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-musl := -shared -fPIC -g -mips32
-CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_mipsel-unknown-linux-musl :=
-CFG_INSTALL_NAME_mipsel-unknown-linux-musl =
-CFG_EXE_SUFFIX_mipsel-unknown-linux-musl :=
-CFG_WINDOWSY_mipsel-unknown-linux-musl :=
-CFG_UNIXY_mipsel-unknown-linux-musl := 1
-CFG_LDPATH_mipsel-unknown-linux-musl :=
-CFG_RUN_mipsel-unknown-linux-musl=
-CFG_RUN_TARG_mipsel-unknown-linux-musl=
-RUSTC_FLAGS_mipsel-unknown-linux-musl :=
-CFG_GNU_TRIPLE_mipsel-unknown-linux-musl := mipsel-unknown-linux-musl
diff --git a/mk/cfg/mipsel-unknown-linux-uclibc.mk b/mk/cfg/mipsel-unknown-linux-uclibc.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/mipsel-unknown-linux-uclibc.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/powerpc-unknown-linux-gnu.mk b/mk/cfg/powerpc-unknown-linux-gnu.mk
deleted file mode 100644
index 9c5720de4b3..00000000000
--- a/mk/cfg/powerpc-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# powerpc-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc-unknown-linux-gnu=powerpc-linux-gnu-
-CC_powerpc-unknown-linux-gnu=$(CC)
-CXX_powerpc-unknown-linux-gnu=$(CXX)
-CPP_powerpc-unknown-linux-gnu=$(CPP)
-AR_powerpc-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_powerpc-unknown-linux-gnu := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc-unknown-linux-gnu :=  -g -fPIC -m32 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m32
-CFG_GCCISH_DEF_FLAG_powerpc-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc-unknown-linux-gnu :=
-CFG_UNIXY_powerpc-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc-unknown-linux-gnu :=
-CFG_RUN_powerpc-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc-unknown-linux-gnu=$(call CFG_RUN_powerpc-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc-unknown-linux-gnu := powerpc-unknown-linux-gnu
diff --git a/mk/cfg/powerpc64-unknown-linux-gnu.mk b/mk/cfg/powerpc64-unknown-linux-gnu.mk
deleted file mode 100644
index 389bb6f0cab..00000000000
--- a/mk/cfg/powerpc64-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# powerpc64-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc-linux-gnu-
-CC_powerpc64-unknown-linux-gnu=$(CC)
-CXX_powerpc64-unknown-linux-gnu=$(CXX)
-CPP_powerpc64-unknown-linux-gnu=$(CPP)
-AR_powerpc64-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64
-CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc64-unknown-linux-gnu :=
-CFG_UNIXY_powerpc64-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc64-unknown-linux-gnu :=
-CFG_RUN_powerpc64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu
diff --git a/mk/cfg/powerpc64le-unknown-linux-gnu.mk b/mk/cfg/powerpc64le-unknown-linux-gnu.mk
deleted file mode 100644
index 6884fa11e74..00000000000
--- a/mk/cfg/powerpc64le-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# powerpc64le-unknown-linux-gnu configuration
-CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu-
-CC_powerpc64le-unknown-linux-gnu=$(CC)
-CXX_powerpc64le-unknown-linux-gnu=$(CXX)
-CPP_powerpc64le-unknown-linux-gnu=$(CPP)
-AR_powerpc64le-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu :=
-CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu =
-CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu =
-CFG_WINDOWSY_powerpc64le-unknown-linux-gnu :=
-CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1
-CFG_LDPATH_powerpc64le-unknown-linux-gnu :=
-CFG_RUN_powerpc64le-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu
diff --git a/mk/cfg/s390x-unknown-linux-gnu.mk b/mk/cfg/s390x-unknown-linux-gnu.mk
deleted file mode 100644
index eb1cb2329c4..00000000000
--- a/mk/cfg/s390x-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# s390x-unknown-linux-gnu configuration
-CROSS_PREFIX_s390x-unknown-linux-gnu=s390x-linux-gnu-
-CC_s390x-unknown-linux-gnu=$(CC)
-CXX_s390x-unknown-linux-gnu=$(CXX)
-CPP_s390x-unknown-linux-gnu=$(CPP)
-AR_s390x-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_s390x-unknown-linux-gnu := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_s390x-unknown-linux-gnu :=  -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_s390x-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_s390x-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_s390x-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_s390x-unknown-linux-gnu :=
-CFG_INSTALL_NAME_s390x-unknown-linux-gnu =
-CFG_EXE_SUFFIX_s390x-unknown-linux-gnu =
-CFG_WINDOWSY_s390x-unknown-linux-gnu :=
-CFG_UNIXY_s390x-unknown-linux-gnu := 1
-CFG_LDPATH_s390x-unknown-linux-gnu :=
-CFG_RUN_s390x-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_s390x-unknown-linux-gnu=$(call CFG_RUN_s390x-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_s390x-unknown-linux-gnu := s390x-unknown-linux-gnu
diff --git a/mk/cfg/sparc64-unknown-linux-gnu.mk b/mk/cfg/sparc64-unknown-linux-gnu.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/sparc64-unknown-linux-gnu.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/sparc64-unknown-netbsd.mk b/mk/cfg/sparc64-unknown-netbsd.mk
deleted file mode 100644
index a2b01ba0537..00000000000
--- a/mk/cfg/sparc64-unknown-netbsd.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is intentially left empty to indicate that, while this target is
-# supported, it's not supported using plain GNU Make builds. Use a --rustbuild
-# instead.
diff --git a/mk/cfg/wasm32-unknown-emscripten.mk b/mk/cfg/wasm32-unknown-emscripten.mk
deleted file mode 100644
index 997bdfbf03a..00000000000
--- a/mk/cfg/wasm32-unknown-emscripten.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# wasm32-unknown-emscripten configuration
-CC_wasm32-unknown-emscripten=emcc
-CXX_wasm32-unknown-emscripten=em++
-CPP_wasm32-unknown-emscripten=$(CPP)
-AR_wasm32-unknown-emscripten=emar
-CFG_LIB_NAME_wasm32-unknown-emscripten=lib$(1).so
-CFG_STATIC_LIB_NAME_wasm32-unknown-emscripten=lib$(1).a
-CFG_LIB_GLOB_wasm32-unknown-emscripten=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_wasm32-unknown-emscripten=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_wasm32-unknown-emscripten := -m32 $(CFLAGS)
-CFG_GCCISH_CFLAGS_wasm32-unknown-emscripten :=  -g -fPIC -m32 -s BINARYEN=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_wasm32-unknown-emscripten := -fno-rtti -s BINARYEN=1 $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_wasm32-unknown-emscripten := -shared -fPIC -ldl -pthread  -lrt -g -m32 -s BINARYEN=1
-CFG_GCCISH_DEF_FLAG_wasm32-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_wasm32-unknown-emscripten :=
-CFG_INSTALL_NAME_wasm32-unknown-emscripten =
-CFG_EXE_SUFFIX_wasm32-unknown-emscripten =
-CFG_WINDOWSY_wasm32-unknown-emscripten :=
-CFG_UNIXY_wasm32-unknown-emscripten := 1
-CFG_LDPATH_wasm32-unknown-emscripten :=
-CFG_RUN_wasm32-unknown-emscripten=$(2)
-CFG_RUN_TARG_wasm32-unknown-emscripten=$(call CFG_RUN_wasm32-unknown-emscripten,,$(2))
-CFG_GNU_TRIPLE_wasm32-unknown-emscripten := wasm32-unknown-emscripten
-CFG_DISABLE_JEMALLOC_wasm32-unknown-emscripten := 1
diff --git a/mk/cfg/x86_64-apple-darwin.mk b/mk/cfg/x86_64-apple-darwin.mk
deleted file mode 100644
index 8af47b671a8..00000000000
--- a/mk/cfg/x86_64-apple-darwin.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-apple-darwin configuration
-CC_x86_64-apple-darwin=$(CC)
-CXX_x86_64-apple-darwin=$(CXX)
-CPP_x86_64-apple-darwin=$(CPP)
-AR_x86_64-apple-darwin=$(AR)
-CFG_LIB_NAME_x86_64-apple-darwin=lib$(1).dylib
-CFG_STATIC_LIB_NAME_x86_64-apple-darwin=lib$(1).a
-CFG_LIB_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib
-CFG_LIB_DSYM_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-apple-darwin := -m64 -arch x86_64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-apple-darwin :=  -g -fPIC -m64 -arch x86_64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -pthread  -framework CoreServices -m64
-CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_x86_64-apple-darwin :=
-CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1)
-CFG_EXE_SUFFIX_x86_64-apple-darwin :=
-CFG_WINDOWSY_x86_64-apple-darwin :=
-CFG_UNIXY_x86_64-apple-darwin := 1
-CFG_LDPATH_x86_64-apple-darwin :=
-CFG_RUN_x86_64-apple-darwin=$(2)
-CFG_RUN_TARG_x86_64-apple-darwin=$(call CFG_RUN_x86_64-apple-darwin,,$(2))
-CFG_GNU_TRIPLE_x86_64-apple-darwin := x86_64-apple-darwin
diff --git a/mk/cfg/x86_64-apple-ios.mk b/mk/cfg/x86_64-apple-ios.mk
deleted file mode 100644
index 764cdc15996..00000000000
--- a/mk/cfg/x86_64-apple-ios.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# x86_64-apple-ios configuration
-CFG_SDK_NAME_x86_64-apple-ios := iphonesimulator
-CFG_SDK_ARCHS_x86_64-apple-ios := x86_64
-ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
-CFG_IOSSIM_SDK_x86_64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
-CFG_IOSSIM_FLAGS_x86_64-apple-ios := -m64 -target x86_64-apple-ios -isysroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -mios-simulator-version-min=7.0
-CC_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
-CXX_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-CPP_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
-AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
-endif
-CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a
-CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a
-CFG_INSTALL_ONLY_RLIB_x86_64-apple-ios = 1
-CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a
-CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM
-CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_JEMALLOC_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_GCCISH_CFLAGS_x86_64-apple-ios :=  -fPIC $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
-CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1
-CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios)
-CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list,
-CFG_LLC_FLAGS_x86_64-apple-ios :=
-CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1)
-CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios :=
-CFG_EXE_SUFFIX_x86_64-apple-ios :=
-CFG_WINDOWSY_x86_64-apple-ios :=
-CFG_UNIXY_x86_64-apple-ios := 1
-CFG_LDPATH_x86_64-apple-ios :=
-CFG_RUN_x86_64-apple-ios = $(2)
-CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2))
-CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios
diff --git a/mk/cfg/x86_64-pc-windows-gnu.mk b/mk/cfg/x86_64-pc-windows-gnu.mk
deleted file mode 100644
index 82e7b23279f..00000000000
--- a/mk/cfg/x86_64-pc-windows-gnu.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# x86_64-pc-windows-gnu configuration
-CROSS_PREFIX_x86_64-pc-windows-gnu=x86_64-w64-mingw32-
-CC_x86_64-pc-windows-gnu=gcc
-CXX_x86_64-pc-windows-gnu=g++
-CPP_x86_64-pc-windows-gnu=gcc -E
-AR_x86_64-pc-windows-gnu=ar
-CFG_LIB_NAME_x86_64-pc-windows-gnu=$(1).dll
-CFG_STATIC_LIB_NAME_x86_64-pc-windows-gnu=$(1).lib
-CFG_LIB_GLOB_x86_64-pc-windows-gnu=$(1)-*.dll
-CFG_LIB_DSYM_GLOB_x86_64-pc-windows-gnu=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-gnu := -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu :=  -g -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-gnu := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-gnu := -shared -g -m64
-CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-gnu :=
-CFG_LLC_FLAGS_x86_64-pc-windows-gnu :=
-CFG_INSTALL_NAME_x86_64-pc-windows-gnu =
-CFG_EXE_SUFFIX_x86_64-pc-windows-gnu := .exe
-CFG_WINDOWSY_x86_64-pc-windows-gnu := 1
-CFG_UNIXY_x86_64-pc-windows-gnu :=
-CFG_LDPATH_x86_64-pc-windows-gnu :=
-CFG_RUN_x86_64-pc-windows-gnu=$(2)
-CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2))
-CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
-CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
-CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
-CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1
diff --git a/mk/cfg/x86_64-pc-windows-msvc.mk b/mk/cfg/x86_64-pc-windows-msvc.mk
deleted file mode 100644
index 30e996a9727..00000000000
--- a/mk/cfg/x86_64-pc-windows-msvc.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# x86_64-pc-windows-msvc configuration
-CC_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-LINK_x86_64-pc-windows-msvc=$(CFG_MSVC_LINK_x86_64)
-CXX_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-CPP_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
-AR_x86_64-pc-windows-msvc=$(CFG_MSVC_LIB_x86_64)
-CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll
-CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
-CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib}
-CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc :=
-CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD -nologo
-CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc :=
-CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc :=
-CFG_LLC_FLAGS_x86_64-pc-windows-msvc :=
-CFG_INSTALL_NAME_x86_64-pc-windows-msvc =
-CFG_EXE_SUFFIX_x86_64-pc-windows-msvc := .exe
-CFG_WINDOWSY_x86_64-pc-windows-msvc := 1
-CFG_UNIXY_x86_64-pc-windows-msvc :=
-CFG_LDPATH_x86_64-pc-windows-msvc :=
-CFG_RUN_x86_64-pc-windows-msvc=$(2)
-CFG_RUN_TARG_x86_64-pc-windows-msvc=$(call CFG_RUN_x86_64-pc-windows-msvc,,$(2))
-CFG_GNU_TRIPLE_x86_64-pc-windows-msvc := x86_64-pc-win32
-
-# Currently the build system is not configured to build jemalloc
-# with MSVC, so we omit this optional dependency.
-CFG_DISABLE_JEMALLOC_x86_64-pc-windows-msvc := 1
diff --git a/mk/cfg/x86_64-rumprun-netbsd.mk b/mk/cfg/x86_64-rumprun-netbsd.mk
deleted file mode 100644
index 53d58b9fcea..00000000000
--- a/mk/cfg/x86_64-rumprun-netbsd.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# x86_64-rumprun-netbsd configuration
-CROSS_PREFIX_x86_64-rumprun-netbsd=x86_64-rumprun-netbsd-
-CC_x86_64-rumprun-netbsd=gcc
-CXX_x86_64-rumprun-netbsd=g++
-CPP_x86_64-rumprun-netbsd=gcc -E
-AR_x86_64-rumprun-netbsd=ar
-CFG_INSTALL_ONLY_RLIB_x86_64-rumprun-netbsd = 1
-CFG_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-rumprun-netbsd=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_x86_64-rumprun-netbsd := -m64
-CFG_GCCISH_CFLAGS_x86_64-rumprun-netbsd :=  -g -fPIC -m64
-CFG_GCCISH_CXXFLAGS_x86_64-rumprun-netbsd :=
-CFG_GCCISH_LINK_FLAGS_x86_64-rumprun-netbsd :=
-CFG_GCCISH_DEF_FLAG_x86_64-rumprun-netbsd :=
-CFG_LLC_FLAGS_x86_64-rumprun-netbsd :=
-CFG_INSTALL_NAME_x86_64-rumprun-netbsd =
-CFG_EXE_SUFFIX_x86_64-rumprun-netbsd =
-CFG_WINDOWSY_x86_64-rumprun-netbsd :=
-CFG_UNIXY_x86_64-rumprun-netbsd := 1
-CFG_LDPATH_x86_64-rumprun-netbsd :=
-CFG_RUN_x86_64-rumprun-netbsd=$(2)
-CFG_RUN_TARG_x86_64-rumprun-netbsd=$(call CFG_RUN_x86_64-rumprun-netbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-rumprun-netbsd := x86_64-rumprun-netbsd
-CFG_DISABLE_JEMALLOC_x86_64-rumprun-netbsd := 1
diff --git a/mk/cfg/x86_64-sun-solaris.mk b/mk/cfg/x86_64-sun-solaris.mk
deleted file mode 100644
index 7fc323b234a..00000000000
--- a/mk/cfg/x86_64-sun-solaris.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-sun-solaris configuration
-CROSS_PREFIX_x86_64-sun-solaris=x86_64-sun-solaris2.11-
-CC_x86_64-sun-solaris=$(CC)
-CXX_x86_64-sun-solaris=$(CXX)
-CPP_x86_64-sun-solaris=$(CPP)
-AR_x86_64-sun-solaris=$(AR)
-CFG_LIB_NAME_x86_64-sun-solaris=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-sun-solaris=lib$(1).a
-CFG_LIB_GLOB_x86_64-sun-solaris=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-sun-solaris=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-sun-solaris := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-sun-solaris :=  -g -D_POSIX_PTHREAD_SEMANTICS -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-sun-solaris := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-sun-solaris := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-sun-solaris :=
-CFG_INSTALL_NAME_x86_64-sun-solaris =
-CFG_EXE_SUFFIX_x86_64-sun-solaris :=
-CFG_WINDOWSY_x86_64-sun-solaris :=
-CFG_UNIXY_x86_64-sun-solaris := 1
-CFG_LDPATH_x86_64-sun-solaris :=
-CFG_RUN_x86_64-sun-solaris=$(2)
-CFG_RUN_TARG_x86_64-sun-solaris=$(call CFG_RUN_x86_64-sun-solaris,,$(2))
-CFG_GNU_TRIPLE_x86_64-sun-solaris := x86_64-sun-solaris
diff --git a/mk/cfg/x86_64-unknown-bitrig.mk b/mk/cfg/x86_64-unknown-bitrig.mk
deleted file mode 100644
index 8ac31c17618..00000000000
--- a/mk/cfg/x86_64-unknown-bitrig.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-bitrig-elf configuration
-CC_x86_64-unknown-bitrig=$(CC)
-CXX_x86_64-unknown-bitrig=$(CXX)
-CPP_x86_64-unknown-bitrig=$(CPP)
-AR_x86_64-unknown-bitrig=$(AR)
-CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig :=  -fPIE -fPIC -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
-CFG_INSTALL_NAME_x86_64-unknown-bitrig =
-CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
-CFG_WINDOWSY_x86_64-unknown-bitrig :=
-CFG_UNIXY_x86_64-unknown-bitrig := 1
-CFG_LDPATH_x86_64-unknown-bitrig :=
-CFG_RUN_x86_64-unknown-bitrig=$(2)
-CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig
-CFG_DISABLE_JEMALLOC_x86_64-unknown-bitrig := 1
diff --git a/mk/cfg/x86_64-unknown-dragonfly.mk b/mk/cfg/x86_64-unknown-dragonfly.mk
deleted file mode 100644
index 579a9a809e2..00000000000
--- a/mk/cfg/x86_64-unknown-dragonfly.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# x86_64-pc-dragonfly-elf configuration
-CC_x86_64-unknown-dragonfly=$(CC)
-CXX_x86_64-unknown-dragonfly=$(CXX)
-CPP_x86_64-unknown-dragonfly=$(CPP)
-AR_x86_64-unknown-dragonfly=$(AR)
-CFG_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-dragonfly=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-dragonfly=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly :=  -g -fPIC -m64 -I/usr/include -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread  -lrt -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-dragonfly := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-dragonfly :=
-CFG_INSTALL_NAME_x86_64-unknown-dragonfly =
-CFG_EXE_SUFFIX_x86_64-unknown-dragonfly :=
-CFG_WINDOWSY_x86_64-unknown-dragonfly :=
-CFG_UNIXY_x86_64-unknown-dragonfly := 1
-CFG_LDPATH_x86_64-unknown-dragonfly :=
-CFG_RUN_x86_64-unknown-dragonfly=$(2)
-CFG_RUN_TARG_x86_64-unknown-dragonfly=$(call CFG_RUN_x86_64-unknown-dragonfly,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-dragonfly := x86_64-unknown-dragonfly
diff --git a/mk/cfg/x86_64-unknown-freebsd.mk b/mk/cfg/x86_64-unknown-freebsd.mk
deleted file mode 100644
index c700601eac7..00000000000
--- a/mk/cfg/x86_64-unknown-freebsd.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# x86_64-unknown-freebsd configuration
-CC_x86_64-unknown-freebsd=$(CC)
-CXX_x86_64-unknown-freebsd=$(CXX)
-CPP_x86_64-unknown-freebsd=$(CPP)
-AR_x86_64-unknown-freebsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-freebsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-freebsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-freebsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-freebsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-freebsd := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-freebsd :=  -g -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-freebsd := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-freebsd :=
-CFG_INSTALL_NAME_x86_64-unknown-freebsd =
-CFG_EXE_SUFFIX_x86_64-unknown-freebsd :=
-CFG_WINDOWSY_x86_64-unknown-freebsd :=
-CFG_UNIXY_x86_64-unknown-freebsd := 1
-CFG_LDPATH_x86_64-unknown-freebsd :=
-CFG_RUN_x86_64-unknown-freebsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-freebsd := x86_64-unknown-freebsd
diff --git a/mk/cfg/x86_64-unknown-fuchsia.mk b/mk/cfg/x86_64-unknown-fuchsia.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/x86_64-unknown-fuchsia.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/cfg/x86_64-unknown-haiku.mk b/mk/cfg/x86_64-unknown-haiku.mk
deleted file mode 100644
index 4c2d888be06..00000000000
--- a/mk/cfg/x86_64-unknown-haiku.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# x86_64-unknown-haiku configuration
-CROSS_PREFIX_x86_64-unknown-haiku=x86_64-unknown-haiku-
-CC_x86_64-unknown-haiku=$(CC)
-CXX_x86_64-unknown-haiku=$(CXX)
-CPP_x86_64-unknown-haiku=$(CPP)
-AR_x86_64-unknown-haiku=$(AR)
-CFG_LIB_NAME_x86_64-unknown-haiku=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-haiku=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-haiku=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-haiku=lib$(1)-*.dylib.dSYM
-CFG_CFLAGS_x86_64-unknown-haiku := -m64 $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-haiku := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-haiku := -fno-rtti $(CXXFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m64
-CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-whole-archive
-CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-no-whole-archive
-CFG_DEF_SUFFIX_x86_64-unknown-haiku := .linux.def
-CFG_LLC_FLAGS_x86_64-unknown-haiku :=
-CFG_INSTALL_NAME_x86_64-unknown-haiku =
-CFG_EXE_SUFFIX_x86_64-unknown-haiku =
-CFG_WINDOWSY_x86_64-unknown-haiku :=
-CFG_UNIXY_x86_64-unknown-haiku := 1
-CFG_PATH_MUNGE_x86_64-unknown-haiku := true
-CFG_LDPATH_x86_64-unknown-haiku :=
-CFG_RUN_x86_64-unknown-haiku=$(2)
-CFG_RUN_TARG_x86_64-unknown-haiku=$(call CFG_RUN_x86_64-unknown-haiku,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-haiku := x86_64-unknown-haiku
diff --git a/mk/cfg/x86_64-unknown-linux-gnu.mk b/mk/cfg/x86_64-unknown-linux-gnu.mk
deleted file mode 100644
index 817ce22e4f5..00000000000
--- a/mk/cfg/x86_64-unknown-linux-gnu.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-linux-gnu configuration
-CC_x86_64-unknown-linux-gnu=$(CC)
-CXX_x86_64-unknown-linux-gnu=$(CXX)
-CPP_x86_64-unknown-linux-gnu=$(CPP)
-AR_x86_64-unknown-linux-gnu=$(AR)
-CFG_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-gnu := -m64
-CFG_GCCISH_CFLAGS_x86_64-unknown-linux-gnu :=  -g -fPIC -m64
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -pthread  -lrt -g -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-linux-gnu :=
-CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
-CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
-CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
-CFG_UNIXY_x86_64-unknown-linux-gnu := 1
-CFG_LDPATH_x86_64-unknown-linux-gnu :=
-CFG_RUN_x86_64-unknown-linux-gnu=$(2)
-CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-linux-gnu := x86_64-unknown-linux-gnu
diff --git a/mk/cfg/x86_64-unknown-linux-musl.mk b/mk/cfg/x86_64-unknown-linux-musl.mk
deleted file mode 100644
index 6f707ac3b3f..00000000000
--- a/mk/cfg/x86_64-unknown-linux-musl.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# x86_64-unknown-linux-musl configuration
-CC_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc
-CXX_x86_64-unknown-linux-musl=$(CXX)
-CPP_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E
-AR_x86_64-unknown-linux-musl=$(AR)
-CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1
-CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl :=  -g -fPIC -m64 -Wa,-mrelax-relocations=no
-CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-musl :=
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-musl :=
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-musl :=
-CFG_LLC_FLAGS_x86_64-unknown-linux-musl :=
-CFG_INSTALL_NAME_x86_64-unknown-linux-musl =
-CFG_EXE_SUFFIX_x86_64-unknown-linux-musl =
-CFG_WINDOWSY_x86_64-unknown-linux-musl :=
-CFG_UNIXY_x86_64-unknown-linux-musl := 1
-CFG_LDPATH_x86_64-unknown-linux-musl :=
-CFG_RUN_x86_64-unknown-linux-musl=$(2)
-CFG_RUN_TARG_x86_64-unknown-linux-musl=$(call CFG_RUN_x86_64-unknown-linux-musl,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-linux-musl := x86_64-unknown-linux-musl
-CFG_THIRD_PARTY_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o
-CFG_INSTALLED_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o
-
-NATIVE_DEPS_libc_T_x86_64-unknown-linux-musl += libc.a
-NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += crt1.o crti.o crtn.o
-NATIVE_DEPS_unwind_T_x86_64-unknown-linux-musl += libunwind.a
diff --git a/mk/cfg/x86_64-unknown-netbsd.mk b/mk/cfg/x86_64-unknown-netbsd.mk
deleted file mode 100644
index 93bb2d67265..00000000000
--- a/mk/cfg/x86_64-unknown-netbsd.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# x86_64-unknown-netbsd configuration
-CROSS_PREFIX_x86_64-unknown-netbsd=x86_64-unknown-netbsd-
-CC_x86_64-unknown-netbsd=$(CC)
-CXX_x86_64-unknown-netbsd=$(CXX)
-CPP_x86_64-unknown-netbsd=$(CPP)
-AR_x86_64-unknown-netbsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-netbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-netbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-netbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-netbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-netbsd := -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-netbsd :=  -g -fPIC -I/usr/local/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-netbsd := -shared -fPIC -g -pthread  -lrt
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-netbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-netbsd :=
-CFG_INSTALL_NAME_x86_64-unknown-netbsd =
-CFG_EXE_SUFFIX_x86_64-unknown-netbsd :=
-CFG_WINDOWSY_x86_64-unknown-netbsd :=
-CFG_UNIXY_x86_64-unknown-netbsd := 1
-CFG_LDPATH_x86_64-unknown-netbsd :=
-CFG_RUN_x86_64-unknown-netbsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-netbsd=$(call CFG_RUN_x86_64-unknown-netbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-netbsd := x86_64-unknown-netbsd
diff --git a/mk/cfg/x86_64-unknown-openbsd.mk b/mk/cfg/x86_64-unknown-openbsd.mk
deleted file mode 100644
index 7cca1f7b18b..00000000000
--- a/mk/cfg/x86_64-unknown-openbsd.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# x86_64-pc-openbsd-elf configuration
-CC_x86_64-unknown-openbsd=$(CC)
-CXX_x86_64-unknown-openbsd=$(CXX)
-CPP_x86_64-unknown-openbsd=$(CPP)
-AR_x86_64-unknown-openbsd=$(AR)
-CFG_LIB_NAME_x86_64-unknown-openbsd=lib$(1).so
-CFG_STATIC_LIB_NAME_x86_64-unknown-openbsd=lib$(1).a
-CFG_LIB_GLOB_x86_64-unknown-openbsd=lib$(1)-*.so
-CFG_LIB_DSYM_GLOB_x86_64-unknown-openbsd=$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd :=  -g -fPIC -m64 -I/usr/include $(CFLAGS)
-CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64
-CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
-CFG_LLC_FLAGS_x86_64-unknown-openbsd :=
-CFG_INSTALL_NAME_x86_64-unknown-openbsd =
-CFG_EXE_SUFFIX_x86_64-unknown-openbsd :=
-CFG_WINDOWSY_x86_64-unknown-openbsd :=
-CFG_UNIXY_x86_64-unknown-openbsd := 1
-CFG_LDPATH_x86_64-unknown-openbsd :=
-CFG_RUN_x86_64-unknown-openbsd=$(2)
-CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
-CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd
-RUSTC_FLAGS_x86_64-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))
-CFG_DISABLE_JEMALLOC_x86_64-unknown-openbsd := 1
diff --git a/mk/cfg/x86_64-unknown-redox.mk b/mk/cfg/x86_64-unknown-redox.mk
deleted file mode 100644
index 34aee77ae21..00000000000
--- a/mk/cfg/x86_64-unknown-redox.mk
+++ /dev/null
@@ -1 +0,0 @@
-# rustbuild-only target
diff --git a/mk/clean.mk b/mk/clean.mk
deleted file mode 100644
index 7013d9f03f8..00000000000
--- a/mk/clean.mk
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Cleanup
-######################################################################
-
-CLEAN_STAGE_RULES := \
- $(foreach stage, $(STAGES), \
-  $(foreach host, $(CFG_HOST), \
-   clean$(stage)_H_$(host) \
-   $(foreach target, $(CFG_TARGET), \
-    clean$(stage)_T_$(target)_H_$(host))))
-
-CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \
-    $(foreach host, $(CFG_HOST), clean-generic-H-$(host))
-
-CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \
-    $(foreach host, $(CFG_TARGET), clean-generic-T-$(host))
-
-CLEAN_LLVM_RULES = \
- $(foreach target, $(CFG_HOST), \
-  clean-llvm$(target))
-
-.PHONY: clean clean-all clean-misc clean-llvm
-
-clean-all: clean clean-llvm
-
-clean-llvm: $(CLEAN_LLVM_RULES)
-
-clean: clean-misc clean-grammar $(CLEAN_STAGE_RULES)
-
-clean-misc:
-	@$(call E, cleaning)
-	$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
-	$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
-	$(Q)rm -Rf $(GENERATED)
-	$(Q)rm -Rf tmp/*
-	$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe
-	$(Q)rm -Rf dist/*
-	$(Q)rm -Rf doc
-
-clean-grammar:
-	@$(call E, cleaning grammar verification)
-	$(Q)rm -Rf grammar
-define CLEAN_GENERIC
-
-clean-generic-$(2)-$(1):
-	$(Q)find $(1)/rustllvm \
-	         $(1)/rt \
-		 $(1)/test \
-		 $(1)/stage* \
-		 -type f \( \
-         -name '*.[odasS]' -o \
-         -name '*.so' -o \
-         -name '*.dylib' -o \
-         -name '*.rlib' -o \
-         -name 'stamp.*' -o \
-         -name '*.lib' -o \
-         -name '*.dll' -o \
-         -name '*.def' -o \
-         -name '*.py' -o \
-         -name '*.pyc' -o \
-         -name '*.bc' -o \
-         -name '*.rs' \
-         \) \
-         | xargs rm -f
-	$(Q)find $(1) \
-         -name '*.dSYM' \
-         | xargs rm -Rf
-endef
-
-$(foreach host, $(CFG_HOST), $(eval $(call CLEAN_GENERIC,$(host),H)))
-$(foreach targ, $(CFG_TARGET), $(eval $(call CLEAN_GENERIC,$(targ),T)))
-
-define CLEAN_HOST_STAGE_N
-
-clean$(1)_H_$(2): \
-	    $$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \
-	    $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_H_$(2)-tool-$$(tool))
-	$$(Q)rm -fr $(2)/rt/libbacktrace
-
-clean$(1)_H_$(2)-tool-%:
-	$$(Q)rm -f $$(HBIN$(1)_H_$(2))/$$*$$(X_$(2))
-
-clean$(1)_H_$(2)-lib-%:
-	$$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_LIB_GLOB_$(2),$$*)
-	$$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_RLIB_GLOB,$$*)
-
-endef
-
-$(foreach host, $(CFG_HOST), \
- $(eval $(foreach stage, $(STAGES), \
-  $(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
-
-define CLEAN_TARGET_STAGE_N
-
-clean$(1)_T_$(2)_H_$(3): \
-	    $$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
-	    $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
-	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
-	$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows
-
-clean$(1)_T_$(2)_H_$(3)-tool-%:
-	$$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/$$*$$(X_$(2))
-
-clean$(1)_T_$(2)_H_$(3)-lib-%:
-	$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_LIB_GLOB_$(2),$$*)
-	$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_RLIB_GLOB,$$*)
-endef
-
-$(foreach host, $(CFG_HOST), \
- $(eval $(foreach target, $(CFG_TARGET), \
-  $(eval $(foreach stage, 0 1 2 3, \
-   $(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host))))))))
diff --git a/mk/crates.mk b/mk/crates.mk
deleted file mode 100644
index 320ba44ed80..00000000000
--- a/mk/crates.mk
+++ /dev/null
@@ -1,228 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-################################################################################
-# Rust's standard distribution of crates and tools
-#
-# The crates outlined below are the standard distribution of libraries provided
-# in a rust installation. These rules are meant to abstract over the
-# dependencies (both native and rust) of crates and basically generate all the
-# necessary makefile rules necessary to build everything.
-#
-# Here's an explanation of the variables below
-#
-#   TARGET_CRATES
-#	This list of crates will be built for all targets, including
-#	cross-compiled targets
-#
-#   HOST_CRATES
-#	This list of crates will be compiled for only host targets. Note that
-#	this set is explicitly *not* a subset of TARGET_CRATES, but rather it is
-#	a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in
-#	the HOST_CRATES set, but the HOST_CRATES set can depend on target
-#	crates.
-#
-#   TOOLS
-#	A list of all tools which will be built as part of the compilation
-#	process. It is currently assumed that most tools are built through
-#	src/driver/driver.rs with a particular configuration (there's a
-#	corresponding library providing the implementation)
-#
-#   DEPS_<crate>
-#	These lists are the dependencies of the <crate> that is to be built.
-#	Rust dependencies are listed bare (i.e. std) and native
-#	dependencies have a "native:" prefix (i.e. native:hoedown). All deps
-#	will be built before the crate itself is built.
-#
-#   TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
-#	Similar to the DEPS variable, this is the library crate dependencies
-#	list for tool as well as the source file for the specified tool
-#
-# You shouldn't need to modify much other than these variables. Crates are
-# automatically generated for all stage/host/target combinations.
-################################################################################
-
-TARGET_CRATES := libc std term \
-                 getopts collections test rand \
-                 compiler_builtins core alloc \
-                 std_unicode rustc_bitflags \
-		 alloc_system alloc_jemalloc \
-		 panic_abort panic_unwind unwind
-RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
-                rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
-                rustc_data_structures rustc_platform_intrinsics rustc_errors \
-                rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
-                rustc_const_eval rustc_const_math rustc_incremental proc_macro
-HOST_CRATES := syntax syntax_ext proc_macro_plugin syntax_pos $(RUSTC_CRATES) \
-		rustdoc fmt_macros flate arena graphviz log serialize
-TOOLS := compiletest rustdoc rustc rustbook error_index_generator
-
-DEPS_core :=
-DEPS_compiler_builtins := core native:compiler-rt
-DEPS_alloc := core libc alloc_system
-DEPS_alloc_system := core libc
-DEPS_alloc_jemalloc := core libc native:jemalloc
-DEPS_collections := core alloc std_unicode
-DEPS_libc := core
-DEPS_rand := core
-DEPS_rustc_bitflags := core
-DEPS_std_unicode := core
-DEPS_panic_abort := libc alloc
-DEPS_panic_unwind := libc alloc unwind
-DEPS_unwind := libc
-
-RUSTFLAGS_compiler_builtins := -lstatic=compiler-rt
-RUSTFLAGS_panic_abort := -C panic=abort
-
-DEPS_std := core libc rand alloc collections compiler_builtins std_unicode \
-	native:backtrace \
-	alloc_system panic_abort panic_unwind unwind
-DEPS_arena := std
-DEPS_glob := std
-DEPS_flate := std native:miniz
-DEPS_fmt_macros = std
-DEPS_getopts := std
-DEPS_graphviz := std
-DEPS_log := std
-DEPS_num := std
-DEPS_serialize := std log
-DEPS_term := std
-DEPS_test := std getopts term native:rust_test_helpers
-
-DEPS_syntax := std term serialize log arena libc rustc_bitflags std_unicode rustc_errors \
-			syntax_pos rustc_data_structures
-DEPS_syntax_ext := syntax syntax_pos rustc_errors fmt_macros proc_macro
-DEPS_proc_macro := syntax syntax_pos rustc_plugin log
-DEPS_syntax_pos := serialize
-DEPS_proc_macro_plugin := syntax syntax_pos rustc_plugin
-
-DEPS_rustc_const_math := std syntax log serialize
-DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
-			     rustc_back graphviz syntax_pos
-
-DEPS_rustc := syntax fmt_macros flate arena serialize getopts \
-              log graphviz rustc_llvm rustc_back rustc_data_structures\
-	      rustc_const_math syntax_pos rustc_errors
-DEPS_rustc_back := std syntax flate log libc
-DEPS_rustc_borrowck := rustc log graphviz syntax syntax_pos rustc_errors rustc_mir
-DEPS_rustc_data_structures := std log serialize libc
-DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
-                     rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
-                     rustc_trans rustc_privacy rustc_lint rustc_plugin \
-                     rustc_metadata syntax_ext proc_macro_plugin \
-                     rustc_passes rustc_save_analysis rustc_const_eval \
-                     rustc_incremental syntax_pos rustc_errors proc_macro rustc_data_structures
-DEPS_rustc_errors := log libc serialize syntax_pos
-DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval
-DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
-DEPS_proc_macro := std syntax
-DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \
-			proc_macro syntax_ext
-DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors
-DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags
-DEPS_rustc_resolve := arena rustc log syntax syntax_pos rustc_errors
-DEPS_rustc_platform_intrinsics := std
-DEPS_rustc_plugin := rustc rustc_metadata syntax syntax_pos rustc_errors
-DEPS_rustc_privacy := rustc log syntax syntax_pos
-DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
-                    log syntax serialize rustc_llvm rustc_platform_intrinsics \
-                    rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos
-DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures
-DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
-DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
-                     rustc_const_eval rustc_errors rustc_data_structures
-
-DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts test \
-                rustc_lint rustc_const_eval syntax_pos rustc_data_structures
-
-TOOL_DEPS_compiletest := test getopts log serialize
-TOOL_DEPS_rustdoc := rustdoc
-TOOL_DEPS_rustc := rustc_driver
-TOOL_DEPS_rustbook := std rustdoc
-TOOL_DEPS_error_index_generator := rustdoc syntax serialize
-TOOL_SOURCE_compiletest := $(S)src/tools/compiletest/src/main.rs
-TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
-TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
-TOOL_SOURCE_rustbook := $(S)src/tools/rustbook/main.rs
-TOOL_SOURCE_error_index_generator := $(S)src/tools/error_index_generator/main.rs
-
-ONLY_RLIB_compiler_builtins := 1
-ONLY_RLIB_core := 1
-ONLY_RLIB_libc := 1
-ONLY_RLIB_alloc := 1
-ONLY_RLIB_rand := 1
-ONLY_RLIB_collections := 1
-ONLY_RLIB_std_unicode := 1
-ONLY_RLIB_rustc_bitflags := 1
-ONLY_RLIB_alloc_system := 1
-ONLY_RLIB_alloc_jemalloc := 1
-ONLY_RLIB_panic_unwind := 1
-ONLY_RLIB_panic_abort := 1
-ONLY_RLIB_unwind := 1
-
-TARGET_SPECIFIC_alloc_jemalloc := 1
-
-# Documented-by-default crates
-DOC_CRATES := std alloc collections core libc std_unicode
-
-ifeq ($(CFG_DISABLE_JEMALLOC),)
-RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"'
-endif
-
-################################################################################
-# You should not need to edit below this line
-################################################################################
-
-CRATES := $(TARGET_CRATES) $(HOST_CRATES)
-
-# This macro creates some simple definitions for each crate being built, just
-# some munging of all of the parameters above.
-#
-# $(1) is the crate to generate variables for
-define RUST_CRATE
-CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs
-RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
-NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
-endef
-
-$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
-
-# $(1) - crate
-# $(2) - target
-define RUST_CRATE_DEPS
-RUST_DEPS_$(1)_T_$(2) := $$(filter-out native:%,$$(DEPS_$(1)))
-endef
-
-$(foreach target,$(CFG_TARGET),\
- $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE_DEPS,$(crate),$(target)))))
-
-# $(1) - target
-# $(2) - crate
-define DEFINE_TARGET_CRATES
-ifndef TARGET_SPECIFIC_$(2)
-TARGET_CRATES_$(1) += $(2)
-endif
-endef
-
-$(foreach target,$(CFG_TARGET),\
- $(foreach crate,$(TARGET_CRATES),\
-  $(eval $(call DEFINE_TARGET_CRATES,$(target),$(crate)))))
-
-# Similar to the macro above for crates, this macro is for tools
-#
-# $(1) is the crate to generate variables for
-define RUST_TOOL
-TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
-endef
-
-$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
-
-CRATEFILE_libc := $(SREL)src/liblibc/src/lib.rs
-RUSTFLAGS_libc := --cfg stdbuild
diff --git a/mk/ctags.mk b/mk/ctags.mk
deleted file mode 100644
index 1fcb0bb4deb..00000000000
--- a/mk/ctags.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# TAGS file creation.  No dependency tracking, just do it on demand.
-# Requires Exuberant Ctags: http://ctags.sourceforge.net/index.html
-######################################################################
-
-.PHONY: TAGS.emacs TAGS.vi
-
-CTAGS_RUSTC_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/lib%test,, \
-				$(wildcard ${CFG_SRC_DIR}src/lib*)) ${CFG_SRC_DIR}src/libtest
-CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/librust%,, \
-                $(patsubst ${CFG_SRC_DIR}src/lib%test,, \
-				$(wildcard ${CFG_SRC_DIR}src/lib*))) ${CFG_SRC_DIR}src/libtest
-CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=Rust --recurse
-
-TAGS.rustc.emacs:
-	ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS}
-
-TAGS.emacs:
-	ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS}
-
-TAGS.rustc.vi:
-	ctags -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS}
-
-TAGS.vi:
-	ctags -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS}
diff --git a/mk/debuggers.mk b/mk/debuggers.mk
deleted file mode 100644
index fbf32dc1a39..00000000000
--- a/mk/debuggers.mk
+++ /dev/null
@@ -1,145 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Copy debugger related scripts
-######################################################################
-
-
-## GDB ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
-                                 gdb_rust_pretty_printing.py \
-                                 debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-DEBUGGER_BIN_SCRIPTS_GDB=rust-gdb
-DEBUGGER_BIN_SCRIPTS_GDB_ABS=\
-    $(foreach script,$(DEBUGGER_BIN_SCRIPTS_GDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-
-## LLDB ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB=lldb_rust_formatters.py \
-                                  debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb
-DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
-    $(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-
-
-## ALL ##
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=gdb_load_rust_pretty_printers.py \
-                                 gdb_rust_pretty_printing.py \
-                                 lldb_rust_formatters.py \
-                                 debugger_pretty_printers_common.py
-DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=\
-    $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL), \
-        $(CFG_SRC_DIR)src/etc/$(script))
-DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \
-                         $(DEBUGGER_BIN_SCRIPTS_LLDB)
-DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \
-                             $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-
-
-# $(1) - the stage to copy to
-# $(2) - the host triple
-define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
-
-tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-	$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
-	$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-	$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2))
-	$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
-	$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2))
-	$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_H_$(2)-none.done:
-	$(Q)touch $$@
-
-endef
-
-# Expand host make-targets for all stages
-$(foreach stage,$(STAGES), \
-  $(foreach host,$(CFG_HOST), \
-    $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_HOST,$(stage),$(host)))))
-
-# $(1) is the stage number
-# $(2) is the target triple
-# $(3) is the host triple
-define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
-  $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
-  $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
-	$(Q)touch $$@.start_time
-	$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
-	$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
-	$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-
-tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done:
-	$(Q)touch $$@
-
-endef
-
-# Expand target make-targets for all stages
-$(foreach stage,$(STAGES), \
-  $(foreach target,$(CFG_TARGET), \
-    $(foreach host,$(CFG_HOST), \
-      $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET,$(stage),$(target),$(host))))))
diff --git a/mk/dist.mk b/mk/dist.mk
deleted file mode 100644
index 238ba8acee4..00000000000
--- a/mk/dist.mk
+++ /dev/null
@@ -1,382 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Distribution
-######################################################################
-
-# Primary targets:
-#
-# * dist - make all distribution artifacts
-# * distcheck - sanity check dist artifacts
-# * dist-tar-src - source tarballs
-# * dist-tar-bins - Ad-hoc Unix binary installers
-# * dist-docs - Stage docs for upload
-
-PKG_NAME := $(CFG_PACKAGE_NAME)
-STD_PKG_NAME := rust-std-$(CFG_PACKAGE_VERS)
-DOC_PKG_NAME := rust-docs-$(CFG_PACKAGE_VERS)
-MINGW_PKG_NAME := rust-mingw-$(CFG_PACKAGE_VERS)
-SRC_PKG_NAME := rust-src-$(CFG_PACKAGE_VERS)
-
-# License suitable for displaying in a popup
-LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
-	cat $^ > $@
-
-
-######################################################################
-# Source tarball
-######################################################################
-
-PKG_TAR = dist/$(PKG_NAME)-src.tar.gz
-
-PKG_GITMODULES := $(S)src/llvm $(S)src/compiler-rt \
-		  $(S)src/rt/hoedown $(S)src/jemalloc
-PKG_FILES := \
-    $(S)COPYRIGHT                              \
-    $(S)LICENSE-APACHE                         \
-    $(S)LICENSE-MIT                            \
-    $(S)CONTRIBUTING.md                        \
-    $(S)README.md                              \
-    $(S)RELEASES.md                            \
-    $(S)configure $(S)Makefile.in              \
-    $(S)man                                    \
-    $(addprefix $(S)src/,                      \
-      bootstrap                                \
-      build_helper                             \
-      doc                                      \
-      driver                                   \
-      etc                                      \
-      $(foreach crate,$(CRATES),lib$(crate))   \
-      libcollectionstest                       \
-      libcoretest                              \
-      libbacktrace                             \
-      rt                                       \
-      rtstartup                                \
-      rustllvm                                 \
-      rustc                                    \
-      stage0.txt                               \
-      rust-installer                           \
-      tools                                    \
-      test                                     \
-      vendor)                                  \
-    $(PKG_GITMODULES)                          \
-    $(filter-out config.stamp, \
-                 $(MKFILES_FOR_TARBALL))
-
-UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
-
-tmp/dist/$$(SRC_PKG_NAME)-image: $(PKG_FILES)
-	@$(call E, making src image)
-	$(Q)rm -Rf tmp/dist/$(SRC_PKG_NAME)-image
-	$(Q)mkdir -p tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust
-	$(Q)echo "$(CFG_VERSION)" > tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust/version
-	$(Q)tar \
-         -C $(S) \
-         -f - \
-         --exclude-vcs \
-         --exclude=*~ \
-         --exclude=*.pyc \
-         --exclude=*/llvm/test/*/*.ll \
-         --exclude=*/llvm/test/*/*.td \
-         --exclude=*/llvm/test/*/*.s \
-         --exclude=*/llvm/test/*/*/*.ll \
-         --exclude=*/llvm/test/*/*/*.td \
-         --exclude=*/llvm/test/*/*/*.s \
-         -c $(UNROOTED_PKG_FILES) | tar -x -f - -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust
-
-$(PKG_TAR): tmp/dist/$$(SRC_PKG_NAME)-image
-	@$(call E, making $@)
-	$(Q)tar -czf $(PKG_TAR) -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src rust --transform 's,^rust,$(PKG_NAME),S'
-
-dist-tar-src: $(PKG_TAR)
-
-distcheck-tar-src: dist-tar-src
-	$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
-	$(Q)rm -Rf tmp/distcheck/srccheck
-	$(Q)mkdir -p tmp/distcheck
-	@$(call E, unpacking $(PKG_TAR) in tmp/distcheck/$(PKG_NAME))
-	$(Q)cd tmp/distcheck && tar -xzf ../../$(PKG_TAR)
-	@$(call E, configuring in tmp/distcheck/srccheck)
-	$(Q)mkdir -p tmp/distcheck/srccheck
-	$(Q)cd tmp/distcheck/srccheck && ../$(PKG_NAME)/configure
-	@$(call E, making 'check' in tmp/distcheck/srccheck)
-	$(Q)+make -C tmp/distcheck/srccheck check
-	@$(call E, making 'clean' in tmp/distcheck/srccheck)
-	$(Q)+make -C tmp/distcheck/srccheck clean
-	$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
-	$(Q)rm -Rf tmp/distcheck/srccheck
-
-
-######################################################################
-# Unix binary installer tarballs
-######################################################################
-
-define DEF_START_INSTALLER
-dist-install-dir-$(1)-%: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
-dist-install-dir-$(1)-%: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
-dist-install-dir-$(1)-%: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
-dist-install-dir-$(1)-%: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
-dist-install-dir-$(1)-%: PREPARE_CLEAN=true
-
-$$(eval $$(call DEF_PREPARE,dir-$(1)))
-endef
-
-$(foreach target,$(CFG_TARGET),\
-  $(eval $(call DEF_START_INSTALLER,$(target))))
-
-define DEF_INSTALLER
-
-dist-install-dir-$(1)-host: PREPARE_HOST=$(1)
-dist-install-dir-$(1)-host: PREPARE_TARGETS=$(2)
-dist-install-dir-$(1)-host: PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)-image
-dist-install-dir-$(1)-host: prepare-base-dir-$(1)-host docs
-	$$(Q)mkdir -p $$(PREPARE_DEST_DIR)/share/doc/rust
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)/share/doc/rust
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)/share/doc/rust
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)/share/doc/rust
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)/share/doc/rust
-
-prepare-overlay-$(1):
-	$$(Q)rm -Rf tmp/dist/$$(PKG_NAME)-$(1)-overlay
-	$$(Q)mkdir -p tmp/dist/$$(PKG_NAME)-$(1)-overlay
-	$$(Q)cp $$(S)COPYRIGHT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-	$$(Q)cp $$(S)LICENSE-APACHE tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-	$$(Q)cp $$(S)LICENSE-MIT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-	$$(Q)cp $$(S)README.md tmp/dist/$$(PKG_NAME)-$(1)-overlay/
-# This tiny morsel of metadata is used by rust-packaging
-	$$(Q)echo "$(CFG_VERSION)" > tmp/dist/$$(PKG_NAME)-$(1)-overlay/version
-
-dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)-host prepare-overlay-$(1)
-	@$(call E, build: $$@)
-# On a MinGW target we've got a few runtime DLL dependencies that we need
-# to include. THe first argument to `make-win-dist` is where to put these DLLs
-# (the image we're creating) and the second argument is a junk directory to
-# ignore all the other MinGW stuff the script creates.
-ifeq ($$(findstring pc-windows-gnu,$(1)),pc-windows-gnu)
-	$$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1)
-	$$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \
-		tmp/dist/$$(PKG_NAME)-$(1)-image \
-		tmp/dist/win-rust-gcc-$(1) $(1)
-endif
-# On 32-bit MinGW we're always including a DLL which needs some extra licenses
-# to distribute. On 64-bit MinGW we don't actually distribute anything requiring
-# us to distribute a license but it's likely that the install will *also*
-# include the rust-mingw package down below, which also need licenses, so to be
-# safe we just inlude it here in all MinGW packages.
-ifdef CFG_WINDOWSY_$(1)
-ifeq ($$(findstring $(1),gnu),gnu)
-	$$(Q)cp -r $$(S)src/etc/third-party \
-		tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/
-endif
-endif
-	$$(Q)$$(S)src/rust-installer/gen-installer.sh \
-		--product-name=Rust \
-		--rel-manifest-dir=rustlib \
-		--success-message=Rust-is-ready-to-roll. \
-		--image-dir=tmp/dist/$$(PKG_NAME)-$(1)-image \
-		--work-dir=tmp/dist \
-		--output-dir=dist \
-		--non-installed-overlay=tmp/dist/$$(PKG_NAME)-$(1)-overlay \
-		--package-name=$$(PKG_NAME)-$(1) \
-		--component-name=rustc \
-		--legacy-manifest-dirs=rustlib,cargo
-	$$(Q)rm -R tmp/dist/$$(PKG_NAME)-$(1)-image
-
-dist-doc-install-dir-$(1): docs
-	$$(Q)mkdir -p tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust
-	$$(Q)cp -r doc tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust/html
-
-dist/$$(DOC_PKG_NAME)-$(1).tar.gz: dist-doc-install-dir-$(1)
-	@$(call E, build: $$@)
-	$$(Q)$$(S)src/rust-installer/gen-installer.sh \
-		--product-name=Rust-Documentation \
-		--rel-manifest-dir=rustlib \
-		--success-message=Rust-documentation-is-installed. \
-		--image-dir=tmp/dist/$$(DOC_PKG_NAME)-$(1)-image \
-		--work-dir=tmp/dist \
-		--output-dir=dist \
-		--package-name=$$(DOC_PKG_NAME)-$(1) \
-		--component-name=rust-docs \
-		--legacy-manifest-dirs=rustlib,cargo \
-		--bulk-dirs=share/doc/rust/html
-	$$(Q)rm -R tmp/dist/$$(DOC_PKG_NAME)-$(1)-image
-
-# Creates the rust-mingw package, and the first argument to make-win-dist is a
-# "temporary directory" which is just thrown away (this contains the runtime
-# DLLs included in the rustc package above) and the second argument is where to
-# place all the MinGW components (which is what we want).
-dist-mingw-install-dir-$(1):
-	$$(Q)mkdir -p tmp/dist/rust-mingw-tmp-$(1)-image
-	$$(Q)rm -Rf tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image
-	$$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \
-		tmp/dist/rust-mingw-tmp-$(1)-image \
-		tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image $(1)
-
-dist/$$(MINGW_PKG_NAME)-$(1).tar.gz: dist-mingw-install-dir-$(1)
-	@$(call E, build: $$@)
-	$$(Q)$$(S)src/rust-installer/gen-installer.sh \
-		--product-name=Rust-MinGW \
-		--rel-manifest-dir=rustlib \
-		--success-message=Rust-MinGW-is-installed. \
-		--image-dir=tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image \
-		--work-dir=tmp/dist \
-		--output-dir=dist \
-		--package-name=$$(MINGW_PKG_NAME)-$(1) \
-		--component-name=rust-mingw \
-		--legacy-manifest-dirs=rustlib,cargo
-	$$(Q)rm -R tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image
-
-endef
-
-# $(1) - host
-# $(2) - target
-define DEF_INSTALLER_TARGETS
-
-dist-install-dir-$(2)-target: PREPARE_HOST=$(1)
-dist-install-dir-$(2)-target: PREPARE_TARGETS=$(2)
-dist-install-dir-$(2)-target: PREPARE_DEST_DIR=tmp/dist/$$(STD_PKG_NAME)-$(2)-image
-dist-install-dir-$(2)-target: prepare-base-dir-$(2)-target
-
-dist/$$(STD_PKG_NAME)-$(2).tar.gz: dist-install-dir-$(2)-target
-	@$$(call E, build: $$@)
-	$$(Q)$$(S)src/rust-installer/gen-installer.sh \
-		--product-name=Rust \
-		--rel-manifest-dir=rustlib \
-		--success-message=std-is-standing-at-the-ready. \
-		--image-dir=tmp/dist/$$(STD_PKG_NAME)-$(2)-image \
-		--work-dir=tmp/dist \
-		--output-dir=dist \
-		--package-name=$$(STD_PKG_NAME)-$(2) \
-		--component-name=rust-std-$(2) \
-		--legacy-manifest-dirs=rustlib,cargo
-	$$(Q)rm -R tmp/dist/$$(STD_PKG_NAME)-$(2)-image
-endef
-
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call DEF_INSTALLER,$(host))))
-
-dist/$(SRC_PKG_NAME).tar.gz: tmp/dist/$(SRC_PKG_NAME)-image
-	@$(call E, build: $@)
-	$(Q)$(S)src/rust-installer/gen-installer.sh \
-		--product-name=Rust \
-		--rel-manifest-dir=rustlib \
-		--success-message=Awesome-Source. \
-		--image-dir=tmp/dist/$(SRC_PKG_NAME)-image \
-		--work-dir=tmp/dist \
-		--output-dir=dist \
-		--package-name=$(SRC_PKG_NAME) \
-		--component-name=rust-src \
-		--legacy-manifest-dirs=rustlib,cargo
-
-# When generating packages for the standard library, we've actually got a lot of
-# artifacts to choose from. Each of the CFG_HOST compilers will have a copy of
-# the standard library for each CFG_TARGET, but we only want to generate one
-# standard library package. As a result, for each entry in CFG_TARGET we need to
-# pick a CFG_HOST to get the standard library from.
-#
-# In theory it doesn't actually matter what host we choose as it should be the
-# case that all hosts produce the same set of libraries for a target (regardless
-# of the host itself). Currently there is a bug in the compiler, however, which
-# means this is not the case (see #29228 and #29235). To solve the first of
-# those bugs, we prefer to select a standard library from the host it was
-# generated from, allowing plugins to work in more situations.
-#
-# For all CFG_TARGET entries in CFG_HOST, however, we just pick CFG_BUILD as the
-# host we slurp up a standard library from.
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call DEF_INSTALLER_TARGETS,$(host),$(host))))
-$(foreach target,$(filter-out $(CFG_HOST),$(CFG_TARGET)),\
-  $(eval $(call DEF_INSTALLER_TARGETS,$(CFG_BUILD),$(target))))
-
-ifdef CFG_WINDOWSY_$(CFG_BUILD)
-define BUILD_MINGW_TARBALL
-ifeq ($$(findstring gnu,$(1)),gnu)
-MAYBE_MINGW_TARBALLS += dist/$(MINGW_PKG_NAME)-$(1).tar.gz
-endif
-endef
-
-$(foreach host,$(CFG_HOST),\
-  $(eval $(call BUILD_MINGW_TARBALL,$(host))))
-endif
-
-ifeq ($(CFG_DISABLE_DOCS),)
-MAYBE_DOC_TARBALLS=$(foreach host,$(CFG_HOST),dist/$(DOC_PKG_NAME)-$(host).tar.gz)
-endif
-
-dist-tar-bins: \
-	$(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).tar.gz) \
-	$(foreach target,$(CFG_TARGET),dist/$(STD_PKG_NAME)-$(target).tar.gz) \
-	$(MAYBE_DOC_TARBALLS) $(MAYBE_MINGW_TARBALLS)
-
-# Just try to run the compiler for the build host
-distcheck-tar-bins: dist-tar-bins
-	@$(call E, checking binary tarball)
-	$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
-	$(Q)rm -Rf tmp/distcheck/tarbininstall
-	$(Q)mkdir -p tmp/distcheck
-	$(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz
-	$(Q)mkdir -p tmp/distcheck/tarbininstall
-	$(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall
-	$(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall --uninstall
-	$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
-	$(Q)rm -Rf tmp/distcheck/tarbininstall
-
-######################################################################
-# Docs
-######################################################################
-
-# Just copy the docs to a folder under dist with the appropriate name
-# for uploading to S3
-dist-docs: docs
-	$(Q) rm -Rf dist/doc
-	$(Q) mkdir -p dist/doc/
-	$(Q) cp -r doc dist/doc/$(CFG_PACKAGE_VERS)
-
-distcheck-docs: dist-docs
-
-######################################################################
-# Primary targets (dist, distcheck)
-######################################################################
-
-MAYBE_DIST_TAR_SRC=dist-tar-src dist/$(SRC_PKG_NAME).tar.gz
-MAYBE_DISTCHECK_TAR_SRC=distcheck-tar-src dist/$(SRC_PKG_NAME).tar.gz
-
-# FIXME #13224: On OS X don't produce tarballs simply because --exclude-vcs don't work.
-# This is a huge hack because I just don't have time to figure out another solution.
-ifeq ($(CFG_OSTYPE), apple-darwin)
-MAYBE_DIST_TAR_SRC=
-MAYBE_DISTCHECK_TAR_SRC=
-endif
-
-# Don't bother with source tarballs on windows just because we historically haven't.
-ifeq ($(CFG_OSTYPE), pc-windows-gnu)
-MAYBE_DIST_TAR_SRC=
-MAYBE_DISTCHECK_TAR_SRC=
-endif
-
-ifneq ($(CFG_DISABLE_DOCS),)
-MAYBE_DIST_DOCS=
-MAYBE_DISTCHECK_DOCS=
-else
-MAYBE_DIST_DOCS=dist-docs
-MAYBE_DISTCHECK_DOCS=distcheck-docs
-endif
-
-dist: $(MAYBE_DIST_TAR_SRC) dist-tar-bins $(MAYBE_DIST_DOCS)
-
-distcheck: $(MAYBE_DISTCHECK_TAR_SRC) distcheck-tar-bins $(MAYBE_DISTCHECK_DOCS)
-	$(Q)rm -Rf tmp/distcheck
-	@echo
-	@echo -----------------------------------------------
-	@echo "Rust ready for distribution (see ./dist)"
-	@echo -----------------------------------------------
-
-.PHONY: dist distcheck
diff --git a/mk/docs.mk b/mk/docs.mk
deleted file mode 100644
index 6c0be654e1f..00000000000
--- a/mk/docs.mk
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# The various pieces of standalone documentation.
-#
-# The DOCS variable is their names (with no file extension).
-#
-# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the
-# rustdoc invocation for xyz.
-#
-# RUSTDOC_DEPS_xyz are extra dependencies for the rustdoc invocation
-# on xyz.
-#
-# L10N_LANGS are the languages for which the docs have been
-# translated.
-######################################################################
-DOCS := index \
-    complement-lang-faq complement-design-faq complement-project-faq \
-    rustdoc reference grammar
-
-# Legacy guides, preserved for a while to reduce the number of 404s
-DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
-    guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \
-    guide-testing tutorial intro
-
-
-RUSTDOC_DEPS_reference := doc/full-toc.inc
-RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc
-
-L10N_LANGS := ja
-
-# Generally no need to edit below here.
-
-# The options are passed to the documentation generators.
-RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \
-	--html-in-header=doc/favicon.inc \
-	--html-after-content=doc/footer.inc \
-	--markdown-playground-url='https://play.rust-lang.org/'
-
-RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css
-
-# The rustdoc executable...
-RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD))
-# ...with rpath included in case --disable-rpath was provided to
-# ./configure
-RUSTDOC = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTDOC_EXE)
-
-# The rustbook executable...
-RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD))
-# ...with rpath included in case --disable-rpath was provided to
-# ./configure
-RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE)
-
-# The error_index_generator executable...
-ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error_index_generator$(X_$(CFG_BUILD))
-ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
-ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown
-
-D := $(S)src/doc
-
-DOC_TARGETS := book nomicon error-index
-COMPILER_DOC_TARGETS :=
-DOC_L10N_TARGETS :=
-
-# If NO_REBUILD is set then break the dependencies on rustdoc so we
-# build the documentation without having to rebuild rustdoc.
-ifeq ($(NO_REBUILD),)
-HTML_DEPS := $(RUSTDOC_EXE)
-else
-HTML_DEPS :=
-endif
-
-######################################################################
-# Rust version
-######################################################################
-
-HTML_DEPS += doc/version_info.html
-doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
-                       $(wildcard $(D)/*.*) | doc/
-	@$(call E, version-info: $@)
-	$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \
-                s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \
-                s/STAMP/$(CFG_VER_HASH)/;" $< >$@
-
-GENERATED += doc/version_info.html
-
-######################################################################
-# Docs from rustdoc
-######################################################################
-
-doc/:
-	@mkdir -p $@
-
-HTML_DEPS += doc/rust.css
-doc/rust.css: $(D)/rust.css | doc/
-	@$(call E, cp: $@)
-	$(Q)cp -PRp $< $@ 2> /dev/null
-
-HTML_DEPS += doc/favicon.inc
-doc/favicon.inc: $(D)/favicon.inc | doc/
-	@$(call E, cp: $@)
-	$(Q)cp -PRp $< $@ 2> /dev/null
-
-doc/full-toc.inc: $(D)/full-toc.inc | doc/
-	@$(call E, cp: $@)
-	$(Q)cp -PRp $< $@ 2> /dev/null
-
-HTML_DEPS += doc/footer.inc
-doc/footer.inc: $(D)/footer.inc | doc/
-	@$(call E, cp: $@)
-	$(Q)cp -PRp $< $@ 2> /dev/null
-
-# The (english) documentation for each doc item.
-DOC_TARGETS += doc/not_found.html
-doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
-	@$(call E, rustdoc: $@)
-	$(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \
-		--markdown-no-toc \
-		--markdown-css https://doc.rust-lang.org/rust.css $<
-
-define DEF_DOC
-
-# HTML (rustdoc)
-DOC_TARGETS += doc/$(1).html
-doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/
-	@$$(call E, rustdoc: $$@)
-	$$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$<
-
-endef
-
-$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname))))
-
-
-######################################################################
-# Rustdoc (libstd/extra)
-######################################################################
-
-
-# The library documenting macro
-#
-# $(1) - The crate name (std/extra)
-#
-# Passes --cfg stage2 to rustdoc because it uses the stage2 librustc.
-define DEF_LIB_DOC
-
-# If NO_REBUILD is set then break the dependencies on rustdoc so we
-# build crate documentation without having to rebuild rustdoc.
-ifeq ($(NO_REBUILD),)
-LIB_DOC_DEP_$(1) = \
-	$$(CRATEFILE_$(1)) \
-	$$(RSINPUTS_$(1)) \
-	$$(RUSTDOC_EXE) \
-	$$(foreach dep,$$(RUST_DEPS_$(1)_T_$(CFG_BUILD)), \
-		$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) \
-	$$(foreach dep,$$(filter $$(DOC_CRATES), $$(RUST_DEPS_$(1)_T_$(CFG_BUILD))), \
-		doc/$$(dep)/)
-else
-LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
-endif
-
-doc/$(1)/:
-	$$(Q)mkdir -p $$@
-
-doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
-doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
-	@$$(call E, rustdoc: $$@)
-	$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
-		$$(RUSTDOC) --cfg dox --cfg stage2 $$(RUSTFLAGS_$(1)) $$<
-endef
-
-$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate))))
-
-COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html)
-ifdef CFG_ENABLE_COMPILER_DOCS
-  DOC_TARGETS += $(COMPILER_DOC_TARGETS)
-else
-  DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html)
-endif
-
-ifdef CFG_DISABLE_DOCS
-  $(info cfg: disabling doc build (CFG_DISABLE_DOCS))
-  DOC_TARGETS :=
-  COMPILER_DOC_TARGETS :=
-endif
-
-docs: $(DOC_TARGETS)
-doc: docs
-compiler-docs: $(COMPILER_DOC_TARGETS)
-
-book: doc/book/index.html
-
-doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/book/*.md) | doc/
-	@$(call E, rustbook: $@)
-	$(Q)rm -rf doc/book
-	$(Q)$(RUSTBOOK) build $(S)src/doc/book doc/book
-
-nomicon: doc/nomicon/index.html
-
-doc/nomicon/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/nomicon/*.md) | doc/
-	@$(call E, rustbook: $@)
-	$(Q)rm -rf doc/nomicon
-	$(Q)$(RUSTBOOK) build $(S)src/doc/nomicon doc/nomicon
-
-error-index: doc/error-index.html
-
-# Metadata used to generate the index is created as a side effect of
-# the build so this depends on every crate being up to date.
-doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
-	$(Q)$(call E, error_index_generator: $@)
-	$(Q)$(ERR_IDX_GEN)
-
-doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/
-	$(Q)$(call E, error_index_generator: $@)
-	$(Q)$(ERR_IDX_GEN_MD)
diff --git a/mk/grammar.mk b/mk/grammar.mk
deleted file mode 100644
index 1bd042adb21..00000000000
--- a/mk/grammar.mk
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-BG = $(CFG_BUILD_DIR)/grammar/
-SG = $(S)src/grammar/
-B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
-L = $(B)lib/rustlib/$(CFG_BUILD)/lib
-LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
-RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
-ifeq ($(CFG_OSTYPE),apple-darwin)
-	FLEX_LDFLAGS=-ll
-else
-	FLEX_LDFLAGS=-lfl
-endif
-
-# Run the reference lexer against libsyntax and compare the tokens and spans.
-# If "// ignore-lexer-test" is present in the file, it will be ignored.
-#
-# $(1) is the file to test.
-define LEXER_TEST
-grep "// ignore-lexer-test" $(1) ; \
-  if [ $$? -eq 1 ]; then \
-   CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \
-   | $(B)grammar/verify $(1) ; \
-  fi
-endef
-
-$(BG):
-	$(Q)mkdir -p $(BG)
-
-$(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
-	$(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4
-	$(Q)$(CFG_JAVAC) -d $(BG) -classpath $(CFG_ANTLR4_JAR) $(BG)RustLexer.java
-
-check-build-lexer-verifier: $(BG)verify
-
-ifeq ($(NO_REBUILD),)
-VERIFY_DEPS :=  rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc
-else
-VERIFY_DEPS :=
-endif
-
-$(BG)verify: $(BG) $(SG)verify.rs $(VERIFY_DEPS)
-	$(Q)$(RUSTC) --out-dir $(BG) -L $(L) $(SG)verify.rs
-
-ifdef CFG_JAVAC
-ifdef CFG_ANTLR4
-ifdef CFG_GRUN
-check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier
-	$(info Verifying libsyntax against the reference lexer ...)
-	$(Q)$(SG)check.sh $(S) "$(BG)" \
-		"$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-else
-$(info cfg: lexer tooling not available, skipping lexer test...)
-check-lexer:
-
-endif
-
-$(BG)lex.yy.c: $(SG)lexer.l $(BG)
-	@$(call E, flex: $@)
-	$(Q)$(CFG_FLEX) -o $@ $<
-
-$(BG)lexer-lalr.o: $(BG)lex.yy.c $(BG)parser-lalr.tab.h
-	@$(call E, cc: $@)
-	$(Q)$(CFG_CC) -include $(BG)parser-lalr.tab.h -c -o $@ $<
-
-$(BG)parser-lalr.tab.c $(BG)parser-lalr.tab.h: $(SG)parser-lalr.y
-	@$(call E, bison: $@)
-	$(Q)$(CFG_BISON) $< --output=$(BG)parser-lalr.tab.c --defines=$(BG)parser-lalr.tab.h \
-		--name-prefix=rs --warnings=error=all
-
-$(BG)parser-lalr.o: $(BG)parser-lalr.tab.c
-	@$(call E, cc: $@)
-	$(Q)$(CFG_CC) -c -o $@ $<
-
-$(BG)parser-lalr-main.o: $(SG)parser-lalr-main.c
-	@$(call E, cc: $@)
-	$(Q)$(CFG_CC) -std=c99 -c -o $@ $<
-
-$(BG)parser-lalr: $(BG)parser-lalr.o $(BG)parser-lalr-main.o $(BG)lexer-lalr.o
-	@$(call E, cc: $@)
-	$(Q)$(CFG_CC) -o $@ $^ $(FLEX_LDFLAGS)
-
-
-ifdef CFG_FLEX
-ifdef CFG_BISON
-check-grammar: $(BG) $(BG)parser-lalr
-	$(info Verifying grammar ...)
-	$(SG)testparser.py -p $(BG)parser-lalr -s $(S)src
-
-else
-$(info cfg: bison not available, skipping parser test...)
-check-grammar:
-
-endif
-else
-$(info cfg: flex not available, skipping parser test...)
-check-grammar:
-
-endif
diff --git a/mk/host.mk b/mk/host.mk
deleted file mode 100644
index d17479bd894..00000000000
--- a/mk/host.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# Generic rule for copying any target crate to a host crate. This rule will also
-# promote any dependent rust crates up to their host locations as well
-#
-# $(1) - the stage to copy from
-# $(2) - the stage to copy to
-# $(3) - the host triple
-# $(4) - the target triple (same as $(3))
-# $(5) - the name of the crate being processed
-define CP_HOST_STAGE_N_CRATE
-
-ifeq ($$(ONLY_RLIB_$(5)),)
-$$(HLIB$(2)_H_$(4))/stamp.$(5): \
-	$$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \
-	$$(RUST_DEPS_$(5)_T_$(3):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
-	| $$(HLIB$(2)_H_$(4))/
-	@$$(call E, cp: $$(@D)/lib$(5))
-	$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
-	$$(Q)cp $$< $$@
-	$$(Q)cp -R $$(TLIB$(1)_T_$(3)_H_$(4))/$$(call CFG_LIB_GLOB_$(3),$(5)) \
-	        $$(HLIB$(2)_H_$(4))
-	$$(call LIST_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
-else
-$$(HLIB$(2)_H_$(4))/stamp.$(5):
-	$$(Q)touch $$@
-endif
-
-endef
-
-# Same as the above macro, but for tools instead of crates
-define CP_HOST_STAGE_N_TOOL
-
-$$(HBIN$(2)_H_$(4))/$(5)$$(X_$(3)): \
-	$$(TBIN$(1)_T_$(3)_H_$(4))/$(5)$$(X_$(3)) \
-	$$(TOOL_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
-	| $$(HBIN$(2)_H_$(4))/
-	@$$(call E, cp: $$@)
-	$$(Q)cp $$< $$@
-
-endef
-
-
-# Miscellaneous rules for just making a few directories.
-#
-# $(1) - the stage to copy from
-# $(2) - the stage to copy to
-# $(3) - the target triple
-# $(4) - the host triple (same as $(3))
-define CP_HOST_STAGE_N
-
-ifneq ($(CFG_LIBDIR_RELATIVE),bin)
-$$(HLIB$(2)_H_$(4))/:
-	@mkdir -p $$@
-endif
-
-endef
-
-$(foreach t,$(CFG_HOST), \
-	$(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
-	$(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
-	$(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))
-
-$(foreach crate,$(CRATES), \
- $(foreach t,$(CFG_HOST), \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,0,1,$(t),$(t),$(crate))) \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,1,2,$(t),$(t),$(crate))) \
-  $(eval $(call CP_HOST_STAGE_N_CRATE,2,3,$(t),$(t),$(crate)))))
-
-$(foreach tool,$(TOOLS), \
- $(foreach t,$(CFG_HOST), \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,0,1,$(t),$(t),$(tool))) \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,1,2,$(t),$(t),$(tool))) \
-  $(eval $(call CP_HOST_STAGE_N_TOOL,2,3,$(t),$(t),$(tool)))))
diff --git a/mk/install.mk b/mk/install.mk
deleted file mode 100644
index be212869f01..00000000000
--- a/mk/install.mk
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-RUN_INSTALLER = cd tmp/empty_dir && \
-	sh ../../tmp/dist/$(1)/install.sh \
-		--prefix="$(DESTDIR)$(CFG_PREFIX)" \
-		--libdir="$(DESTDIR)$(CFG_LIBDIR)" \
-		--mandir="$(DESTDIR)$(CFG_MANDIR)" \
-		--docdir="$(DESTDIR)$(CFG_DOCDIR)"
-
-install:
-ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
-# Build the dist as the original user
-	$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install
-else
-	$(Q)$(MAKE) prepare_install
-endif
-ifeq ($(CFG_DISABLE_DOCS),)
-	$(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --disable-ldconfig
-endif
-	$(Q)$(foreach target,$(CFG_TARGET),\
-	  ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --disable-ldconfig);)
-	$(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD))
-# Remove tmp files because it's a decent amount of disk space
-	$(Q)rm -R tmp/dist
-
-prepare_install: dist-tar-bins | tmp/empty_dir
-
-uninstall:
-ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
-# Build the dist as the original user
-	$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall
-else
-	$(Q)$(MAKE) prepare_uninstall
-endif
-ifeq ($(CFG_DISABLE_DOCS),)
-	$(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --uninstall
-endif
-	$(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD)) --uninstall
-	$(Q)$(foreach target,$(CFG_TARGET),\
-	  ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --uninstall);)
-# Remove tmp files because it's a decent amount of disk space
-	$(Q)rm -R tmp/dist
-
-prepare_uninstall: dist-tar-bins | tmp/empty_dir
-
-.PHONY: install prepare_install uninstall prepare_uninstall
-
-tmp/empty_dir:
-	mkdir -p $@
-
-######################################################################
-# Android remote installation
-######################################################################
-
-# Android runtime setup
-# FIXME: This probably belongs somewhere else
-
-# target platform specific variables for android
-define DEF_ADB_DEVICE_STATUS
-CFG_ADB_DEVICE_STATUS=$(1)
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-    $(if $(findstring adb,$(CFG_ADB)), \
-      $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
-        $(info install: install-runtime-target for $(target) enabled \
-          $(info install: android device attached) \
-          $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
-        $(info install: install-runtime-target for $(target) disabled \
-          $(info install: android device not attached) \
-          $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
-      ), \
-      $(info install: install-runtime-target for $(target) disabled \
-        $(info install: adb not found) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
-    ), \
-  ) \
-)
-
-ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
-$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
-L_TOKEN := $(word 2,$(MAKECMDGOALS))
-ifeq ($(L_TOKEN),)
-CFG_RUNTIME_PUSH_DIR=/system/lib
-else
-CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
-endif
-
-ifeq ($(CFG_ADB_DEVICE_STATUS),true)
-ifdef VERBOSE
- ADB = adb $(1)
- ADB_PUSH = adb push $(1) $(2)
- ADB_SHELL = adb shell $(1) $(2)
-else
- ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
- ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
- ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
-endif
-
-define INSTALL_RUNTIME_TARGET_N
-install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
-	$$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
-	$$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \
-	    $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)), \
-			$$(CFG_RUNTIME_PUSH_DIR));)
-endef
-
-define INSTALL_RUNTIME_TARGET_CLEANUP_N
-install-runtime-target-$(1)-cleanup:
-	$$(Q)$$(call ADB,remount)
-	$$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \
-	    $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
-  $(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \
-  $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \
-  ))
-
-install-runtime-target: \
-	install-runtime-target-arm-linux-androideabi-cleanup \
-	install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
-else
-install-runtime-target:
-	@echo "No device to install runtime library"
-	@echo
-endif
-endif
diff --git a/mk/llvm.mk b/mk/llvm.mk
deleted file mode 100644
index 76367e6f3a6..00000000000
--- a/mk/llvm.mk
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-
-ifdef CFG_ENABLE_FAST_MAKE
-LLVM_DEPS := $(S)/.gitmodules
-else
-
-# This is just a rough approximation of LLVM deps
-LLVM_DEPS_SRC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)lib,*cpp *hpp)
-LLVM_DEPS_INC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)include,*cpp *hpp)
-LLVM_DEPS=$(LLVM_DEPS_SRC) $(LLVM_DEPS_INC)
-endif
-
-ifdef CFG_DISABLE_OPTIMIZE_LLVM
-LLVM_BUILD_CONFIG_MODE := Debug
-else ifdef CFG_ENABLE_LLVM_RELEASE_DEBUGINFO
-LLVM_BUILD_CONFIG_MODE := RelWithDebInfo
-else
-LLVM_BUILD_CONFIG_MODE := Release
-endif
-
-define DEF_LLVM_RULES
-
-ifeq ($(1),$$(CFG_BUILD))
-LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS)
-else
-LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
-endif
-
-# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
-ifeq ($(CFG_LLVM_ROOT),)
-
-LLVM_STAMP_$(1) = $(S)src/rustllvm/llvm-auto-clean-trigger
-LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
-
-$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
-
-ifneq ($$(CFG_NINJA),)
-BUILD_LLVM_$(1) := $$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
-else ifeq ($$(findstring msvc,$(1)),msvc)
-BUILD_LLVM_$(1) := $$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
-			--config $$(LLVM_BUILD_CONFIG_MODE)
-else
-BUILD_LLVM_$(1) := $$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
-endif
-
-$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
-	@$$(call E, cmake: llvm)
-	$$(Q)if ! cmp $$(LLVM_STAMP_$(1)) $$(LLVM_DONE_$(1)); then \
-		$$(MAKE) clean-llvm$(1); \
-		$$(BUILD_LLVM_$(1)); \
-	fi
-	$$(Q)cp $$(LLVM_STAMP_$(1)) $$@
-
-ifneq ($$(CFG_NINJA),)
-clean-llvm$(1):
-	@$$(call E, clean: llvm)
-	$$(Q)$$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1)) -t clean
-else ifeq ($$(findstring msvc,$(1)),msvc)
-clean-llvm$(1):
-	@$$(call E, clean: llvm)
-	$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
-		--config $$(LLVM_BUILD_CONFIG_MODE) \
-		--target clean
-else
-clean-llvm$(1):
-	@$$(call E, clean: llvm)
-	$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
-endif
-
-else
-clean-llvm$(1):
-endif
-
-$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))
-
-ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
-LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
-					-print-file-name=lib$(CFG_STDCPP_NAME).a))"
-else
-LLVM_STDCPP_RUSTFLAGS_$(1) =
-endif
-
-
-# LLVM linkage:
-# Note: Filter with llvm-config so that optional targets which aren't present
-# don't cause errors (ie PNaCl's target is only present within PNaCl's LLVM
-# fork).
-LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
-$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
-	$(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(filter $$(shell \
-				$$(LLVM_CONFIG_$(1)) --components), \
-                        $(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS)" \
-		"$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" $$(LLVM_CONFIG_$(1)) \
-		"$(CFG_STDCPP_NAME)" "$$(CFG_USING_LIBCPP)"
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_LLVM_RULES,$(host))))
-
-$(foreach host,$(CFG_HOST), \
- $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
-
-# This can't be done in target.mk because it's included before this file.
-define LLVM_LINKAGE_DEPS
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(2))
-RUSTFLAGS$(1)_rustc_llvm_T_$(2) += $$(shell echo $$(LLVM_ALL_COMPONENTS_$(2)) | tr '-' '_' |\
-	sed -e 's/^ //;s/\([^ ]*\)/\-\-cfg "llvm_component=\\"\1\\""/g')
-endef
-
-$(foreach source,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \
-  $(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source)))))
diff --git a/mk/main.mk b/mk/main.mk
deleted file mode 100644
index 6b409eebc74..00000000000
--- a/mk/main.mk
+++ /dev/null
@@ -1,641 +0,0 @@
-# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# Version numbers and strings
-######################################################################
-
-# The version number
-CFG_RELEASE_NUM=1.17.0
-
-# An optional number to put after the label, e.g. '.2' -> '-beta.2'
-# NB Make sure it starts with a dot to conform to semver pre-release
-# versions (section 9)
-CFG_PRERELEASE_VERSION=.1
-
-ifeq ($(CFG_RELEASE_CHANNEL),stable)
-# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
-CFG_RELEASE=$(CFG_RELEASE_NUM)
-# This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
-CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
-CFG_DISABLE_UNSTABLE_FEATURES=1
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),beta)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
-# When building beta distributables just reuse the same "beta" name
-# so when we upload we'll always override the previous beta. This
-# doesn't actually impact the version reported by rustc - it's just
-# for file naming.
-CFG_PACKAGE_VERS=beta
-CFG_DISABLE_UNSTABLE_FEATURES=1
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),nightly)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
-# When building nightly distributables just reuse the same "nightly" name
-# so when we upload we'll always override the previous nighly. This
-# doesn't actually impact the version reported by rustc - it's just
-# for file naming.
-CFG_PACKAGE_VERS=nightly
-endif
-ifeq ($(CFG_RELEASE_CHANNEL),dev)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-dev
-CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev
-endif
-
-# Append a version-dependent hash to each library, so we can install different
-# versions in the same place
-CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
-
-# If local-rust is the same major.minor as the current version, then force a local-rebuild
-ifdef CFG_ENABLE_LOCAL_RUST
-SEMVER_PREFIX=$(shell echo $(CFG_RELEASE_NUM) | grep -E -o '^[[:digit:]]+\.[[:digit:]]+')
-LOCAL_RELEASE=$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT))
-ifneq (,$(filter $(SEMVER_PREFIX).%,$(LOCAL_RELEASE)))
-    CFG_INFO := $(info cfg: auto-detected local-rebuild using $(LOCAL_RELEASE))
-    CFG_ENABLE_LOCAL_REBUILD = 1
-endif
-endif
-
-# The name of the package to use for creating tarballs, installers etc.
-CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
-
-# The version string plus commit information - this is what rustc reports
-CFG_VERSION = $(CFG_RELEASE)
-CFG_GIT_DIR := $(CFG_SRC_DIR).git
-# since $(CFG_GIT) may contain spaces (especially on Windows),
-# we need to escape them. (" " to r"\ ")
-# Note that $(subst ...) ignores space after `subst`,
-# so we use a hack: define $(SPACE) which contains space character.
-SPACE :=
-SPACE +=
-ifneq ($(CFG_GIT),)
-ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
-    CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
-    CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
-    CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
-    CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
-endif
-endif
-
-# Windows exe's need numeric versions - don't use anything but
-# numbers and dots here
-CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
-
-CFG_INFO := $(info cfg: version $(CFG_VERSION))
-
-######################################################################
-# More configuration
-######################################################################
-
-MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
-MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
-ifneq ($(NO_MKFILE_DEPS),)
-MKFILE_DEPS :=
-endif
-NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
-NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
-
-ifneq ($(MAKE_RESTARTS),)
-CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
-endif
-
-CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
-CFG_INFO := $(info cfg: host triples $(CFG_HOST))
-CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
-
-ifneq ($(wildcard $(NON_BUILD_HOST)),)
-CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
-endif
-ifneq ($(wildcard $(NON_BUILD_TARGET)),)
-CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
-endif
-
-CFG_RUSTC_FLAGS := $(RUSTFLAGS)
-CFG_GCCISH_CFLAGS :=
-CFG_GCCISH_LINK_FLAGS :=
-
-CFG_JEMALLOC_FLAGS :=
-
-ifdef CFG_DISABLE_OPTIMIZE
-  $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
-  CFG_RUSTC_FLAGS +=
-  CFG_JEMALLOC_FLAGS += --enable-debug
-else
-  # The rtopt cfg turns off runtime sanity checks
-  CFG_RUSTC_FLAGS += -O --cfg rtopt
-endif
-
-CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
-
-ifdef CFG_ENABLE_DEBUG_ASSERTIONS
-  $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
-  CFG_RUSTC_FLAGS += -C debug-assertions=on
-endif
-
-ifdef CFG_ENABLE_DEBUGINFO
-  $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO))
-  CFG_RUSTC_FLAGS += -g
-else ifdef CFG_ENABLE_DEBUGINFO_LINES
-  $(info cfg: enabling line number debuginfo (CFG_ENABLE_DEBUGINFO_LINES))
-  CFG_RUSTC_FLAGS += -Cdebuginfo=1
-endif
-
-ifdef SAVE_TEMPS
-  CFG_RUSTC_FLAGS += -C save-temps
-endif
-ifdef ASM_COMMENTS
-  CFG_RUSTC_FLAGS += -Z asm-comments
-endif
-ifdef TIME_PASSES
-  CFG_RUSTC_FLAGS += -Z time-passes
-endif
-ifdef TIME_LLVM_PASSES
-  CFG_RUSTC_FLAGS += -Z time-llvm-passes
-endif
-ifdef TRACE
-  CFG_RUSTC_FLAGS += -Z trace
-endif
-ifndef CFG_DISABLE_RPATH
-CFG_RUSTC_FLAGS += -C rpath
-endif
-
-# The executables crated during this compilation process have no need to include
-# static copies of libstd and libextra. We also generate dynamic versions of all
-# libraries, so in the interest of space, prefer dynamic linking throughout the
-# compilation process.
-#
-# Note though that these flags are omitted for the *bins* in stage2+. This means
-# that the snapshot will be generated with a statically linked rustc so we only
-# have to worry about the distribution of one file (with its native dynamic
-# dependencies)
-RUSTFLAGS_STAGE0 += -C prefer-dynamic
-RUSTFLAGS_STAGE1 += -C prefer-dynamic
-RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
-RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
-
-# Landing pads require a lot of codegen. We can get through bootstrapping faster
-# by not emitting them.
-
-ifdef CFG_DISABLE_STAGE0_LANDING_PADS
-  RUSTFLAGS_STAGE0 += -Z no-landing-pads
-endif
-
-# platform-specific auto-configuration
-include $(CFG_SRC_DIR)mk/platform.mk
-
-# Run the stage1/2 compilers under valgrind
-ifdef VALGRIND_COMPILE
-  CFG_VALGRIND_COMPILE := $(CFG_VALGRIND)
-else
-  CFG_VALGRIND_COMPILE :=
-endif
-
-
-ifndef CFG_DISABLE_VALGRIND_RPASS
-  $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS))
-  $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND))
-  CFG_VALGRIND_RPASS :=$(CFG_VALGRIND)
-else
-  $(info cfg: disabling valgrind run-pass tests)
-  CFG_VALGRIND_RPASS :=
-endif
-
-
-ifdef CFG_ENABLE_VALGRIND
-  $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
-  CFG_JEMALLOC_FLAGS += --enable-valgrind
-else
-  CFG_VALGRIND :=
-endif
-
-######################################################################
-# Target-and-rule "utility variables"
-######################################################################
-
-define DEF_FOR_TARGET
-X_$(1) := $(CFG_EXE_SUFFIX_$(1))
-ifndef CFG_LLVM_TARGET_$(1)
-CFG_LLVM_TARGET_$(1) := $(1)
-endif
-endef
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEF_FOR_TARGET,$(target))))
-
-# "Source" files we generate in builddir along the way.
-GENERATED :=
-
-# Delete the built-in rules.
-.SUFFIXES:
-%:: %,v
-%:: RCS/%,v
-%:: RCS/%
-%:: s.%
-%:: SCCS/s.%
-
-
-######################################################################
-# Cleaning out old crates
-######################################################################
-
-# $(1) is the path for directory to match against
-# $(2) is the glob to use in the match
-#
-# Note that a common bug is to accidentally construct the glob denoted
-# by $(2) with a space character prefix, which invalidates the
-# construction $(1)$(2).
-define CHECK_FOR_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
-endef
-
-# Same interface as above, but deletes rather than just listing the files.
-ifdef VERBOSE
-define REMOVE_ALL_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
-endef
-else
-define REMOVE_ALL_OLD_GLOB_MATCHES
-  $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
-endef
-endif
-
-# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
-# than in the macros above because it needs the result of running the
-# `ls` command after other rules in the command list have run; the
-# macro-expander for $(wildcard ...) would deliver its results too
-# soon. (This is in contrast to the macros above, which are meant to
-# be run at the outset of a command list in a rule.)
-ifdef VERBOSE
-define LIST_ALL_OLD_GLOB_MATCHES
-  @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
-  @( ls $(1) 2>/dev/null || true )
-endef
-else
-define LIST_ALL_OLD_GLOB_MATCHES
-endef
-endif
-
-######################################################################
-# LLVM macros
-######################################################################
-
-LLVM_OPTIONAL_COMPONENTS=x86 arm aarch64 mips powerpc pnacl systemz jsbackend msp430 sparc
-LLVM_REQUIRED_COMPONENTS=ipo bitreader bitwriter linker asmparser mcjit \
-                interpreter instrumentation
-
-ifneq ($(CFG_LLVM_ROOT),)
-# Ensure we only try to link targets that the installed LLVM actually has:
-LLVM_COMPONENTS := $(filter $(shell $(CFG_LLVM_ROOT)/bin/llvm-config$(X_$(CFG_BUILD)) --components),\
-			$(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS)
-else
-LLVM_COMPONENTS := $(LLVM_OPTIONAL_COMPONENTS) $(LLVM_REQUIRED_COMPONENTS)
-endif
-
-# Only build these LLVM tools
-LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
-
-define DEF_LLVM_VARS
-# The configure script defines these variables with the target triples
-# separated by Z. This defines new ones with the expected format.
-ifeq ($$(CFG_LLVM_ROOT),)
-CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
-CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
-else
-CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT)
-endif
-
-# Any rules that depend on LLVM should depend on LLVM_CONFIG
-LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
-LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
-LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1))
-LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
-LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
-LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
-LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
-LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))"
-LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
-ifeq ($$(findstring freebsd,$(1)),freebsd)
-# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
-# so we replace -I with -iquote to ensure that it searches bundled LLVM first.
-LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
-else
-LLVM_CXXFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags)
-endif
-LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
-
-LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
-LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
-
-LLVM_ALL_COMPONENTS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --components)
-LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_LLVM_VARS,$(host))))
-
-######################################################################
-# Exports for sub-utilities
-######################################################################
-
-# Note that any variable that re-configure should pick up needs to be
-# exported
-
-export CFG_SRC_DIR
-export CFG_SRC_DIR_RELATIVE
-export CFG_BUILD_DIR
-ifdef CFG_VER_DATE
-export CFG_VER_DATE
-endif
-ifdef CFG_VER_HASH
-export CFG_VER_HASH
-endif
-export CFG_VERSION
-export CFG_VERSION_WIN
-export CFG_RELEASE
-export CFG_PACKAGE_NAME
-export CFG_BUILD
-export CFG_RELEASE_CHANNEL
-export CFG_LLVM_ROOT
-export CFG_PREFIX
-export CFG_LIBDIR
-export CFG_LIBDIR_RELATIVE
-export CFG_DISABLE_INJECT_STD_VERSION
-ifdef CFG_DISABLE_UNSTABLE_FEATURES
-CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
-# Turn on feature-staging
-export CFG_DISABLE_UNSTABLE_FEATURES
-# Subvert unstable feature lints to do the self-build
-endif
-ifdef CFG_MUSL_ROOT
-export CFG_MUSL_ROOT
-endif
-
-export RUSTC_BOOTSTRAP := 1
-
-######################################################################
-# Per-stage targets and runner
-######################################################################
-
-# Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
-# This 'function' will determine which debugger scripts to copy based on a
-# target triple. See debuggers.mk for more information.
-TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
- $(if $(findstring windows-msvc,$(1)),none,all)
-
-STAGES = 0 1 2 3
-
-define SREQ
-# $(1) is the stage number
-# $(2) is the target triple
-# $(3) is the host triple
-
-# Destinations of artifacts for the host compiler
-HROOT$(1)_H_$(3) = $(3)/stage$(1)
-HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
-
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-# On Windows we always store host runtime libraries in the 'bin' directory because
-# there's no rpath. Target libraries go under $CFG_LIBDIR_RELATIVE (usually 'lib').
-HLIB_RELATIVE$(1)_H_$(3) = bin
-TROOT$(1)_T_$(2)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)/rustlib/$(2)
-# Remove the next 3 lines after a snapshot
-ifeq ($(1),0)
-RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib
-endif
-
-else
-
-ifeq ($(1),0)
-HLIB_RELATIVE$(1)_H_$(3) = lib
-else
-HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE)
-endif
-TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
-
-endif
-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(HLIB_RELATIVE$(1)_H_$(3))
-
-# Destinations of artifacts for target architectures
-TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
-TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
-
-# Preqrequisites for using the stageN compiler
-ifeq ($(1),0)
-HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
-else
-HSREQ$(1)_H_$(3) = \
-	$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-	$$(MKFILE_DEPS) \
-	tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
-endif
-
-# Prerequisites for using the stageN compiler to build target artifacts
-TSREQ$(1)_T_$(2)_H_$(3) = \
-	$$(HSREQ$(1)_H_$(3)) \
-	$$(foreach obj,$$(REQUIRED_OBJECTS_$(2)),\
-		$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))
-
-# Prerequisites for a working stageN compiler and libraries, for a specific
-# target
-SREQ$(1)_T_$(2)_H_$(3) = \
-	$$(TSREQ$(1)_T_$(2)_H_$(3)) \
-	$$(foreach dep,$$(TARGET_CRATES_$(2)), \
-	    $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-	tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
-
-# Prerequisites for a working stageN compiler and complete set of target
-# libraries
-CSREQ$(1)_T_$(2)_H_$(3) = \
-	$$(TSREQ$(1)_T_$(2)_H_$(3)) \
-	$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-	$$(foreach dep,$$(HOST_CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
-
-ifeq ($(1),0)
-# Don't run the stage0 compiler under valgrind - that ship has sailed
-CFG_VALGRIND_COMPILE$(1) =
-else
-CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
-endif
-
-# Add RUSTFLAGS_STAGEN values to the build command
-EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
-
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
-
-endef
-
-# Same macro/variables as above, but defined in a separate loop so it can use
-# all the variables above for all archs. The RPATH_VAR setup sometimes needs to
-# reach across triples to get things in order.
-#
-# Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
-# * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
-#   environment to access or extend the lookup path for dynamic
-#   libraries.  Note on Windows, that key is `$PATH`, and thus not
-#   only conflates programs with dynamic libraries, but also often
-#   contains spaces which confuse make.
-# * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
-# * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
-#
-# Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
-# above settings.
-#
-define SREQ_CMDS
-
-ifeq ($$(OSTYPE_$(3)),apple-darwin)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
-else
-ifeq ($$(CFG_WINDOWSY_$(3)),1)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
-else
-ifeq ($$(OSTYPE_$(3)),unknown-haiku)
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LIBRARY_PATH
-else
-  LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
-endif
-endif
-endif
-
-LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
-    $$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib
-LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
-    $$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(3))
-
-HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
-  $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
-TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
-  $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
-
-RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
-
-# Pass --cfg stage0 only for the build->host part of stage0;
-# if you're building a cross config, the host->* parts are
-# effectively stage1, since it uses the just-built stage0.
-#
-# Also be sure to use the right rpath because we're loading libraries from the
-# CFG_BUILD's stage1 directory for our target, so switch this one instance of
-# `RPATH_VAR` to get the bootstrap working.
-ifeq ($(1),0)
-ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
-
-RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR1_T_$(2)_H_$$(CFG_BUILD))
-else
-ifdef CFG_ENABLE_LOCAL_REBUILD
-# Assume the local-rebuild rustc already has stage1 features too.
-CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
-endif
-endif
-endif
-
-STAGE$(1)_T_$(2)_H_$(3) := \
-	$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
-		$$(call CFG_RUN_TARG_$(3),$(1), \
-		$$(CFG_VALGRIND_COMPILE$(1)) \
-		$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-		--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
-		$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
-                $$(RUSTC_FLAGS_$(2))
-
-endef
-
-$(foreach build,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call SREQ,$(stage),$(target),$(build))))))))
-
-$(foreach build,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
-
-######################################################################
-# rustc-H-targets
-#
-# Builds a functional Rustc for the given host.
-######################################################################
-
-define DEF_RUSTC_STAGE_TARGET
-# $(1) == architecture
-# $(2) == stage
-
-rustc-stage$(2)-H-$(1): \
-	$$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach stage,1 2 3, \
-  $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
-
-rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
-rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
-rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
-
-define DEF_RUSTC_TARGET
-# $(1) == architecture
-
-rustc-H-$(1): rustc-stage2-H-$(1)
-endef
-
-$(foreach host,$(CFG_TARGET), \
- $(eval $(call DEF_RUSTC_TARGET,$(host))))
-
-rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
-rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
-rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
-rustc: rustc-H-$(CFG_BUILD)
-
-rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
-
-######################################################################
-# Entrypoint rule
-######################################################################
-
-.DEFAULT_GOAL := all
-
-define ALL_TARGET_N
-ifneq ($$(findstring $(1),$$(CFG_HOST)),)
-# This is a host
-all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
-else
-# This is a target only
-all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
-endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(foreach host,$(CFG_HOST), \
- $(eval $(call ALL_TARGET_N,$(target),$(host)))))
-
-ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
-	$(foreach host,$(CFG_HOST), \
- all-target-$(target)-host-$(host)))
-
-all-no-docs: $(ALL_TARGET_RULES) $(GENERATED)
-all: all-no-docs docs
-
-######################################################################
-# Build system documentation
-######################################################################
-
-# $(1) is the name of the doc <section> in Makefile.in
-# pick everything between tags | remove first line | remove last line
-# | remove extra (?) line | strip leading `#` from lines
-SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
-
-help:
-	$(call SHOW_DOCS,help)
-
-tips:
-	$(call SHOW_DOCS,tips)
-
-nitty-gritty:
-	$(call SHOW_DOCS,nitty-gritty)
diff --git a/mk/platform.mk b/mk/platform.mk
deleted file mode 100644
index 6a7a20cbfdb..00000000000
--- a/mk/platform.mk
+++ /dev/null
@@ -1,250 +0,0 @@
-# Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-
-# Create variables HOST_<triple> containing the host part
-# of each target triple.  For example, the triple i686-darwin-macos
-# would create a variable HOST_i686-darwin-macos with the value
-# i386.
-define DEF_HOST_VAR
-  HOST_$(1) = $(patsubst i%86,i386,$(word 1,$(subst -, ,$(1))))
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t))))
-$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t))))
-
-# Ditto for OSTYPE
-define DEF_OSTYPE_VAR
-  OSTYPE_$(1) = $(subst $(firstword $(subst -, ,$(1)))-,,$(1))
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_OSTYPE_VAR,$(t))))
-$(foreach t,$(CFG_TARGET),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
-
-# On Darwin, we need to run dsymutil so the debugging information ends
-# up in the right place.  On other platforms, it automatically gets
-# embedded into the executable, so use a no-op command.
-CFG_DSYMUTIL := true
-
-# Hack: not sure how to test if a file exists in make other than this
-OS_SUPP = $(patsubst %,--suppressions=%, \
-      $(wildcard $(CFG_SRC_DIR)src/etc/$(CFG_OSTYPE).supp*))
-
-ifdef CFG_DISABLE_OPTIMIZE_CXX
-  $(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
-  CFG_GCCISH_CFLAGS += -O0
-else
-  CFG_GCCISH_CFLAGS += -O2
-endif
-
-# The soname thing is for supporting a statically linked jemalloc.
-# see https://blog.mozilla.org/jseward/2012/06/05/valgrind-now-supports-jemalloc-builds-directly/
-ifdef CFG_VALGRIND
-  CFG_VALGRIND += --error-exitcode=100 \
-                  --fair-sched=try \
-                  --quiet \
-                  --soname-synonyms=somalloc=NONE \
-                  --suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
-                  $(OS_SUPP)
-  ifdef CFG_ENABLE_HELGRIND
-    CFG_VALGRIND += --tool=helgrind
-  else
-    CFG_VALGRIND += --tool=memcheck \
-                    --leak-check=full
-  endif
-endif
-
-# If we actually want to run Valgrind on a given platform, set this variable
-define DEF_GOOD_VALGRIND
-  ifeq ($(OSTYPE_$(1)),unknown-linux-gnu)
-    GOOD_VALGRIND_$(1) = 1
-  endif
-  ifneq (,$(filter $(OSTYPE_$(1)),apple-darwin freebsd))
-    ifeq ($(HOST_$(1)),x86_64)
-      GOOD_VALGRIND_$(1) = 1
-    endif
-  endif
-  ifdef GOOD_VALGRIND_$(t)
-    $$(info cfg: have good valgrind for $(t))
-  else
-    $$(info cfg: no good valgrind for $(t))
-  endif
-endef
-$(foreach t,$(CFG_TARGET),$(eval $(call DEF_GOOD_VALGRIND,$(t))))
-
-AR := ar
-
-define SET_FROM_CFG
-  ifdef CFG_$(1)
-    ifeq ($(origin $(1)),undefined)
-      $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1)))
-      $(1)=$(CFG_$(1))
-    endif
-    ifeq ($(origin $(1)),default)
-      $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1)))
-      $(1)=$(CFG_$(1))
-    endif
-  endif
-endef
-
-$(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \
-  $(eval $(call SET_FROM_CFG,$(cvar))))
-
-CFG_RLIB_GLOB=lib$(1)-*.rlib
-
-include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk)
-
-define ADD_INSTALLED_OBJECTS
-  INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1))
-  REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1))
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call ADD_INSTALLED_OBJECTS,$(target))))
-
-define DEFINE_LINKER
-  ifndef LINK_$(1)
-    LINK_$(1) := $$(CC_$(1))
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEFINE_LINKER,$(target))))
-
-define ADD_JEMALLOC_DEP
-  ifndef CFG_DISABLE_JEMALLOC_$(1)
-    ifndef CFG_DISABLE_JEMALLOC
-      RUST_DEPS_std_T_$(1) += alloc_jemalloc
-      TARGET_CRATES_$(1) += alloc_jemalloc
-    endif
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call ADD_JEMALLOC_DEP,$(target))))
-
-# The -Qunused-arguments sidesteps spurious warnings from clang
-define FILTER_FLAGS
-  ifeq ($$(CFG_USING_CLANG),1)
-    ifneq ($(findstring clang,$$(shell $(CC_$(1)) -v)),)
-      CFG_GCCISH_CFLAGS_$(1) += -Qunused-arguments
-      CFG_GCCISH_CXXFLAGS_$(1) += -Qunused-arguments
-    endif
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call FILTER_FLAGS,$(target))))
-
-# Configure various macros to pass gcc or cl.exe style arguments
-define CC_MACROS
-  CFG_CC_INCLUDE_$(1)=-I $$(1)
-  ifeq ($$(findstring msvc,$(1)),msvc)
-    CFG_CC_OUTPUT_$(1)=-Fo:$$(1)
-    CFG_CREATE_ARCHIVE_$(1)='$$(AR_$(1))' -OUT:$$(1)
-  else
-    CFG_CC_OUTPUT_$(1)=-o $$(1)
-    CFG_CREATE_ARCHIVE_$(1)=$$(AR_$(1)) crus $$(1)
-  endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call CC_MACROS,$(target))))
-
-
-ifeq ($(CFG_CCACHE_CPP2),1)
-  CCACHE_CPP2=1
-  export CCACHE_CPP
-endif
-
-ifdef CFG_CCACHE_BASEDIR
-  CCACHE_BASEDIR=$(CFG_CCACHE_BASEDIR)
-  export CCACHE_BASEDIR
-endif
-
-FIND_COMPILER = $(strip $(1:ccache=))
-
-define CFG_MAKE_TOOLCHAIN
-  # Prepend the tools with their prefix if cross compiling
-  ifneq ($(CFG_BUILD),$(1))
-    ifneq ($$(findstring msvc,$(1)),msvc)
-       CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
-       CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
-       CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
-       AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
-       LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1))
-       RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \
-           -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
-
-       RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
-    endif
-  endif
-
-  CFG_COMPILE_C_$(1) = '$$(call FIND_COMPILER,$$(CC_$(1)))' \
-        $$(CFLAGS) \
-        $$(CFG_GCCISH_CFLAGS) \
-        $$(CFG_GCCISH_CFLAGS_$(1)) \
-        -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
-  CFG_LINK_C_$(1) = $$(CC_$(1)) \
-        $$(LDFLAGS) \
-        $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
-        $$(CFG_GCCISH_LINK_FLAGS_$(1)) \
-        $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
-        $$(call CFG_INSTALL_NAME_$(1),$$(4))
-  CFG_COMPILE_CXX_$(1) = '$$(call FIND_COMPILER,$$(CXX_$(1)))' \
-        $$(CXXFLAGS) \
-        $$(CFG_GCCISH_CFLAGS) \
-        $$(CFG_GCCISH_CXXFLAGS) \
-        $$(CFG_GCCISH_CFLAGS_$(1)) \
-        $$(CFG_GCCISH_CXXFLAGS_$(1)) \
-        -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2)
-  CFG_LINK_CXX_$(1) = $$(CXX_$(1)) \
-        $$(LDFLAGS) \
-        $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
-        $$(CFG_GCCISH_LINK_FLAGS_$(1)) \
-        $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
-        $$(call CFG_INSTALL_NAME_$(1),$$(4))
-
-  ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
-
-  # On Bitrig, we need the relocation model to be PIC for everything
-  ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
-    LLVM_MC_RELOCATION_MODEL="pic"
-  else
-    LLVM_MC_RELOCATION_MODEL="default"
-  endif
-
-  # LLVM changed this flag in 3.9
-  ifdef CFG_LLVM_MC_HAS_RELOCATION_MODEL
-    LLVM_MC_RELOC_FLAG := -relocation-model=$$(LLVM_MC_RELOCATION_MODEL)
-  else
-    LLVM_MC_RELOC_FLAG := -position-independent
-  endif
-
-  # We're using llvm-mc as our assembler because it supports
-  # .cfi pseudo-ops on mac
-  CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(2) | \
-                    $$(LLVM_MC_$$(CFG_BUILD)) \
-                    -assemble \
-                    $$(LLVM_MC_RELOC_FLAG) \
-                    -filetype=obj \
-                    -triple=$(1) \
-                    -o=$$(1)
-  else
-
-  # For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler
-  # FIXME: We should be able to use the LLVM assembler
-  CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
-                   $$(2) -c -o $$(1)
-
-  endif
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call CFG_MAKE_TOOLCHAIN,$(target))))
diff --git a/mk/prepare.mk b/mk/prepare.mk
deleted file mode 100644
index 20e20e9b5df..00000000000
--- a/mk/prepare.mk
+++ /dev/null
@@ -1,251 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# Basic support for producing installation images.
-#
-# The 'prepare' build target copies all release artifacts from the build
-# directory to some other location, placing all binaries, libraries, and
-# docs in their final locations relative to each other.
-#
-# It requires the following variables to be set:
-#
-#   PREPARE_HOST - the host triple
-#   PREPARE_TARGETS - the target triples, space separated
-#   PREPARE_DEST_DIR - the directory to put the image
-
-PREPARE_STAGE=2
-
-DEFAULT_PREPARE_DIR_CMD = umask 022 && mkdir -p
-DEFAULT_PREPARE_BIN_CMD = install -m755
-DEFAULT_PREPARE_LIB_CMD = install -m644
-DEFAULT_PREPARE_MAN_CMD = install -m644
-
-# Create a directory
-# $(1) is the directory
-#
-# XXX: These defines are called to generate make steps.
-# Adding blank lines means two steps from different defines will not end up on
-# the same line.
-define PREPARE_DIR
-
-	@$(call E, prepare: $(1))
-	$(Q)$(PREPARE_DIR_CMD) $(1)
-
-endef
-
-# Copy an executable
-# $(1) is the filename/libname-glob
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_BIN
-
-	@$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1))
-	$(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1)
-
-endef
-
-# Copy a dylib or rlib
-# $(1) is the filename/libname-glob
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_LIB
-
-	@$(call E, prepare: $(PREPARE_WORKING_DEST_LIB_DIR)/$(1))
-	$(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1))))"; \
-	MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)))), \
-                        $(wildcard $(PREPARE_WORKING_DEST_LIB_DIR)/$(1)))"; \
-	if [ -n "$$MATCHES" ]; then \
-	  echo "warning: one or libraries matching Rust library '$(1)'" && \
-	  echo "  (other than '$$LIB_NAME' itself) already present"     && \
-	  echo "  at destination $(PREPARE_WORKING_DEST_LIB_DIR):"      && \
-	  echo $$MATCHES ; \
-	fi
-	$(Q)$(PREPARE_LIB_CMD) `ls -drt1 $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)` $(PREPARE_WORKING_DEST_LIB_DIR)/
-
-endef
-
-# Copy a man page
-# $(1) - source dir
-#
-# See above for an explanation on the surrounding blank lines
-define PREPARE_MAN
-
-	@$(call E, prepare: $(PREPARE_DEST_MAN_DIR)/$(1))
-	$(Q)$(PREPARE_MAN_CMD) $(PREPARE_SOURCE_MAN_DIR)/$(1) $(PREPARE_DEST_MAN_DIR)/$(1)
-
-endef
-
-PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS))
-
-
-# $(1) is tool
-# $(2) is stage
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_HOST_TOOL
-prepare-host-tool-$(1)-$(2)-$(3)-$(4): \
-	PREPARE_SOURCE_BIN_DIR=$$(HBIN$(2)_H_$(3))
-prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
-                                  $$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
-                                  $$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
-                                  prepare-host-dirs-$(4)
-	$$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(call PREPARE_BIN,$(1)$$(X_$$(PREPARE_HOST))),),)
-	$$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(call PREPARE_MAN,$(1).1),),)
-endef
-
-# Libraries are compiled using the --libdir provided to configure, but
-# we store them in the tarball using just "lib" so that the install
-# script can then rewrite them back to the correct path.
-PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1))
-
-# For host libraries only install dylibs, not rlibs since the host libs are only
-# used to support rustc and rustc uses dynamic linking
-#
-# $(1) is tool
-# $(2) is stage
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_HOST_LIB
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
-	PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3))
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): \
-	PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3)))
-prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
-                                 $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
-                                 $$(HLIB$(2)_H_$(3))/stamp.$(1) \
-                                 prepare-host-dirs-$(4)
-	$$(if $$(findstring $(2), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-        $$(if $$(findstring 1,$$(ONLY_RLIB_$(1))),, \
-          $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1)))),),)
-endef
-
-
-# $(1) is stage
-# $(2) is target
-# $(3) is host
-# $(4) tag
-define DEF_PREPARE_TARGET_N
-# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-	PREPARE_WORKING_SOURCE_LIB_DIR=$$(TLIB$(1)_T_$(2)_H_$(3))
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-	PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-	PREPARE_SOURCE_BIN_DIR=$$(TBIN$(1)_T_$(2)_H_$(3))
-prepare-target-$(2)-host-$(3)-$(1)-$(4): \
-	PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin
-prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
-        $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-          $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
-        $$(if $$(findstring $(2),$$(CFG_HOST)), \
-          $$(foreach crate,$$(HOST_CRATES), \
-            $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)),)
-# Only install if this host and target combo is being prepared. Also be sure to
-# *not* install the rlibs for host crates because there's no need to statically
-# link against most of them. They just produce a large amount of extra size
-# bloat.
-	$$(if $$(findstring $(1), $$(PREPARE_STAGE)), \
-      $$(if $$(findstring $(2), $$(PREPARE_TARGETS)), \
-        $$(if $$(findstring $(3), $$(PREPARE_HOST)), \
-          $$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \
-          $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) \
-          $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-	    $$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \
-              $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \
-            $$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))) \
-          $$(if $$(findstring $(2),$$(CFG_HOST)), \
-            $$(foreach crate,$$(HOST_CRATES), \
-              $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \
-	  $$(foreach object,$$(INSTALLED_OBJECTS_$(2)),\
-	    $$(call PREPARE_LIB,$$(object))) \
-	  $$(foreach bin,$$(INSTALLED_BINS_$(3)),\
-	    $$(call PREPARE_BIN,$$(bin))) \
-	,),),)
-endef
-
-define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS
-	$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $(PREPARE_DEST_BIN_DIR)
-	$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
-endef
-
-define INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS
-	$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_BIN_DIR)
-	$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
-endef
-
-define INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS
-	$(Q)echo "No debugger scripts will be installed for host $(PREPARE_HOST)"
-endef
-
-# $(1) is PREPARE_HOST
-INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
-                                   $(INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS),\
-                                   $(if $(findstring darwin,$(1)),\
-                                     $(INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS),\
-                                     $(INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS)))
-
-define DEF_PREPARE
-
-prepare-base-$(1)-%: PREPARE_SOURCE_MAN_DIR=$$(S)/man
-prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
-prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE))
-prepare-base-$(1)-%: PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
-
-prepare-base-$(1)-target: prepare-target-$(1)
-prepare-base-$(1)-host: prepare-host-$(1) prepare-debugger-scripts-$(1)
-
-prepare-host-$(1): prepare-host-tools-$(1)
-
-prepare-host-tools-$(1): \
-        $$(foreach tool, $$(PREPARE_TOOLS), \
-          $$(foreach host,$$(CFG_HOST), \
-            prepare-host-tool-$$(tool)-$$(PREPARE_STAGE)-$$(host)-$(1)))
-
-prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
-	$$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR))
-	$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR))
-	$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc)
-	$$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
-
-prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \
-                               $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \
-                               $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS)
-	$$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST))
-
-$$(foreach tool,$$(PREPARE_TOOLS), \
-  $$(foreach host,$$(CFG_HOST), \
-      $$(eval $$(call DEF_PREPARE_HOST_TOOL,$$(tool),$$(PREPARE_STAGE),$$(host),$(1)))))
-
-$$(foreach lib,$$(CRATES), \
-  $$(foreach host,$$(CFG_HOST), \
-    $$(eval $$(call DEF_PREPARE_HOST_LIB,$$(lib),$$(PREPARE_STAGE),$$(host),$(1)))))
-
-prepare-target-$(1): \
-        $$(foreach host,$$(CFG_HOST), \
-           $$(foreach target,$$(CFG_TARGET), \
-             prepare-target-$$(target)-host-$$(host)-$$(PREPARE_STAGE)-$(1)))
-
-$$(foreach host,$$(CFG_HOST), \
-  $$(foreach target,$$(CFG_TARGET), \
-    $$(eval $$(call DEF_PREPARE_TARGET_N,$$(PREPARE_STAGE),$$(target),$$(host),$(1)))))
-
-prepare-maybe-clean-$(1):
-	$$(if $$(findstring true,$$(PREPARE_CLEAN)), \
-      @$$(call E, cleaning destination $$(PREPARE_DEST_DIR)),)
-	$$(if $$(findstring true,$$(PREPARE_CLEAN)), \
-      $$(Q)rm -rf $$(PREPARE_DEST_DIR),)
-
-
-endef
diff --git a/mk/reconfig.mk b/mk/reconfig.mk
deleted file mode 100644
index b8f51097868..00000000000
--- a/mk/reconfig.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# Recursive wildcard function
-# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
-rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
-  $(filter $(subst *,%,$2),$d))
-
-ifndef CFG_DISABLE_MANAGE_SUBMODULES
-# This is a pretty expensive operation but I don't see any way to avoid it
-# NB: This only looks for '+' status (wrong commit checked out), not '-' status
-# (nothing checked out at all).  `./configure --{llvm,jemalloc}-root`
-# will explicitly deinitialize the corresponding submodules, and we don't
-# want to force constant rebuilds in that case.
-NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+')
-else
-NEED_GIT_RECONFIG=0
-endif
-
-ifeq ($(NEED_GIT_RECONFIG),0)
-else
-# If the submodules have changed then always execute config.mk
-.PHONY: config.stamp
-endif
-
-Makefile config.mk: config.stamp
-
-ifeq ($(SREL),)
-SREL_ROOT := ./
-else
-SREL_ROOT := $(SREL)
-endif
-
-config.stamp: $(S)configure $(S)Makefile.in $(S)src/stage0.txt
-	@$(call E, cfg: reconfiguring)
-	$(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS)
diff --git a/mk/rt.mk b/mk/rt.mk
deleted file mode 100644
index f5149281d50..00000000000
--- a/mk/rt.mk
+++ /dev/null
@@ -1,721 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-################################################################################
-# Native libraries built as part of the rust build process
-#
-# This portion of the rust build system is meant to keep track of native
-# dependencies and how to build them. It is currently required that all native
-# dependencies are built as static libraries, as slinging around dynamic
-# libraries isn't exactly the most fun thing to do.
-#
-# This section should need minimal modification to add new libraries. The
-# relevant variables are:
-#
-#   NATIVE_LIBS
-#	This is a list of all native libraries which are built as part of the
-#	build process. It will build all libraries into RT_OUTPUT_DIR with the
-#	appropriate name of static library as dictated by the target platform
-#
-#   NATIVE_DEPS_<lib>
-#	This is a list of files relative to the src/rt directory which are
-#	needed to build the native library. Each file will be compiled to an
-#	object file, and then all the object files will be assembled into an
-#	archive (static library). The list contains files of any extension
-#
-# If adding a new library, you should update the NATIVE_LIBS list, and then list
-# the required files below it. The list of required files is a list of files
-# that's per-target so you're allowed to conditionally add files based on the
-# target.
-################################################################################
-NATIVE_LIBS := hoedown miniz rust_test_helpers
-
-# A macro to add a generic implementation of intrinsics iff a arch optimized implementation is not
-# already in the list.
-# $(1) is the target
-# $(2) is the intrinsic
-define ADD_INTRINSIC
-  ifeq ($$(findstring X,$$(foreach intrinsic,$$(COMPRT_OBJS_$(1)),$$(if $$(findstring $(2),$$(intrinsic)),X,))),)
-    COMPRT_OBJS_$(1) += $(2)
-  endif
-endef
-
-# $(1) is the target triple
-define NATIVE_LIBRARIES
-
-NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
-			hoedown/src/buffer.c \
-			hoedown/src/document.c \
-			hoedown/src/escape.c \
-			hoedown/src/html.c \
-			hoedown/src/html_blocks.c \
-			hoedown/src/html_smartypants.c \
-			hoedown/src/stack.c \
-			hoedown/src/version.c
-NATIVE_DEPS_miniz_$(1) = miniz.c
-NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
-
-################################################################################
-# You shouldn't find it that necessary to edit anything below this line.
-################################################################################
-
-# While we're defining the native libraries for each target, we define some
-# common rules used to build files for various targets.
-
-RT_OUTPUT_DIR_$(1) := $(1)/rt
-
-$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
-	@mkdir -p $$(@D)
-	@$$(call E, compile: $$@)
-	$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \
-		$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt/hoedown/src) \
-		$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt) \
-                 $$(RUNTIME_CFLAGS_$(1))) $$<
-
-$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \
-	    $$(LLVM_CONFIG_$$(CFG_BUILD))
-	@mkdir -p $$(@D)
-	@$$(call E, compile: $$@)
-	$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
-
-# On MSVC targets the compiler's default include path (e.g. where to find system
-# headers) is specified by the INCLUDE environment variable. This may not be set
-# so the ./configure script scraped the relevant values and this is the location
-# that we put them into cl.exe's environment.
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(RT_OUTPUT_DIR_$(1))/%.o: \
-	export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-$(1)/rustllvm/%.o: \
-	export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-endif
-endef
-
-$(foreach target,$(CFG_TARGET),$(eval $(call NATIVE_LIBRARIES,$(target))))
-
-# A macro for devining how to build third party libraries listed above (based
-# on their dependencies).
-#
-# $(1) is the target
-# $(2) is the lib name
-define THIRD_PARTY_LIB
-
-OBJS_$(2)_$(1) := $$(NATIVE_DEPS_$(2)_$(1):%=$$(RT_OUTPUT_DIR_$(1))/%)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.c=.o)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.cpp=.o)
-OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.S=.o)
-NATIVE_$(2)_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$(2))
-$$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1))
-	@$$(call E, link: $$@)
-	$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(eval $(call RUNTIME_RULES,$(target))))
-$(foreach lib,$(NATIVE_LIBS), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call THIRD_PARTY_LIB,$(target),$(lib)))))
-
-
-################################################################################
-# Building third-party targets with external build systems
-#
-# This location is meant for dependencies which have external build systems. It
-# is still assumed that the output of each of these steps is a static library
-# in the correct location.
-################################################################################
-
-define DEF_THIRD_PARTY_TARGETS
-
-# $(1) is the target triple
-
-ifeq ($$(CFG_WINDOWSY_$(1)),1)
-  # A bit of history here, this used to be --enable-lazy-lock added in #14006
-  # which was filed with jemalloc in jemalloc/jemalloc#83 which was also
-  # reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
-  #
-  # When updating jemalloc to 4.0, however, it was found that binaries would
-  # exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
-  # was unlocking a mutex it never locked. Disabling this "lazy lock" option
-  # seems to fix the issue, but it was enabled by default for MinGW targets in
-  # 13473c7 for jemalloc.
-  #
-  # As a result of all that, force disabling lazy lock on Windows, and after
-  # reading some code it at least *appears* that the initialization of mutexes
-  # is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
-  #
-  # tl;dr: make windows behave like other platforms by disabling lazy locking,
-  #        but requires passing an option due to a historical default with
-  #        jemalloc.
-  JEMALLOC_ARGS_$(1) := --disable-lazy-lock
-else ifeq ($(OSTYPE_$(1)), apple-ios)
-  JEMALLOC_ARGS_$(1) := --disable-tls
-else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
-  # We force android to have prefixed symbols because apparently replacement of
-  # the libc allocator doesn't quite work. When this was tested (unprefixed
-  # symbols), it was found that the `realpath` function in libc would allocate
-  # with libc malloc (not jemalloc malloc), and then the standard library would
-  # free with jemalloc free, causing a segfault.
-  #
-  # If the test suite passes, however, without symbol prefixes then we should be
-  # good to go!
-  JEMALLOC_ARGS_$(1) := --disable-tls --with-jemalloc-prefix=je_
-else ifeq ($(findstring dragonfly, $(OSTYPE_$(1))), dragonfly)
-  JEMALLOC_ARGS_$(1) := --with-jemalloc-prefix=je_
-endif
-
-ifdef CFG_ENABLE_DEBUG_JEMALLOC
-  JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill
-endif
-
-################################################################################
-# jemalloc
-################################################################################
-
-ifdef CFG_ENABLE_FAST_MAKE
-JEMALLOC_DEPS := $(S)/.gitmodules
-else
-JEMALLOC_DEPS := $(wildcard \
-		   $(S)src/jemalloc/* \
-		   $(S)src/jemalloc/*/* \
-		   $(S)src/jemalloc/*/*/* \
-		   $(S)src/jemalloc/*/*/*/*)
-endif
-
-# See #17183 for details, this file is touched during the build process so we
-# don't want to consider it as a dependency.
-JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS))
-
-JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc)
-ifeq ($$(CFG_WINDOWSY_$(1)),1)
-  JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_s)
-else
-  JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_pic)
-endif
-JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1))
-JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc
-JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
-
-$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
-	@$$(call E, make: jemalloc)
-	cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
-		$$(JEMALLOC_ARGS_$(1)) $(CFG_JEMALLOC_FLAGS) \
-		--build=$$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$$(CFG_GNU_TRIPLE_$(1)) \
-		CC="$$(CC_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1))" \
-		AR="$$(AR_$(1))" \
-		RANLIB="$$(AR_$(1)) s" \
-		CPPFLAGS="-I $(S)src/rt/" \
-		EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
-	$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
-
-ifeq ($(1),$$(CFG_BUILD))
-ifneq ($$(CFG_JEMALLOC_ROOT),)
-$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
-	@$$(call E, copy: jemalloc)
-	$$(Q)cp $$< $$@
-else
-$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
-	$$(Q)cp $$< $$@
-endif
-else
-$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
-	$$(Q)cp $$< $$@
-endif
-
-################################################################################
-# compiler-rt
-################################################################################
-
-# Everything below is a manual compilation of compiler-rt, disregarding its
-# build system. See comments in `src/bootstrap/native.rs` for more information.
-
-COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
-COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
-COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
-
-# We must avoid compiling both a generic implementation (e.g. `floatdidf.c) and an arch optimized
-# implementation (e.g. `x86_64/floatdidf.S) of the same symbol (e.g. `floatdidf) because that causes
-# linker errors. To avoid that, we first add all the arch optimized implementations and then add the
-# generic implementations if and only if its arch optimized version is not already in the list. This
-# last part is handled by the ADD_INTRINSIC macro.
-
-COMPRT_OBJS_$(1) :=
-
-ifeq ($$(findstring msvc,$(1)),)
-ifeq ($$(findstring x86_64,$(1)),x86_64)
-COMPRT_OBJS_$(1) += \
-      x86_64/chkstk.o \
-      x86_64/chkstk2.o \
-      x86_64/floatdidf.o \
-      x86_64/floatdisf.o \
-      x86_64/floatdixf.o \
-      x86_64/floatundidf.o \
-      x86_64/floatundisf.o \
-      x86_64/floatundixf.o
-endif
-
-ifeq ($$(findstring i686,$$(patsubts i%86,i686,$(1))),i686)
-COMPRT_OBJS_$(1) += \
-      i386/ashldi3.o \
-      i386/ashrdi3.o \
-      i386/chkstk.o \
-      i386/chkstk2.o \
-      i386/divdi3.o \
-      i386/floatdidf.o \
-      i386/floatdisf.o \
-      i386/floatdixf.o \
-      i386/floatundidf.o \
-      i386/floatundisf.o \
-      i386/floatundixf.o \
-      i386/lshrdi3.o \
-      i386/moddi3.o \
-      i386/muldi3.o \
-      i386/udivdi3.o \
-      i386/umoddi3.o
-endif
-
-else
-
-ifeq ($$(findstring x86_64,$(1)),x86_64)
-COMPRT_OBJS_$(1) += \
-      x86_64/floatdidf.o \
-      x86_64/floatdisf.o \
-      x86_64/floatdixf.o
-endif
-
-endif
-
-# Generic ARM sources, nothing compiles on iOS though
-ifeq ($$(findstring arm,$(1)),arm)
-ifeq ($$(findstring ios,$(1)),)
-COMPRT_OBJS_$(1) += \
-  arm/aeabi_cdcmp.o \
-  arm/aeabi_cdcmpeq_check_nan.o \
-  arm/aeabi_cfcmp.o \
-  arm/aeabi_cfcmpeq_check_nan.o \
-  arm/aeabi_dcmp.o \
-  arm/aeabi_div0.o \
-  arm/aeabi_drsub.o \
-  arm/aeabi_fcmp.o \
-  arm/aeabi_frsub.o \
-  arm/aeabi_idivmod.o \
-  arm/aeabi_ldivmod.o \
-  arm/aeabi_memcmp.o \
-  arm/aeabi_memcpy.o \
-  arm/aeabi_memmove.o \
-  arm/aeabi_memset.o \
-  arm/aeabi_uidivmod.o \
-  arm/aeabi_uldivmod.o \
-  arm/bswapdi2.o \
-  arm/bswapsi2.o \
-  arm/clzdi2.o \
-  arm/clzsi2.o \
-  arm/comparesf2.o \
-  arm/divmodsi4.o \
-  arm/divsi3.o \
-  arm/modsi3.o \
-  arm/switch16.o \
-  arm/switch32.o \
-  arm/switch8.o \
-  arm/switchu8.o \
-  arm/sync_synchronize.o \
-  arm/udivmodsi4.o \
-  arm/udivsi3.o \
-  arm/umodsi3.o
-endif
-endif
-
-# Thumb sources
-ifeq ($$(findstring armv7,$(1)),armv7)
-COMPRT_OBJS_$(1) += \
-  arm/sync_fetch_and_add_4.o \
-  arm/sync_fetch_and_add_8.o \
-  arm/sync_fetch_and_and_4.o \
-  arm/sync_fetch_and_and_8.o \
-  arm/sync_fetch_and_max_4.o \
-  arm/sync_fetch_and_max_8.o \
-  arm/sync_fetch_and_min_4.o \
-  arm/sync_fetch_and_min_8.o \
-  arm/sync_fetch_and_nand_4.o \
-  arm/sync_fetch_and_nand_8.o \
-  arm/sync_fetch_and_or_4.o \
-  arm/sync_fetch_and_or_8.o \
-  arm/sync_fetch_and_sub_4.o \
-  arm/sync_fetch_and_sub_8.o \
-  arm/sync_fetch_and_umax_4.o \
-  arm/sync_fetch_and_umax_8.o \
-  arm/sync_fetch_and_umin_4.o \
-  arm/sync_fetch_and_umin_8.o \
-  arm/sync_fetch_and_xor_4.o \
-  arm/sync_fetch_and_xor_8.o
-endif
-
-# VFP sources
-ifeq ($$(findstring eabihf,$(1)),eabihf)
-COMPRT_OBJS_$(1) += \
-  arm/adddf3vfp.o \
-  arm/addsf3vfp.o \
-  arm/divdf3vfp.o \
-  arm/divsf3vfp.o \
-  arm/eqdf2vfp.o \
-  arm/eqsf2vfp.o \
-  arm/extendsfdf2vfp.o \
-  arm/fixdfsivfp.o \
-  arm/fixsfsivfp.o \
-  arm/fixunsdfsivfp.o \
-  arm/fixunssfsivfp.o \
-  arm/floatsidfvfp.o \
-  arm/floatsisfvfp.o \
-  arm/floatunssidfvfp.o \
-  arm/floatunssisfvfp.o \
-  arm/gedf2vfp.o \
-  arm/gesf2vfp.o \
-  arm/gtdf2vfp.o \
-  arm/gtsf2vfp.o \
-  arm/ledf2vfp.o \
-  arm/lesf2vfp.o \
-  arm/ltdf2vfp.o \
-  arm/ltsf2vfp.o \
-  arm/muldf3vfp.o \
-  arm/mulsf3vfp.o \
-  arm/negdf2vfp.o \
-  arm/negsf2vfp.o \
-  arm/nedf2vfp.o \
-  arm/nesf2vfp.o \
-  arm/restore_vfp_d8_d15_regs.o \
-  arm/save_vfp_d8_d15_regs.o \
-  arm/subdf3vfp.o \
-  arm/subsf3vfp.o \
-  arm/truncdfsf2vfp.o \
-  arm/unorddf2vfp.o \
-  arm/unordsf2vfp.o
-endif
-
-$(foreach intrinsic,absvdi2.o \
-  absvsi2.o \
-  adddf3.o \
-  addsf3.o \
-  addvdi3.o \
-  addvsi3.o \
-  apple_versioning.o \
-  ashldi3.o \
-  ashrdi3.o \
-  clear_cache.o \
-  clzdi2.o \
-  clzsi2.o \
-  cmpdi2.o \
-  comparedf2.o \
-  comparesf2.o \
-  ctzdi2.o \
-  ctzsi2.o \
-  divdc3.o \
-  divdf3.o \
-  divdi3.o \
-  divmoddi4.o \
-  divmodsi4.o \
-  divsc3.o \
-  divsf3.o \
-  divsi3.o \
-  divxc3.o \
-  extendsfdf2.o \
-  extendhfsf2.o \
-  ffsdi2.o \
-  fixdfdi.o \
-  fixdfsi.o \
-  fixsfdi.o \
-  fixsfsi.o \
-  fixunsdfdi.o \
-  fixunsdfsi.o \
-  fixunssfdi.o \
-  fixunssfsi.o \
-  fixunsxfdi.o \
-  fixunsxfsi.o \
-  fixxfdi.o \
-  floatdidf.o \
-  floatdisf.o \
-  floatdixf.o \
-  floatsidf.o \
-  floatsisf.o \
-  floatundidf.o \
-  floatundisf.o \
-  floatundixf.o \
-  floatunsidf.o \
-  floatunsisf.o \
-  int_util.o \
-  lshrdi3.o \
-  moddi3.o \
-  modsi3.o \
-  muldc3.o \
-  muldf3.o \
-  muldi3.o \
-  mulodi4.o \
-  mulosi4.o \
-  muloti4.o \
-  mulsc3.o \
-  mulsf3.o \
-  mulvdi3.o \
-  mulvsi3.o \
-  mulxc3.o \
-  negdf2.o \
-  negdi2.o \
-  negsf2.o \
-  negvdi2.o \
-  negvsi2.o \
-  paritydi2.o \
-  paritysi2.o \
-  popcountdi2.o \
-  popcountsi2.o \
-  powidf2.o \
-  powisf2.o \
-  powixf2.o \
-  subdf3.o \
-  subsf3.o \
-  subvdi3.o \
-  subvsi3.o \
-  truncdfhf2.o \
-  truncdfsf2.o \
-  truncsfhf2.o \
-  ucmpdi2.o \
-  udivdi3.o \
-  udivmoddi4.o \
-  udivmodsi4.o \
-  udivsi3.o \
-  umoddi3.o \
-  umodsi3.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-
-ifeq ($$(findstring ios,$(1)),)
-$(foreach intrinsic,absvti2.o \
-  addtf3.o \
-  addvti3.o \
-  ashlti3.o \
-  ashrti3.o \
-  clzti2.o \
-  cmpti2.o \
-  ctzti2.o \
-  divtf3.o \
-  divti3.o \
-  ffsti2.o \
-  fixdfti.o \
-  fixsfti.o \
-  fixunsdfti.o \
-  fixunssfti.o \
-  fixunsxfti.o \
-  fixxfti.o \
-  floattidf.o \
-  floattisf.o \
-  floattixf.o \
-  floatuntidf.o \
-  floatuntisf.o \
-  floatuntixf.o \
-  lshrti3.o \
-  modti3.o \
-  multf3.o \
-  multi3.o \
-  mulvti3.o \
-  negti2.o \
-  negvti2.o \
-  parityti2.o \
-  popcountti2.o \
-  powitf2.o \
-  subtf3.o \
-  subvti3.o \
-  trampoline_setup.o \
-  ucmpti2.o \
-  udivmodti4.o \
-  udivti3.o \
-  umodti3.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring apple,$(1)),apple)
-$(foreach intrinsic,atomic_flag_clear.o \
-  atomic_flag_clear_explicit.o \
-  atomic_flag_test_and_set.o \
-  atomic_flag_test_and_set_explicit.o \
-  atomic_signal_fence.o \
-  atomic_thread_fence.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring windows,$(1)),)
-$(call ADD_INTRINSIC,$(1),emutls.o)
-endif
-
-ifeq ($$(findstring msvc,$(1)),)
-
-ifeq ($$(findstring freebsd,$(1)),)
-ifeq ($$(findstring netbsd,$(1)),)
-$(call ADD_INTRINSIC,$(1),gcc_personality_v0.o)
-endif
-endif
-endif
-
-ifeq ($$(findstring aarch64,$(1)),aarch64)
-$(foreach intrinsic,comparetf2.o \
-  extenddftf2.o \
-  extendsftf2.o \
-  fixtfdi.o \
-  fixtfsi.o \
-  fixtfti.o \
-  fixunstfdi.o \
-  fixunstfsi.o \
-  fixunstfti.o \
-  floatditf.o \
-  floatsitf.o \
-  floatunditf.o \
-  floatunsitf.o \
-  multc3.o \
-  trunctfdf2.o \
-  trunctfsf2.o,
-  $(call ADD_INTRINSIC,$(1),$(intrinsic)))
-endif
-
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -Zl -D__func__=__FUNCTION__
-else
-$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -fno-builtin -fvisibility=hidden \
-	-fomit-frame-pointer -ffreestanding
-endif
-
-COMPRT_OBJS_$(1) := $$(COMPRT_OBJS_$(1):%=$$(COMPRT_BUILD_DIR_$(1))/%)
-
-$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.c
-	@mkdir -p $$(@D)
-	@$$(call E, compile: $$@)
-	$$(Q)$$(call CFG_COMPILE_C_$(1),$$@,$$<)
-
-$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.S \
-	    $$(LLVM_CONFIG_$$(CFG_BUILD))
-	@mkdir -p $$(@D)
-	@$$(call E, compile: $$@)
-	$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
-
-ifeq ($$(findstring msvc,$(1)),msvc)
-$$(COMPRT_BUILD_DIR_$(1))/%.o: \
-	export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
-endif
-
-ifeq ($$(findstring emscripten,$(1)),emscripten)
-# FIXME: emscripten doesn't use compiler-rt and can't build it without
-# further hacks
-COMPRT_OBJS_$(1) :=
-endif
-
-$$(COMPRT_LIB_$(1)): $$(COMPRT_OBJS_$(1))
-	@$$(call E, link: $$@)
-	$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-################################################################################
-# libbacktrace
-#
-# We use libbacktrace on linux to get symbols in backtraces, but only on linux.
-# Elsewhere we use other system utilities, so this library is only built on
-# linux.
-################################################################################
-
-BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
-BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1))
-BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace
-
-# We don't use this on platforms that aren't linux-based (with the exception of
-# msys2/mingw builds on windows, which use it to read the dwarf debug
-# information) so just make the file available, the compilation of libstd won't
-# actually build it.
-ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-	touch $$@
-
-else ifeq ($$(findstring ios,$$(OSTYPE_$(1))),ios)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-	touch $$@
-else ifeq ($$(findstring msvc,$(1)),msvc)
-# See comment above
-$$(BACKTRACE_LIB_$(1)):
-	touch $$@
-else ifeq ($$(findstring emscripten,$(1)),emscripten)
-# FIXME: libbacktrace doesn't understand the emscripten triple
-$$(BACKTRACE_LIB_$(1)):
-	touch $$@
-else
-
-ifdef CFG_ENABLE_FAST_MAKE
-BACKTRACE_DEPS := $(S)/.gitmodules
-else
-BACKTRACE_DEPS := $(wildcard $(S)src/libbacktrace/*)
-endif
-
-# We need to export CFLAGS because otherwise it doesn't pick up cross compile
-# builds. If libbacktrace doesn't realize this, it will attempt to read 64-bit
-# elf headers when compiled for a 32-bit system, yielding blank backtraces.
-#
-# This also removes the -Werror flag specifically to prevent errors during
-# configuration.
-#
-# Down below you'll also see echos into the config.h generated by the
-# ./configure script. This is done to force libbacktrace to *not* use the
-# atomic/sync functionality because it pulls in unnecessary dependencies and we
-# never use it anyway.
-#
-# We also use `env PWD=` to clear the PWD environment variable, and then
-# execute the command in a new shell. This is necessary to workaround a
-# buildbot/msys2 bug: the shell is launched with PWD set to a windows-style path,
-# which results in all further uses of `pwd` also printing a windows-style path,
-# which breaks libbacktrace's configure script. Clearing PWD within the same
-# shell is not sufficient.
-
-$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
-	@$$(call E, configure: libbacktrace for $(1))
-	$$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1))
-	$$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1))
-	$$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && env \
-	      PWD= \
-	      CC="$$(CC_$(1))" \
-	      AR="$$(AR_$(1))" \
-	      RANLIB="$$(AR_$(1)) s" \
-	      CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -fno-stack-protector" \
-	      $(S)src/libbacktrace/configure --build=$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$(CFG_GNU_TRIPLE_$(1)))
-	$$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \
-	      $$(BACKTRACE_BUILD_DIR_$(1))/config.h
-	$$(Q)echo '#undef HAVE_SYNC_FUNCTIONS' >> \
-	      $$(BACKTRACE_BUILD_DIR_$(1))/config.h
-
-$$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
-	@$$(call E, make: libbacktrace)
-	$$(Q)$$(MAKE) -C $$(BACKTRACE_BUILD_DIR_$(1)) \
-		INCDIR=$(S)src/libbacktrace
-	$$(Q)cp $$(BACKTRACE_BUILD_DIR_$(1))/.libs/libbacktrace.a $$@
-
-endif
-
-################################################################################
-# libc/libunwind for musl
-#
-# When we're building a musl-like target we're going to link libc/libunwind
-# statically into the standard library and liblibc, so we need to make sure
-# they're in a location that we can find
-################################################################################
-
-ifeq ($$(findstring musl,$(1)),musl)
-$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
-	cp $$^ $$@
-else
-# Ask gcc where it is
-$$(RT_OUTPUT_DIR_$(1))/%:
-	cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@
-endif
-
-endef
-
-# Instantiate template for all stages/targets
-$(foreach target,$(CFG_TARGET), \
-     $(eval $(call DEF_THIRD_PARTY_TARGETS,$(target))))
diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk
deleted file mode 100644
index 2d63f69960f..00000000000
--- a/mk/rustllvm.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-######################################################################
-# rustc LLVM-extensions (C++) library variables and rules
-######################################################################
-
-define DEF_RUSTLLVM_TARGETS
-
-# FIXME: Lately, on windows, llvm-config --includedir is not enough
-# to find the llvm includes (probably because we're not actually installing
-# llvm, but using it straight out of the build directory)
-ifdef CFG_WINDOWSY_$(1)
-LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \
-                         $$(call CFG_CC_INCLUDE_$(1),\
-			   $$(CFG_LLVM_BUILD_DIR_$(1))/include)
-endif
-
-RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
-	RustWrapper.cpp PassWrapper.cpp \
-	ArchiveWrapper.cpp)
-
-RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
-                     $$(call CFG_CC_INCLUDE_$(1),$$(LLVM_INCDIR_$(1))) \
-                     $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include)
-RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
-
-# Flag that we are building with Rust's llvm fork
-ifeq ($(CFG_LLVM_ROOT),)
-RUSTLLVM_CXXFLAGS_$(1) := -DLLVM_RUSTLLVM
-endif
-
-# Note that we appease `cl.exe` and its need for some sort of exception
-# handling flag with the `EHsc` argument here as well.
-ifeq ($$(findstring msvc,$(1)),msvc)
-EXTRA_RUSTLLVM_CXXFLAGS_$(1) := //EHsc
-endif
-
-$$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \
-	    $$(RUSTLLVM_OBJS_OBJS_$(1))
-	@$$(call E, link: $$@)
-	$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
-
-RUSTLLVM_COMPONENTS_$(1) = $$(shell echo $$(LLVM_ALL_COMPONENTS_$(1)) |\
-	tr 'a-z-' 'A-Z_'| sed -e 's/^ //;s/\([^ ]*\)/\-DLLVM_COMPONENT_\1/g')
-
-# On MSVC we need to double-escape arguments that llvm-config printed which
-# start with a '/'. The shell we're running in will auto-translate the argument
-# `/foo` to `C:/msys64/foo` but we really want it to be passed through as `/foo`
-# so the argument passed to our shell must be `//foo`.
-$(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
-	@$$(call E, compile: $$@)
-	$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
-		$$(subst  /,//,$$(LLVM_CXXFLAGS_$(1))) \
-		$$(RUSTLLVM_COMPONENTS_$(1)) \
-		$$(RUSTLLVM_CXXFLAGS_$(1)) \
-		$$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
-		$$(RUSTLLVM_INCS_$(1)) \
-		$$<
-endef
-
-# Instantiate template for all stages
-$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_RUSTLLVM_TARGETS,$(host))))
diff --git a/mk/stage0.mk b/mk/stage0.mk
deleted file mode 100644
index 8a2bf2ebbde..00000000000
--- a/mk/stage0.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# Extract the snapshot host compiler
-
-$(HBIN0_H_$(CFG_BUILD))/:
-	mkdir -p $@
-
-# On windows these two are the same, so cause a redifinition warning
-ifneq ($(HBIN0_H_$(CFG_BUILD)),$(HLIB0_H_$(CFG_BUILD)))
-$(HLIB0_H_$(CFG_BUILD))/:
-	mkdir -p $@
-endif
-
-$(SNAPSHOT_RUSTC_POST_CLEANUP): \
-		$(S)src/stage0.txt \
-		$(S)src/etc/local_stage0.sh \
-		$(S)src/etc/get-stage0.py $(MKFILE_DEPS) \
-		| $(HBIN0_H_$(CFG_BUILD))/
-	@$(call E, fetch: $@)
-ifdef CFG_ENABLE_LOCAL_RUST
-	$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
-else
-	$(Q)$(CFG_PYTHON) $(S)src/etc/get-stage0.py $(CFG_BUILD)
-endif
-	$(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi
-
-# For other targets, let the host build the target:
-
-define BOOTSTRAP_STAGE0
-  # $(1) target to bootstrap
-  # $(2) stage to bootstrap from
-  # $(3) target to bootstrap from
-
-$(HBIN0_H_$(1))/:
-	mkdir -p $@
-
-$(HLIB0_H_$(1))/:
-	mkdir -p $@
-
-$$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
-		$$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X_$(1)) \
-		| $(HBIN0_H_$(1))/
-	@$$(call E, cp: $$@)
-	$$(Q)cp $$< $$@
-
-endef
-
-# Use stage1 to build other architectures: then you don't have to wait
-# for stage2, but you get the latest updates to the compiler source.
-$(foreach t,$(NON_BUILD_HOST), \
- $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_BUILD))))
diff --git a/mk/target.mk b/mk/target.mk
deleted file mode 100644
index 1b139909ab4..00000000000
--- a/mk/target.mk
+++ /dev/null
@@ -1,209 +0,0 @@
-# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-# This is the compile-time target-triple for the compiler. For the compiler at
-# runtime, this should be considered the host-triple. More explanation for why
-# this exists can be found on issue #2400
-export CFG_COMPILER_HOST_TRIPLE
-
-# Used as defaults for the runtime ar and cc tools
-export CFG_DEFAULT_LINKER
-export CFG_DEFAULT_AR
-
-# Macro that generates the full list of dependencies for a crate at a particular
-# stage/target/host tuple.
-#
-# $(1) - stage
-# $(2) - target
-# $(3) - host
-# $(4) crate
-define RUST_CRATE_FULLDEPS
-CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
-		$$(CRATEFILE_$(4)) \
-		$$(RSINPUTS_$(4)) \
-		$$(foreach dep,$$(RUST_DEPS_$(4)_T_$(2)), \
-		  $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-		$$(foreach dep,$$(NATIVE_DEPS_$(4)), \
-		  $$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
-		$$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
-		  $$(RT_OUTPUT_DIR_$(2))/$$(dep))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate,$(CRATES), \
-    $(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate)))))))
-
-# RUST_TARGET_STAGE_N template: This defines how target artifacts are built
-# for all stage/target architecture combinations. This is one giant rule which
-# works as follows:
-#
-#   1. The immediate dependencies are the rust source files
-#   2. Each rust crate dependency is listed (based on their stamp files),
-#      as well as all native dependencies (listed in RT_OUTPUT_DIR)
-#   3. The stage (n-1) compiler is required through the TSREQ dependency
-#   4. When actually executing the rule, the first thing we do is to clean out
-#      old libs and rlibs via the REMOVE_ALL_OLD_GLOB_MATCHES macro
-#   5. Finally, we get around to building the actual crate. It's just one
-#      "small" invocation of the previous stage rustc. We use -L to
-#      RT_OUTPUT_DIR so all the native dependencies are picked up.
-#      Additionally, we pass in the llvm dir so rustc can link against it.
-#   6. Some cleanup is done (listing what was just built) if verbose is turned
-#      on.
-#
-# $(1) is the stage
-# $(2) is the target triple
-# $(3) is the host triple
-# $(4) is the crate name
-define RUST_TARGET_STAGE_N
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
-		$$(CRATEFILE_$(4)) \
-		$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
-		$$(LLVM_CONFIG_$(2)) \
-		$$(TSREQ$(1)_T_$(2)_H_$(3)) \
-		| $$(TLIB$(1)_T_$(2)_H_$(3))/
-	@$$(call E, rustc: $$(@D)/lib$(4))
-	@touch $$@.start_time
-	$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
-	$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
-	$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-	    $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \
-		$$(RUST_LIB_FLAGS_ST$(1)) \
-		-L "$$(RT_OUTPUT_DIR_$(2))" \
-		$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-		$$(LLVM_STDCPP_RUSTFLAGS_$(2)) \
-		$$(RUSTFLAGS_$(4)) \
-		$$(RUSTFLAGS$(1)_$(4)) \
-		$$(RUSTFLAGS$(1)_$(4)_T_$(2)) \
-		--out-dir $$(@D) \
-		-C extra-filename=-$$(CFG_FILENAME_EXTRA) \
-		-C metadata=$$(CFG_FILENAME_EXTRA) \
-		$$<
-	@touch -r $$@.start_time $$@ && rm $$@.start_time
-	$$(call LIST_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
-	$$(call LIST_ALL_OLD_GLOB_MATCHES, \
-	    $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
-
-endef
-
-# Macro for building any tool as part of the rust compilation process. Each
-# tool is defined in crates.mk with a list of library dependencies as well as
-# the source file for the tool. Building each tool will also be passed '--cfg
-# <tool>' for usage in driver.rs
-#
-# This build rule is similar to the one found above, just tweaked for
-# locations and things.
-#
-# $(1) - stage
-# $(2) - target triple
-# $(3) - host triple
-# $(4) - name of the tool being built
-define TARGET_TOOL
-
-$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
-		$$(TOOL_SOURCE_$(4)) \
-		$$(TOOL_INPUTS_$(4)) \
-		$$(foreach dep,$$(TOOL_DEPS_$(4)), \
-		    $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
-		$$(TSREQ$(1)_T_$(2)_H_$(3)) \
-		| $$(TBIN$(1)_T_$(2)_H_$(3))/
-	@$$(call E, rustc: $$@)
-	$$(STAGE$(1)_T_$(2)_H_$(3)) \
-		$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-		-o $$@ $$< --cfg $(4)
-
-endef
-
-# Macro for building runtime startup/shutdown object files;
-# these are Rust's equivalent of crti.o, crtn.o
-#
-# $(1) - stage
-# $(2) - target triple
-# $(3) - host triple
-# $(4) - object basename
-define TARGET_RUSTRT_STARTUP_OBJ
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \
-		$(S)src/rtstartup/$(4).rs \
-		$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \
-		$$(HSREQ$(1)_T_$(2)_H_$(3)) \
-		| $$(TBIN$(1)_T_$(2)_H_$(3))/
-	@$$(call E, rustc: $$@)
-	$$(STAGE$(1)_T_$(2)_H_$(3)) --emit=obj -o $$@ $$<
-
-ifeq ($$(CFG_RUSTRT_HAS_STARTUP_OBJS_$(2)), 1)
-# Add dependencies on Rust startup objects to all crates that depend on core.
-# This ensures that they are built after core (since they depend on it),
-# but before everything else (since they are needed for linking dylib crates).
-$$(foreach crate, $$(TARGET_CRATES_$(2)), \
-	$$(if $$(findstring core,$$(DEPS_$$(crate))), \
-		$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o
-endif
-
-endef
-
-# Every recipe in RUST_TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
-# a directory that can be cleaned out during the middle of a run of
-# the get-snapshot.py script.  Therefore, every recipe needs to have
-# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or
-# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
-# put into the target area until after the get-snapshot.py script has
-# had its chance to clean it out; otherwise the other products will be
-# inadvertently included in the clean out.
-SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
-
-define TARGET_HOST_RULES
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
-	mkdir -p $$@
-
-$$(TBIN$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP)
-	mkdir -p $$@
-
-$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
-	    $$(SNAPSHOT_RUSTC_POST_CLEANUP) \
-	    | $$(TLIB$(1)_T_$(2)_H_$(3))/
-	@$$(call E, cp: $$@)
-	$$(Q)cp $$< $$@
-endef
-
-$(foreach source,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(eval $(call TARGET_HOST_RULES,0,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,1,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,2,$(target),$(source))) \
-  $(eval $(call TARGET_HOST_RULES,3,$(target),$(source)))))
-
-# In principle, each host can build each target for both libs and tools
-$(foreach crate,$(CRATES), \
- $(foreach source,$(CFG_HOST), \
-  $(foreach target,$(CFG_TARGET), \
-   $(eval $(call RUST_TARGET_STAGE_N,0,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,1,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,2,$(target),$(source),$(crate))) \
-   $(eval $(call RUST_TARGET_STAGE_N,3,$(target),$(source),$(crate))))))
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach tool,$(TOOLS), \
-    $(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach obj,rsbegin rsend, \
-    $(eval $(call TARGET_RUSTRT_STARTUP_OBJ,$(stage),$(target),$(host),$(obj)))))))
diff --git a/mk/tests.mk b/mk/tests.mk
deleted file mode 100644
index 3317688f042..00000000000
--- a/mk/tests.mk
+++ /dev/null
@@ -1,1057 +0,0 @@
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-
-######################################################################
-# Test variables
-######################################################################
-
-# The names of crates that must be tested
-
-# libcore/libstd_unicode tests are in a separate crate
-DEPS_coretest :=
-$(eval $(call RUST_CRATE,coretest))
-
-DEPS_collectionstest :=
-$(eval $(call RUST_CRATE,collectionstest))
-
-TEST_TARGET_CRATES = $(filter-out core std_unicode alloc_system libc \
-		     		  alloc_jemalloc panic_unwind \
-				  panic_abort,$(TARGET_CRATES)) \
-			collectionstest coretest
-TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
-                log rand serialize syntax term test
-TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
-		   		rustc_trans rustc_lint,\
-                     $(HOST_CRATES))
-TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
-
-######################################################################
-# Environment configuration
-######################################################################
-
-# The arguments to all test runners
-ifdef TESTNAME
-  TESTARGS += $(TESTNAME)
-endif
-
-ifdef CHECK_IGNORED
-  TESTARGS += --ignored
-endif
-
-# Arguments to the cfail/rfail/rpass tests
-ifdef CFG_VALGRIND
-  CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
-endif
-
-CTEST_TESTARGS := $(TESTARGS)
-
-# --bench is only relevant for crate tests, not for the compile tests
-ifdef PLEASE_BENCH
-  TESTARGS += --bench
-endif
-
-ifdef VERBOSE
-  CTEST_TESTARGS += --verbose
-endif
-
-# Setting locale ensures that gdb's output remains consistent.
-# This prevents tests from failing with some locales (fixes #17423).
-export LC_ALL=C
-
-TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
-
-define DEF_TARGET_COMMANDS
-
-ifdef CFG_UNIXY_$(1)
-  CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
-	  $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
-endif
-
-ifdef CFG_WINDOWSY_$(1)
-  CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
-   $$(if $$(findstring stage0,$$(1)), \
-       stage0/$$(CFG_LIBDIR_RELATIVE), \
-      $$(if $$(findstring stage1,$$(1)), \
-           stage1/$$(CFG_LIBDIR_RELATIVE), \
-          $$(if $$(findstring stage2,$$(1)), \
-               stage2/$$(CFG_LIBDIR_RELATIVE), \
-               $$(if $$(findstring stage3,$$(1)), \
-                    stage3/$$(CFG_LIBDIR_RELATIVE), \
-               )))))/rustlib/$$(CFG_BUILD)/lib
-  CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \
-	  $$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1))
-endif
-
-# Run the compiletest runner itself under valgrind
-ifdef CTEST_VALGRIND
-CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
-      $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4))
-else
-CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
-      $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
-endif
-
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(eval $(call DEF_TARGET_COMMANDS,$(target))))
-
-# Target platform specific variables for android
-define DEF_ADB_DEVICE_STATUS
-CFG_ADB_DEVICE_STATUS=$(1)
-endef
-
-$(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-    $(if $(findstring adb,$(CFG_ADB)), \
-      $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
-        $(info check: android device attached) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
-        $(info check: android device not attached) \
-        $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
-      ), \
-      $(info check: adb not found) \
-      $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
-    ), \
-  ) \
-)
-
-ifeq ($(CFG_ADB_DEVICE_STATUS),true)
-CFG_ADB_TEST_DIR=/data/tmp
-
-$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
- $(shell $(CFG_ADB) remount 1>/dev/null) \
- $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
- $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
- $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
- $(foreach target,$(CFG_TARGET), \
-  $(if $(findstring android, $(target)), \
-   $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
-   $(foreach crate,$(TARGET_CRATES_$(target)), \
-    $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
-                    $(CFG_ADB_TEST_DIR)/$(target))), \
- )))
-else
-CFG_ADB_TEST_DIR=
-endif
-
-# $(1) - name of doc test
-# $(2) - file of the test
-define DOCTEST
-DOC_NAMES := $$(DOC_NAMES) $(1)
-DOCFILE_$(1) := $(2)
-endef
-
-$(foreach doc,$(DOCS), \
-  $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
-$(foreach file,$(wildcard $(S)src/doc/book/*.md), \
-  $(eval $(call DOCTEST,$(file:$(S)src/doc/book/%.md=book-%),$(file))))
-$(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
-  $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
-######################################################################
-# Main test targets
-######################################################################
-
-# The main testing target. Tests lots of stuff.
-check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# As above but don't bother running tidy.
-check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# A slightly smaller set of tests for smoke testing.
-check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
-	$(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
-	check-stage2-rpass check-stage2-rpass-valgrind \
-	check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Only check the 'reference' tests: rpass/cfail/rfail/rmake.
-check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
-	check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
-	check-stage2-rmake
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Only check the docs.
-check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
-
-# Some less critical tests that are not prone to breakage.
-# Not run as part of the normal test suite, but tested by bors on checkin.
-check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty
-
-.PHONY: check-sanitycheck
-
-check-sanitycheck:
-	$(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py
-
-# check + check-secondary.
-#
-# Issue #17883: build check-secondary first so hidden dependencies in
-# e.g. building compiletest are exercised (resolve those by adding
-# deps to rules that need them; not by putting `check` first here).
-check-all: check-secondary check
-
-# Pretty-printing tests.
-check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec
-
-define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE
-check-stage$(1)-build-compiletest: 	$$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD))
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage))))
-
-check-build-compiletest: \
-	check-stage1-build-compiletest \
-	check-stage2-build-compiletest
-
-.PHONY: cleantmptestlogs cleantestlibs
-
-cleantmptestlogs:
-	$(Q)rm -f tmp/*.log
-
-cleantestlibs:
-	$(Q)find $(CFG_BUILD)/test \
-         -name '*.[odasS]' -o \
-         -name '*.so' -o \
-         -name '*.dylib' -o \
-         -name '*.dll' -o \
-         -name '*.def' -o \
-         -name '*.bc' -o \
-         -name '*.dSYM' -o \
-         -name '*.libaux' -o \
-         -name '*.out' -o \
-         -name '*.err' -o \
-	 -name '*.debugger.script' \
-         | xargs rm -rf
-
-
-######################################################################
-# Tidy
-######################################################################
-
-.PHONY: tidy
-tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)) \
-		$(SNAPSHOT_RUSTC_POST_CLEANUP)
-	$(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src
-
-$(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \
-		$(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
-		$(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \
-		$(call rwildcard,$(S)src/tools/tidy/src,*.rs) \
-		$(SNAPSHOT_RUSTC_POST_CLEANUP) | \
-		$(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))
-	$(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \
-		--out-dir $(@D) --crate-name tidy
-
-######################################################################
-# Sets of tests
-######################################################################
-
-define DEF_TEST_SETS
-
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-	check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-incremental-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-ui-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-mir-opt-exec
-
-ifndef CFG_DISABLE_CODEGEN_TESTS
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-	check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec
-endif
-
-# Only test the compiler-dependent crates when the target is
-# able to build a compiler (when the target triple is in the set of host triples)
-ifneq ($$(findstring $(2),$$(CFG_HOST)),)
-
-check-stage$(1)-T-$(2)-H-$(3)-exec: \
-	check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec
-
-check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec
-
-check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
-	$$(foreach crate,$$(TEST_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
-
-else
-
-check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
-	$$(foreach crate,$$(TEST_TARGET_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
-
-endif
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
-        $$(foreach crate,$$(TEST_DOC_CRATES), \
-           check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
-        $$(foreach docname,$$(DOC_NAMES), \
-           check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \
-
-check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
-    check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
-	check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-    $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
-
-
-######################################################################
-# Crate testing
-######################################################################
-
-define TEST_RUNNER
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test crates without rebuilding any of the
-# parent crates.
-ifeq ($(NO_REBUILD),)
-TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
-			    $$(foreach crate,$$(TARGET_CRATES_$(2)), \
-				$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
-				$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
-
-else
-TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
-endif
-
-$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
-$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
-		$$(CRATEFILE_$(4)) \
-		$$(TESTDEP_$(1)_$(2)_$(3)_$(4))
-	@$$(call E, rustc: $$@)
-	$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-	    $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
-		-Cmetadata="test-crate" -L "$$(RT_OUTPUT_DIR_$(2))" \
-		$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-		$$(RUSTFLAGS_$(4))
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(foreach crate,$(TEST_CRATES), \
-    $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
-
-define DEF_TEST_CRATE_RULES
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-		$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-	@$$(call E, run: $$<)
-	$$(Q)touch $$@.start_time
-	$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \
-	    --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-	    $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
-	    && touch -r $$@.start_time $$@ && rm $$@.start_time
-endef
-
-define DEF_TEST_CRATE_RULES_android
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-		$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-	@$$(call E, run: $$< via adb)
-	$$(Q)touch $$@.start_time
-	$$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
-	$$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
-		./$$(notdir $$<) \
-		--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
-		$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
-		> tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
-	$$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
-	$$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-	$$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
-	$$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
-	@if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-	then \
-		rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-		touch -r $$@.start_time $$@ && rm $$@.start_time; \
-	else \
-		rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
-		exit 101; \
-	fi
-endef
-
-define DEF_TEST_CRATE_RULES_null
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-		$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
-	@$$(call E, failing: no device for $$< )
-	false
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate, $(TEST_CRATES), \
-    $(if $(findstring $(target),$(CFG_BUILD)), \
-     $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
-     $(if $(findstring android, $(target)), \
-      $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
-       $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
-       $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
-      ), \
-      $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
-     ))))))
-
-######################################################################
-# Rules for the compiletest tests (rpass, rfail, etc.)
-######################################################################
-
-RPASS_RS := $(call rwildcard,$(S)src/test/run-pass/,*.rs)
-RPASS_VALGRIND_RS := $(call rwildcard,$(S)src/test/run-pass-valgrind/,*.rs)
-RPASS_FULL_RS := $(call rwildcard,$(S)src/test/run-pass-fulldeps/,*.rs)
-RFAIL_FULL_RS := $(call rwildcard,$(S)src/test/run-fail-fulldeps/,*.rs)
-CFAIL_FULL_RS := $(call rwildcard,$(S)src/test/compile-fail-fulldeps/,*.rs)
-RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
-RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
-CFAIL_RS := $(call rwildcard,$(S)src/test/compile-fail/,*.rs)
-PFAIL_RS := $(call rwildcard,$(S)src/test/parse-fail/,*.rs)
-PRETTY_RS := $(call rwildcard,$(S)src/test/pretty/,*.rs)
-DEBUGINFO_GDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
-DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
-CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
-CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
-CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
-INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs)
-RMAKE_RS := $(wildcard $(S)src/test/run-make/*/Makefile)
-UI_RS := $(call rwildcard,$(S)src/test/ui/,*.rs) \
-         $(call rwildcard,$(S)src/test/ui/,*.stdout) \
-         $(call rwildcard,$(S)src/test/ui/,*.stderr)
-RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)
-MIR_OPT_RS := $(call rwildcard,$(S)src/test/mir-opt/,*.rs)
-
-RPASS_TESTS := $(RPASS_RS)
-RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
-RPASS_FULL_TESTS := $(RPASS_FULL_RS)
-RFAIL_FULL_TESTS := $(RFAIL_FULL_RS)
-CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
-RFAIL_TESTS := $(RFAIL_RS)
-CFAIL_TESTS := $(CFAIL_RS)
-PFAIL_TESTS := $(PFAIL_RS)
-PRETTY_TESTS := $(PRETTY_RS)
-DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
-DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
-CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
-CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
-INCREMENTAL_TESTS := $(INCREMENTAL_RS)
-RMAKE_TESTS := $(RMAKE_RS)
-UI_TESTS := $(UI_RS)
-MIR_OPT_TESTS := $(MIR_OPT_RS)
-RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
-
-CTEST_SRC_BASE_rpass = run-pass
-CTEST_BUILD_BASE_rpass = run-pass
-CTEST_MODE_rpass = run-pass
-CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind
-CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind
-CTEST_MODE_rpass-valgrind = run-pass-valgrind
-CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
-CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
-CTEST_MODE_rpass-full = run-pass
-CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rfail-full = run-fail-fulldeps
-CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps
-CTEST_MODE_rfail-full = run-fail
-CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps
-CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps
-CTEST_MODE_cfail-full = compile-fail
-CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rfail = run-fail
-CTEST_BUILD_BASE_rfail = run-fail
-CTEST_MODE_rfail = run-fail
-CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_cfail = compile-fail
-CTEST_BUILD_BASE_cfail = compile-fail
-CTEST_MODE_cfail = compile-fail
-CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_pfail = parse-fail
-CTEST_BUILD_BASE_pfail = parse-fail
-CTEST_MODE_pfail = parse-fail
-CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_debuginfo-gdb = debuginfo
-CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
-CTEST_MODE_debuginfo-gdb = debuginfo-gdb
-CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_debuginfo-lldb = debuginfo
-CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
-CTEST_MODE_debuginfo-lldb = debuginfo-lldb
-CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_codegen = codegen
-CTEST_BUILD_BASE_codegen = codegen
-CTEST_MODE_codegen = codegen
-CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_codegen-units = codegen-units
-CTEST_BUILD_BASE_codegen-units = codegen-units
-CTEST_MODE_codegen-units = codegen-units
-CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_incremental = incremental
-CTEST_BUILD_BASE_incremental = incremental
-CTEST_MODE_incremental = incremental
-CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rmake = run-make
-CTEST_BUILD_BASE_rmake = run-make
-CTEST_MODE_rmake = run-make
-CTEST_RUNTOOL_rmake = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_ui = ui
-CTEST_BUILD_BASE_ui = ui
-CTEST_MODE_ui = ui
-CTEST_RUNTOOL_ui = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_mir-opt = mir-opt
-CTEST_BUILD_BASE_mir-opt = mir-opt
-CTEST_MODE_mir-opt = mir-opt
-CTEST_RUNTOOL_mir-opt = $(CTEST_RUNTOOL)
-
-CTEST_SRC_BASE_rustdocck = rustdoc
-CTEST_BUILD_BASE_rustdocck = rustdoc
-CTEST_MODE_rustdocck = rustdoc
-CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL)
-
-# CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
-# disabled and the associated message to be printed as a warning
-# during attempts to run those tests.
-
-ifeq ($(CFG_GDB),)
-CTEST_DISABLE_debuginfo-gdb = "no gdb found"
-endif
-
-ifeq ($(CFG_LLDB),)
-CTEST_DISABLE_debuginfo-lldb = "no lldb found"
-endif
-
-ifneq ($(CFG_OSTYPE),apple-darwin)
-CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
-endif
-
-ifeq ($(CFG_OSTYPE),apple-darwin)
-CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root"
-endif
-
-ifeq ($(findstring android, $(CFG_TARGET)), android)
-CTEST_DISABLE_debuginfo-gdb =
-CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android"
-endif
-
-ifeq ($(findstring msvc,$(CFG_TARGET)),msvc)
-CTEST_DISABLE_debuginfo-gdb = "gdb tests are disabled on MSVC"
-endif
-
-# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
-# test group to be disabled *unless* the target is able to build a
-# compiler (i.e. when the target triple is in the set of host
-# triples).  The associated message will be printed as a warning
-# during attempts to run those tests.
-
-define DEF_CTEST_VARS
-
-# All the per-stage build rules you might want to call from the
-# command line.
-#
-# $(1) is the stage number
-# $(2) is the target triple to test
-# $(3) is the host triple to test
-
-# Prerequisites for compiletest tests
-TEST_SREQ$(1)_T_$(2)_H_$(3) = \
-	$$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
-	$$(SREQ$(1)_T_$(2)_H_$(3))
-
-# Rules for the cfail/rfail/rpass test runner
-
-# The tests select when to use debug configuration on their own;
-# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
-CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS)))
-
-# The tests cannot be optimized while the rest of the compiler is optimized, so
-# filter out the optimization (if any) from rustc and then figure out if we need
-# to be optimized
-CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
-ifndef CFG_DISABLE_OPTIMIZE_TESTS
-CTEST_RUSTC_FLAGS += -O
-endif
-
-# Analogously to the above, whether to pass `-g` when compiling tests
-# is a separate choice from whether to pass `-g` when building the
-# compiler and standard library themselves.
-CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS))
-CTEST_RUSTC_FLAGS := $$(subst -Cdebuginfo=1,,$$(CTEST_RUSTC_FLAGS))
-ifdef CFG_ENABLE_DEBUGINFO_TESTS
-CTEST_RUSTC_FLAGS += -g
-endif
-
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) = \
-		--compile-lib-path $$(HLIB$(1)_H_$(3)) \
-        --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
-        --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
-        --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-        --llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \
-        --stage-id stage$(1)-$(2) \
-        --target $(2) \
-        --host $(3) \
-	--docck-python $$(CFG_PYTHON) \
-	--lldb-python $$(CFG_LLDB_PYTHON) \
-        --gdb="$(CFG_GDB)" \
-        --lldb-version="$(CFG_LLDB_VERSION)" \
-        --llvm-version="$$(LLVM_VERSION_$(3))" \
-        --android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \
-        --adb-path=$(CFG_ADB) \
-        --adb-test-dir=$(CFG_ADB_TEST_DIR) \
-        --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
-        --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
-        --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
-	--cc '$$(call FIND_COMPILER,$$(CC_$(2)))' \
-	--cxx '$$(call FIND_COMPILER,$$(CXX_$(2)))' \
-	--cflags "$$(CFG_GCCISH_CFLAGS_$(2))" \
-	--llvm-components "$$(LLVM_ALL_COMPONENTS_$(2))" \
-	--llvm-cxxflags "$$(LLVM_CXXFLAGS_$(2))" \
-        $$(CTEST_TESTARGS)
-
-ifdef CFG_VALGRIND_RPASS
-ifdef GOOD_VALGRIND_$(2)
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)"
-endif
-endif
-
-ifndef CFG_DISABLE_VALGRIND_RPASS
-ifdef GOOD_VALGRIND_$(2)
-CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind
-endif
-endif
-
-CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
-CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS)
-CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
-CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
-CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
-CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
-CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
-                                               $(S)src/etc/lldb_batchmode.py \
-                                               $(S)src/etc/lldb_rust_formatters.py
-CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
-CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
-CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS)
-CTEST_DEPS_rmake_$(1)-T-$(2)-H-$(3) = $$(RMAKE_TESTS) \
-	$$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
-CTEST_DEPS_ui_$(1)-T-$(2)-H-$(3) = $$(UI_TESTS)
-CTEST_DEPS_mir-opt_$(1)-T-$(2)-H-$(3) = $$(MIR_OPT_TESTS)
-CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
-		$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
-		$$(CSREQ$(1)_T_$(3)_H_$(3)) \
-		$$(SREQ$(1)_T_$(3)_H_$(3)) \
-		$(S)src/etc/htmldocck.py
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
-
-define DEF_RUN_COMPILETEST
-
-CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
-        $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
-        --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
-        --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
-        --mode $$(CTEST_MODE_$(4)) \
-	$$(CTEST_RUNTOOL_$(4))
-
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-# CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
-# Goal: leave this variable as empty string if we should run the test.
-# Otherwise, set it to the reason we are not running the test.
-# (Encoded as a separate variable because GNU make does not have a
-# good way to express OR on ifeq commands)
-
-ifneq ($$(CTEST_DISABLE_$(4)),)
-# Test suite is disabled for all configured targets.
-CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
-else
-# else, check if non-self-hosted target (i.e. target not-in hosts) ...
-ifeq ($$(findstring $(2),$$(CFG_HOST)),)
-# ... if so, then check if this test suite is disabled for non-selfhosts.
-ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
-# Test suite is disabled for this target.
-CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
-endif
-endif
-# Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
-endif
-
-ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-	export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-	export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-		$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-                $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
-	@$$(call E, run $(4) [$(2)]: $$<)
-	$$(Q)touch $$@.start_time
-	$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
-		$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
-		--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-                && touch -r $$@.start_time $$@ && rm $$@.start_time
-
-else
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
-	@$$(call E, run $(4) [$(2)]: $$<)
-	@$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
-	touch $$@
-
-endif
-
-endef
-
-CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
-	debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental \
-	rmake ui mir-opt
-
-$(foreach host,$(CFG_HOST), \
- $(eval $(foreach target,$(CFG_TARGET), \
-  $(eval $(foreach stage,$(STAGES), \
-   $(eval $(foreach name,$(CTEST_NAMES), \
-   $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
-
-PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
-    pretty-pretty
-PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
-PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
-PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
-PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
-PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
-PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
-PRETTY_DIRNAME_pretty-rpass = run-pass
-PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind
-PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
-PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps
-PRETTY_DIRNAME_pretty-rfail = run-fail
-PRETTY_DIRNAME_pretty-pretty = pretty
-
-define DEF_PRETTY_FULLDEPS
-PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
-PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host))))))
-
-define DEF_RUN_PRETTY_TEST
-
-PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \
-		$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
-        --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
-        --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
-        --mode pretty
-
-check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
-
-$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
-	        $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-	        $$(PRETTY_DEPS_$(4)) \
-	        $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4))
-	@$$(call E, run pretty-rpass [$(2)]: $$<)
-	$$(Q)touch $$@.start_time
-	$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
-		$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
-		--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
-                && touch -r $$@.start_time $$@ && rm $$@.start_time
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach pretty-name,$(PRETTY_NAMES), \
-    $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
-
-
-######################################################################
-# Crate & freestanding documentation tests
-######################################################################
-
-define DEF_RUSTDOC
-RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
-RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
-
-# Freestanding
-
-define DEF_DOC_TEST
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test documentation without rebuilding
-# rustdoc etc.
-ifeq ($(NO_REBUILD),)
-DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
-	$$(DOCFILE_$(4)) \
-	$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-	$$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-else
-DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4))
-endif
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
-	@$$(call E, run doc-$(4) [$(2)])
-	$$(Q)touch $$@.start_time
-	$$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \
-		--test-args "$$(TESTARGS)" && \
-		touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
-	touch $$@
-endif
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach docname,$(DOC_NAMES), \
-    $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
-
-# Crates
-
-define DEF_CRATE_DOC_TEST
-
-# If NO_REBUILD is set then break the dependencies on everything but
-# the source files so we can test crate documentation without
-# rebuilding any of the parent crates.
-ifeq ($(NO_REBUILD),)
-CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
-	$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-	$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
-	$$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
-else
-CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
-endif
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
-	$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
-	@$$(call E, run doc-crate-$(4) [$(2)])
-	$$(Q)touch $$@.start_time
-	$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
-	    $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
-	        $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \
-	        touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
-	touch $$@
-endif
-
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(foreach crate,$(TEST_DOC_CRATES), \
-    $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
-
-define DEF_DOC_TEST_ERROR_INDEX
-
-check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index)
-
-ifeq ($(2),$$(CFG_BUILD))
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \
-		$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
-		doc/error-index.md
-	$$(Q)touch $$@.start_time
-	$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md
-	$$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time
-else
-$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index):
-	$$(Q)touch $$@
-endif
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach stage,$(STAGES), \
-   $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host))))))
-
-######################################################################
-# Shortcut rules
-######################################################################
-
-TEST_GROUPS = \
-	crates \
-	$(foreach crate,$(TEST_CRATES),$(crate)) \
-	$(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
-	rpass \
-	rpass-valgrind \
-	rpass-full \
-	rfail-full \
-	cfail-full \
-	rfail \
-	cfail \
-	pfail \
-	rmake \
-	rustdocck \
-	debuginfo-gdb \
-	debuginfo-lldb \
-	codegen \
-	codegen-units \
-	incremental \
-	ui \
-	doc \
-	$(foreach docname,$(DOC_NAMES),doc-$(docname)) \
-	pretty \
-	pretty-rpass \
-	pretty-rpass-valgrind \
-	pretty-rpass-full \
-	pretty-rfail-full \
-	pretty-rfail \
-	pretty-pretty \
-	mir-opt \
-	$(NULL)
-
-define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
-check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach host,$(CFG_HOST), \
-   $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
-
-define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
-check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach host,$(CFG_HOST), \
-   $(foreach group,$(TEST_GROUPS), \
-    $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
-
-define DEF_CHECK_FOR_STAGE
-check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
-check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
-                           check-stage$(1)-H-$$(target))
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
-
-define DEF_CHECK_FOR_STAGE_AND_GROUP
-check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
-check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
-                               check-stage$(1)-H-$$(target)-$(2))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach group,$(TEST_GROUPS), \
-  $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
-
-
-define DEF_CHECK_FOR_STAGE_AND_HOSTS
-check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
-                           check-stage$(1)-T-$$(target)-H-$(2))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach host,$(CFG_HOST), \
-  $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
-
-define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
-check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
-                                check-stage$(1)-T-$$(target)-H-$(2)-$(3))
-endef
-
-$(foreach stage,$(STAGES), \
- $(foreach host,$(CFG_HOST), \
-  $(foreach group,$(TEST_GROUPS), \
-   $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
-
-define DEF_CHECK_DOC_FOR_STAGE
-check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \
-                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
-                     $$(foreach crate,$$(TEST_DOC_CRATES), \
-                       check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \
-                     check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec
-endef
-
-$(foreach stage,$(STAGES), \
- $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
-
-define DEF_CHECK_CRATE
-check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
-endef
-
-$(foreach crate,$(TEST_CRATES), \
- $(eval $(call DEF_CHECK_CRATE,$(crate))))
diff --git a/mk/util.mk b/mk/util.mk
deleted file mode 100644
index 918484ac463..00000000000
--- a/mk/util.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-ifdef VERBOSE
-  Q :=
-  E =
-else
-  Q := @
-  E = echo $(1)
-endif
-
-print-%:
-	@echo $*=$($*)
-
-S := $(CFG_SRC_DIR)
-SREL := $(CFG_SRC_DIR_RELATIVE)
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 155c69eb8a2..6d814619eb6 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -99,6 +99,7 @@ name = "compiletest"
 version = "0.0.0"
 dependencies = [
  "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs
index 585d9f51b92..81e745bc76c 100644
--- a/src/bootstrap/channel.rs
+++ b/src/bootstrap/channel.rs
@@ -15,55 +15,45 @@
 //! `package_vers`, and otherwise indicating to the compiler what it should
 //! print out as part of its version information.
 
-use std::fs::File;
-use std::io::prelude::*;
 use std::process::Command;
 
 use build_helper::output;
 
 use Build;
 
-pub fn collect(build: &mut Build) {
-    // Currently the canonical source for the release number (e.g. 1.10.0) and
-    // the prerelease version (e.g. `.1`) is in `mk/main.mk`. We "parse" that
-    // here to learn about those numbers.
-    let mut main_mk = String::new();
-    t!(t!(File::open(build.src.join("mk/main.mk"))).read_to_string(&mut main_mk));
-    let mut release_num = "";
-    let mut prerelease_version = "";
-    for line in main_mk.lines() {
-        if line.starts_with("CFG_RELEASE_NUM") {
-            release_num = line.split('=').skip(1).next().unwrap().trim();
-        }
-        if line.starts_with("CFG_PRERELEASE_VERSION") {
-            prerelease_version = line.split('=').skip(1).next().unwrap().trim();
-        }
-    }
+// The version number
+const CFG_RELEASE_NUM: &'static str = "1.17.0";
+
+// An optional number to put after the label, e.g. '.2' -> '-beta.2'
+// Be sure to make this starts with a dot to conform to semver pre-release
+// versions (section 9)
+const CFG_PRERELEASE_VERSION: &'static str = ".1";
 
-    build.release_num = release_num.to_string();
-    build.prerelease_version = release_num.to_string();
+pub fn collect(build: &mut Build) {
+    build.release_num = CFG_RELEASE_NUM.to_string();
+    build.prerelease_version = CFG_RELEASE_NUM.to_string();
 
     // Depending on the channel, passed in `./configure --release-channel`,
     // determine various properties of the build.
     match &build.config.channel[..] {
         "stable" => {
-            build.release = release_num.to_string();
+            build.release = CFG_RELEASE_NUM.to_string();
             build.package_vers = build.release.clone();
             build.unstable_features = false;
         }
         "beta" => {
-            build.release = format!("{}-beta{}", release_num,
-                                   prerelease_version);
+            build.release = format!("{}-beta{}", CFG_RELEASE_NUM,
+                                   CFG_PRERELEASE_VERSION);
             build.package_vers = "beta".to_string();
             build.unstable_features = false;
         }
         "nightly" => {
-            build.release = format!("{}-nightly", release_num);
+            build.release = format!("{}-nightly", CFG_RELEASE_NUM);
             build.package_vers = "nightly".to_string();
             build.unstable_features = true;
         }
         _ => {
-            build.release = format!("{}-dev", release_num);
+            build.release = format!("{}-dev", CFG_RELEASE_NUM);
             build.package_vers = build.release.clone();
             build.unstable_features = true;
         }
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 9327cc0cf7f..1c3901bf2a1 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -381,13 +381,11 @@ pub fn rust_src(build: &Build) {
         "README.md",
         "RELEASES.md",
         "configure",
-        "Makefile.in",
         "x.py",
     ];
     let src_dirs = [
         "man",
         "src",
-        "mk"
     ];
 
     let filter_fn = move |path: &Path| {
diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in
index d6f6a7772c9..536095503e0 100644
--- a/src/bootstrap/mk/Makefile.in
+++ b/src/bootstrap/mk/Makefile.in
@@ -9,11 +9,12 @@
 # except according to those terms.
 
 include config.mk
-include $(CFG_SRC_DIR)mk/util.mk
 
 ifdef VERBOSE
+Q :=
 BOOTSTRAP_ARGS := -v
 else
+Q := @
 BOOTSTRAP_ARGS :=
 endif
 
diff --git a/src/ci/docker/x86_64-gnu-make/Dockerfile b/src/ci/docker/x86_64-gnu-make/Dockerfile
deleted file mode 100644
index c6071d704f5..00000000000
--- a/src/ci/docker/x86_64-gnu-make/Dockerfile
+++ /dev/null
@@ -1,26 +0,0 @@
-FROM ubuntu:16.04
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-  g++ \
-  make \
-  file \
-  curl \
-  ca-certificates \
-  python2.7 \
-  git \
-  cmake \
-  sudo \
-  gdb \
-  xz-utils
-
-ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
-RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
-      tar xJf - -C /usr/local/bin --strip-components=1
-
-RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
-    dpkg -i dumb-init_*.deb && \
-    rm dumb-init_*.deb
-ENTRYPOINT ["/usr/bin/dumb-init", "--"]
-
-ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-rustbuild
-ENV RUST_CHECK_TARGET check
diff --git a/src/etc/Dockerfile b/src/etc/Dockerfile
deleted file mode 100644
index 83d54789ff3..00000000000
--- a/src/etc/Dockerfile
+++ /dev/null
@@ -1,27 +0,0 @@
-FROM ubuntu:xenial
-
-# curl
-#   Download stage0, see src/bootstrap/bootstrap.py
-# g++
-#   Compile LLVM binding in src/rustllvm
-# gdb
-#   Used to run tests in src/test/debuginfo
-# git
-#   Get commit hash and commit date in version string
-# make
-#   Run build scripts in mk
-# libedit-dev zlib1g-dev
-#   LLVM dependencies as packaged in Ubuntu
-#   (They are optional, but Ubuntu package enables them)
-# llvm-3.7-dev (installed by llvm-3.7-tools)
-#   LLVM
-# llvm-3.7-tools
-#   FileCheck is used to run tests in src/test/codegen
-
-RUN apt-get update && apt-get -y install \
-    curl g++ gdb git make \
-    libedit-dev zlib1g-dev \
-    llvm-3.7-tools cmake
-
-RUN mkdir /build
-WORKDIR /build
diff --git a/src/etc/apple-darwin.supp b/src/etc/apple-darwin.supp
deleted file mode 100644
index 50e30caa2b3..00000000000
--- a/src/etc/apple-darwin.supp
+++ /dev/null
@@ -1,75 +0,0 @@
-{
-   osx-frameworks.rs-fails-otherwise-1
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:malloc
-   ...
-   fun:__CFInitialize
-   ...
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-2
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:malloc_zone_calloc
-   ...
-   fun:__CFInitialize
-   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-3
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:realloc
-   ...
-   fun:_read_images
-   fun:map_images_nolock
-   ...
-   fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
-   fun:_ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE
-   fun:dyld_register_image_state_change_handler
-   fun:_objc_init
-   fun:_os_object_init
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-4
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:calloc
-   ...
-   fun:__CFInitialize
-   fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE
-   fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
-   fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE
-}
-
-{
-   osx-frameworks.rs-fails-otherwise-5
-   Memcheck:Leak
-   match-leak-kinds: definite,possible
-   fun:malloc_zone_malloc
-   ...
-   fun:__CFInitialize
-   ...
-}
-
-{
-   fails-since-xcode-7.2
-   Memcheck:Leak
-   match-leak-kinds: possible
-   fun:malloc_zone_malloc
-   fun:_objc_copyClassNamesForImage
-   fun:_ZL9protocolsv
-   fun:_Z9readClassP10objc_classbb
-   fun:gc_init
-   fun:_ZL33objc_initializeClassPair_internalP10objc_classPKcS0_S0_
-   fun:layout_string_create
-   fun:_ZL12realizeClassP10objc_class
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-   fun:_ZL22copySwiftV1MangledNamePKcb
-}
diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py
deleted file mode 100644
index 0e103fbcffb..00000000000
--- a/src/etc/check-sanitycheck.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import subprocess
-import sys
-import functools
-
-STATUS = 0
-
-def error_unless_permitted(env_var, message):
-    global STATUS
-    if not os.getenv(env_var):
-        sys.stderr.write(message)
-        STATUS = 1
-
-def only_on(platforms):
-    def decorator(func):
-        @functools.wraps(func)
-        def inner():
-            if any(map(lambda x: sys.platform.startswith(x), platforms)):
-                func()
-        return inner
-    return decorator
-
-@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
-def check_rlimit_core():
-    import resource
-    soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
-    if soft > 0:
-        error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\
-RLIMIT_CORE is set to a nonzero value (%d). During debuginfo, the test suite
-will segfault many rustc's, creating many potentially large core files.
-set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
-""" % (soft))
-
-@only_on(['win32'])
-def check_console_code_page():
-    if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
-        sys.stderr.write('Warning: the console output code page is not UTF-8, \
-some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
-
-def main():
-    check_console_code_page()
-    check_rlimit_core()
-
-if __name__ == '__main__':
-    main()
-    sys.exit(STATUS)
diff --git a/src/etc/check-summary.py b/src/etc/check-summary.py
deleted file mode 100755
index 9312b685c14..00000000000
--- a/src/etc/check-summary.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import glob
-import sys
-
-if __name__ == '__main__':
-    summaries = []
-
-    def summarise(fname):
-        summary = {}
-        with open(fname) as fd:
-            for line in fd:
-                splitline = line.strip().split(' ')
-                if len(splitline) == 1:
-                    continue
-                status = splitline[0]
-                test = splitline[-1]
-                # track bench runs
-                if splitline[1] == 'ns/iter':
-                    status = 'bench'
-                if status not in summary:
-                    summary[status] = []
-                summary[status].append(test)
-            summaries.append((fname, summary))
-
-    def count(t):
-        return sum(map(lambda f: len(f[1].get(t, [])), summaries))
-
-    logfiles = sys.argv[1:]
-    for files in map(glob.glob, logfiles):
-        map(summarise, files)
-    ok = count('ok')
-    failed = count('failed')
-    ignored = count('ignored')
-    measured = count('bench')
-    print("summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" %
-          (len(logfiles), ok, failed, ignored, measured))
-    print("")
-
-    if failed > 0:
-        print("failed tests:")
-        for f, s in summaries:
-            failures = s.get('failed', [])
-            if len(failures) > 0:
-                print("  %s:" % (f))
-            for test in failures:
-                print("    %s" % (test))
diff --git a/src/etc/get-stage0.py b/src/etc/get-stage0.py
deleted file mode 100644
index 127251cc802..00000000000
--- a/src/etc/get-stage0.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import sys
-
-path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../bootstrap"))
-sys.path.append(path)
-
-import bootstrap
-
-def main(triple):
-    src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
-    data = bootstrap.stage0_data(src_root)
-
-    channel, date = data['rustc'].split('-', 1)
-
-    dl_dir = 'dl'
-    if not os.path.exists(dl_dir):
-        os.makedirs(dl_dir)
-
-    filename = 'rustc-{}-{}.tar.gz'.format(channel, triple)
-    url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename)
-    dst = dl_dir + '/' + filename
-    bootstrap.get(url, dst)
-
-    stage0_dst = triple + '/stage0'
-    if os.path.exists(stage0_dst):
-        for root, _, files in os.walk(stage0_dst):
-            for f in files:
-                os.unlink(os.path.join(root, f))
-    else:
-        os.makedirs(stage0_dst)
-    bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True)
-
-if __name__ == '__main__':
-    main(sys.argv[1])
diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh
deleted file mode 100755
index ee77206640e..00000000000
--- a/src/etc/local_stage0.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-TARG_DIR=$1
-PREFIX=$2
-RUSTLIBDIR=$3
-
-LIB_DIR=lib
-LIB_PREFIX=lib
-
-OS=`uname -s`
-case $OS in
-    ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku")
-    BIN_SUF=
-    LIB_SUF=.so
-    ;;
-    ("Darwin")
-    BIN_SUF=
-    LIB_SUF=.dylib
-    ;;
-    (*)
-    BIN_SUF=.exe
-    LIB_SUF=.dll
-    LIB_DIR=bin
-    LIB_PREFIX=
-    ;;
-esac
-
-if [ -z $PREFIX ]; then
-    echo "No local rust specified."
-    exit 1
-fi
-
-if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then
-    echo "No local rust installed at ${PREFIX}"
-    exit 1
-fi
-
-if [ -z $TARG_DIR ]; then
-    echo "No target directory specified."
-    exit 1
-fi
-
-case "$TARG_DIR" in
---print-rustc-release)
-  # not actually copying to TARG_DIR, just print the local rustc version and exit
-  ${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p'
-;;
-*)
-
-cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
-cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}arena*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}flate*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}fmt_macros*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}getopts*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}graphviz*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}proc_macro*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
-
-# do not fail if one of the above fails, as all we need is a working rustc!
-exit 0
-
-esac
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py
deleted file mode 100644
index 24b007576aa..00000000000
--- a/src/etc/mklldeps.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
-import os
-import sys
-import subprocess
-
-f = open(sys.argv[1], 'wb')
-
-components = sys.argv[2].split() # splits on whitespace
-enable_static = sys.argv[3]
-llvm_config = sys.argv[4]
-stdcpp_name = sys.argv[5]
-use_libcpp = sys.argv[6]
-
-f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
-//          take a look at src/etc/mklldeps.py if you're interested
-""")
-
-
-def run(args):
-    proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = proc.communicate()
-
-    if err:
-        print("failed to run llvm_config: args = `{}`".format(args))
-        print(err)
-        sys.exit(1)
-    return out
-
-def runErr(args):
-    proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    out, err = proc.communicate()
-
-    if err:
-        return False, out
-    else:
-        return True, out
-
-f.write("\n")
-
-args = [llvm_config, '--shared-mode']
-args.extend(components)
-llvm_shared, out = runErr(args)
-if llvm_shared:
-    llvm_shared = 'shared' in out
-
-# LLVM libs
-args = [llvm_config, '--libs', '--system-libs']
-args.extend(components)
-out = run(args)
-for lib in out.strip().replace("\n", ' ').split(' '):
-    if len(lib) == 0:
-        continue
-    # in some cases we get extra spaces in between libs so ignore those
-    if len(lib) == 1 and lib == ' ':
-        continue
-    # not all libs strictly follow -lfoo, on Bitrig, there is -pthread
-    if lib[0:2] == '-l':
-        lib = lib.strip()[2:]
-    elif lib[0] == '-':
-        lib = lib.strip()[1:]
-    # If this actually points at a literal file then we're on MSVC which now
-    # prints full paths, so get just the name of the library and strip off the
-    # trailing ".lib"
-    elif os.path.exists(lib):
-        lib = os.path.basename(lib)[:-4]
-    elif lib[-4:] == '.lib':
-        lib = lib[:-4]
-    f.write("#[link(name = \"" + lib + "\"")
-    if not llvm_shared and 'LLVM' in lib:
-        f.write(", kind = \"static\"")
-    f.write(")]\n")
-
-# LLVM ldflags
-out = run([llvm_config, '--ldflags'])
-for lib in out.strip().split(' '):
-    if lib[:2] == "-l":
-        f.write("#[link(name = \"" + lib[2:] + "\")]\n")
-
-# C++ runtime library
-out = run([llvm_config, '--cxxflags'])
-if enable_static == '1':
-    assert('stdlib=libc++' not in out)
-    f.write("#[link(name = \"" + stdcpp_name + "\", kind = \"static\")]\n")
-else:
-    # Note that we use `cfg_attr` here because on MSVC the C++ standard library
-    # is not c++ or stdc++, but rather the linker takes care of linking the
-    # right standard library.
-    if use_libcpp != "0" or 'stdlib=libc++' in out:
-        f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"c++\"))]\n")
-    else:
-        f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"" + stdcpp_name + "\"))]\n")
-
-# Attach everything to an extern block
-f.write("extern {}\n")
diff --git a/src/etc/x86.supp b/src/etc/x86.supp
deleted file mode 100644
index 6e409af79ae..00000000000
--- a/src/etc/x86.supp
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-   goddammit-llvm-why-u-no-valgrind
-   Memcheck:Cond
-   fun:*
-   ...
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-1
-   Memcheck:Addr1
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-2
-   Memcheck:Addr2
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-3
-   Memcheck:Addr4
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-4
-   Memcheck:Addr8
-   ...
-   fun:tlv_finalize
-   fun:_pthread_tsd_cleanup
-   fun:_pthread_exit
-   ...
-   fun:_pthread_start
-   fun:thread_start
-}
-
-{
-   down-with-thread-dtors.rs-fails-otherwise-5
-   Memcheck:Leak
-   match-leak-kinds: definite
-   fun:malloc
-   fun:tlv_allocate_and_initialize_for_key
-   fun:tlv_get_addr
-   ...
-   fun:start
-}
diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs
index cb7852995f3..a3402bf3994 100644
--- a/src/liballoc_jemalloc/build.rs
+++ b/src/liballoc_jemalloc/build.rs
@@ -21,7 +21,6 @@ use std::process::Command;
 use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     println!("cargo:rerun-if-changed=build.rs");
 
     // FIXME: This is a hack to support building targets that don't
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index fc8a5455d1d..8d81a09f5af 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -30,22 +30,6 @@ pub use imp::*;
 mod imp {
     use libc::{c_int, c_void, size_t};
 
-    // Linkage directives to pull in jemalloc and its dependencies.
-    //
-    // On some platforms we need to be sure to link in `pthread` which jemalloc
-    // depends on, and specifically on android we need to also link to libgcc.
-    // Currently jemalloc is compiled with gcc which will generate calls to
-    // intrinsics that are libgcc specific (e.g. those intrinsics aren't present in
-    // libcompiler-rt), so link that in to get that support.
-    #[link(name = "jemalloc", kind = "static")]
-    #[cfg_attr(target_os = "android", link(name = "gcc"))]
-    #[cfg_attr(all(not(windows),
-                   not(target_os = "android"),
-                   not(target_env = "musl")),
-               link(name = "pthread"))]
-    #[cfg(not(cargobuild))]
-    extern "C" {}
-
     // Note that the symbols here are prefixed by default on OSX and Windows (we
     // don't explicitly request it), and on Android and DragonFly we explicitly
     // request it as unprefixing cause segfaults (mismatches in allocators).
diff --git a/src/libflate/build.rs b/src/libflate/build.rs
index 245c705dfcc..12016980a2c 100644
--- a/src/libflate/build.rs
+++ b/src/libflate/build.rs
@@ -11,7 +11,6 @@
 extern crate gcc;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     gcc::Config::new()
         .file("../rt/miniz.c")
         .compile("libminiz.a");
diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs
index 8365e9db2a9..dedec7b1609 100644
--- a/src/libflate/lib.rs
+++ b/src/libflate/lib.rs
@@ -74,10 +74,6 @@ impl Drop for Bytes {
     }
 }
 
-#[link(name = "miniz", kind = "static")]
-#[cfg(not(cargobuild))]
-extern "C" {}
-
 extern "C" {
     /// Raw miniz compression function.
     fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs
index e8b3a9a42c2..84abc6bc4a5 100644
--- a/src/libpanic_unwind/gcc.rs
+++ b/src/libpanic_unwind/gcc.rs
@@ -301,10 +301,6 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
 // with any GCC runtime.
 #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
 pub mod eh_frame_registry {
-    #[link(name = "gcc_eh")]
-    #[cfg(not(cargobuild))]
-    extern "C" {}
-
     extern "C" {
         fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8);
         fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8);
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 2ee4cc49435..c74a9308e4e 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>)
 }
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-
     let target = env::var("TARGET").expect("TARGET was not set");
     let llvm_config = env::var_os("LLVM_CONFIG")
         .map(PathBuf::from)
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs
index b1615b9e38b..f300bf16145 100644
--- a/src/librustc_llvm/lib.rs
+++ b/src/librustc_llvm/lib.rs
@@ -422,13 +422,3 @@ impl Drop for OperandBundleDef {
         }
     }
 }
-
-// The module containing the native LLVM dependencies, generated by the build system
-// Note that this must come after the rustllvm extern declaration so that
-// parts of LLVM that rustllvm depends on aren't thrown away by the linker.
-// Works to the above fix for #15460 to ensure LLVM dependencies that
-// are only used by rustllvm don't get stripped by the linker.
-#[cfg(not(cargobuild))]
-mod llvmdeps {
-    include! { env!("CFG_LLVM_LINKAGE_FILE") }
-}
diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs
index 171954f325a..fcb7af11dce 100644
--- a/src/librustdoc/build.rs
+++ b/src/librustdoc/build.rs
@@ -11,7 +11,6 @@
 extern crate gcc;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     let mut cfg = gcc::Config::new();
     cfg.file("../rt/hoedown/src/autolink.c")
        .file("../rt/hoedown/src/buffer.c")
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index e8ff8930bdd..a0f4a3a8743 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -162,11 +162,6 @@ struct hoedown_buffer {
     unit: libc::size_t,
 }
 
-// hoedown FFI
-#[link(name = "hoedown", kind = "static")]
-#[cfg(not(cargobuild))]
-extern {}
-
 extern {
     fn hoedown_html_renderer_new(render_flags: libc::c_uint,
                                  nesting_level: libc::c_int)
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index a0844821709..0fca374f6e6 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -21,7 +21,6 @@ use std::process::Command;
 use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
     println!("cargo:rerun-if-changed=build.rs");
 
     let target = env::var("TARGET").expect("TARGET was not set");
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 1f3526e1a09..3a552c060a9 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -464,9 +464,6 @@ mod panicking;
 mod rand;
 mod memchr;
 
-// This module just defines per-platform native library dependencies
-mod rtdeps;
-
 // The runtime entry point and a few unstable public functions used by the
 // compiler
 pub mod rt;
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs
index e5edea241e1..d76e8816ca4 100644
--- a/src/libstd/panicking.rs
+++ b/src/libstd/panicking.rs
@@ -311,12 +311,12 @@ impl<'a> Location<'a> {
 }
 
 fn default_hook(info: &PanicInfo) {
-    #[cfg(any(not(cargobuild), feature = "backtrace"))]
+    #[cfg(feature = "backtrace")]
     use sys_common::backtrace;
 
     // If this is a double panic, make sure that we print a backtrace
     // for this panic. Otherwise only print it if logging is enabled.
-    #[cfg(any(not(cargobuild), feature = "backtrace"))]
+    #[cfg(feature = "backtrace")]
     let log_backtrace = {
         let panics = update_panic_count(0);
 
@@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) {
         let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}",
                          name, msg, file, line);
 
-        #[cfg(any(not(cargobuild), feature = "backtrace"))]
+        #[cfg(feature = "backtrace")]
         {
             use sync::atomic::{AtomicBool, Ordering};
 
diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs
deleted file mode 100644
index 5dc6ee2bc8c..00000000000
--- a/src/libstd/rtdeps.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! This module contains the linkage attributes to all runtime dependencies of
-//! the standard library This varies per-platform, but these libraries are
-//! necessary for running libstd.
-
-#![cfg(not(cargobuild))]
-
-// LLVM implements the `frem` instruction as a call to `fmod`, which lives in
-// libm. Hence, we must explicitly link to it.
-//
-// On Linux, librt and libdl are indirect dependencies via std,
-// and binutils 2.22+ won't add them automatically
-#[cfg(all(target_os = "linux", not(target_env = "musl")))]
-#[link(name = "dl")]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(target_os = "android")]
-#[link(name = "dl")]
-#[link(name = "log")]
-extern {}
-
-#[cfg(target_os = "freebsd")]
-#[link(name = "execinfo")]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(any(target_os = "dragonfly",
-          target_os = "bitrig",
-          target_os = "netbsd",
-          target_os = "openbsd"))]
-#[link(name = "pthread")]
-extern {}
-
-#[cfg(target_os = "solaris")]
-#[link(name = "socket")]
-#[link(name = "posix4")]
-#[link(name = "pthread")]
-extern {}
-
-// For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions
-// missing (ie always error) in Newlib.
-#[cfg(all(target_os = "nacl", not(test)))]
-#[link(name = "nacl_io", kind = "static")]
-#[link(name = "c++", kind = "static")] // for `nacl_io` and EH.
-#[link(name = "pthread", kind = "static")]
-extern {}
-
-#[cfg(target_os = "macos")]
-#[link(name = "System")]
-extern {}
-
-#[cfg(target_os = "ios")]
-#[link(name = "System")]
-extern {}
-
-#[cfg(target_os = "haiku")]
-#[link(name = "network")]
-extern {}
diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs
index 0f447ff4ec4..6e35a472792 100644
--- a/src/libstd/sys/unix/args.rs
+++ b/src/libstd/sys/unix/args.rs
@@ -189,11 +189,6 @@ mod imp {
             fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId;
         }
 
-        #[link(name = "Foundation", kind = "framework")]
-        #[link(name = "objc")]
-        #[cfg(not(cargobuild))]
-        extern {}
-
         type Sel = *const libc::c_void;
         type NsId = *const libc::c_void;
 
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs
index fd7dc17cccd..c57751a01d7 100644
--- a/src/libstd/sys/unix/mod.rs
+++ b/src/libstd/sys/unix/mod.rs
@@ -33,7 +33,7 @@ pub mod weak;
 
 pub mod args;
 pub mod android;
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 pub mod backtrace;
 pub mod condvar;
 pub mod env;
diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs
index 9b1cf6ffd0e..77ebad4e344 100644
--- a/src/libstd/sys/unix/rand.rs
+++ b/src/libstd/sys/unix/rand.rs
@@ -257,10 +257,6 @@ mod imp {
     #[allow(non_upper_case_globals)]
     const kSecRandomDefault: *const SecRandom = ptr::null();
 
-    #[link(name = "Security", kind = "framework")]
-    #[cfg(not(cargobuild))]
-    extern {}
-
     extern {
         fn SecRandomCopyBytes(rnd: *const SecRandom,
                               count: size_t, bytes: *mut u8) -> c_int;
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 850d6f49612..e5010ca3564 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -833,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL {
 }
 pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
 
-#[link(name = "ws2_32")]
-#[link(name = "userenv")]
-#[link(name = "shell32")]
-#[link(name = "advapi32")]
-#[cfg(not(cargobuild))]
-extern {}
-
 extern "system" {
     pub fn WSAStartup(wVersionRequested: WORD,
                       lpWSAData: LPWSADATA) -> c_int;
diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs
index d464a13ad1d..0bdbeddb112 100644
--- a/src/libstd/sys_common/gnu/libbacktrace.rs
+++ b/src/libstd/sys_common/gnu/libbacktrace.rs
@@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void,
                       msg: *const libc::c_char,
                       errnum: libc::c_int);
     enum backtrace_state {}
-    #[link(name = "backtrace", kind = "static")]
-    #[cfg(all(not(test), not(cargobuild)))]
-    extern {}
 
     extern {
         fn backtrace_create_state(filename: *const libc::c_char,
diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs
index 634d6258885..d4d3365dc01 100644
--- a/src/libstd/sys_common/mod.rs
+++ b/src/libstd/sys_common/mod.rs
@@ -29,7 +29,7 @@ use sync::Once;
 use sys;
 
 pub mod at_exit_imp;
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 pub mod backtrace;
 pub mod condvar;
 pub mod io;
@@ -50,7 +50,7 @@ pub use sys::net;
 #[cfg(not(target_os = "redox"))]
 pub mod net;
 
-#[cfg(any(not(cargobuild), feature = "backtrace"))]
+#[cfg(feature = "backtrace")]
 #[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))),
           all(windows, target_env = "gnu")))]
 pub mod gnu;
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
index db41a368a16..f18b694d3d0 100644
--- a/src/libunwind/build.rs
+++ b/src/libunwind/build.rs
@@ -11,8 +11,6 @@
 use std::env;
 
 fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-
     let target = env::var("TARGET").expect("TARGET was not set");
 
     if target.contains("linux") {
diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs
index 269c2d65b63..7fb58373251 100644
--- a/src/libunwind/libunwind.rs
+++ b/src/libunwind/libunwind.rs
@@ -240,34 +240,3 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
     }
 }
 } // cfg_if!
-
-#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")),
-               target_os = "freebsd",
-               target_os = "solaris",
-               target_os = "haiku",
-               all(target_os = "linux",
-                   target_env = "musl",
-                   not(target_arch = "x86"),
-                   not(target_arch = "x86_64"))),
-           link(name = "gcc_s"))]
-#[cfg_attr(all(target_os = "linux",
-               target_env = "musl",
-               any(target_arch = "x86", target_arch = "x86_64"),
-               not(test)),
-           link(name = "unwind", kind = "static"))]
-#[cfg_attr(target_os = "fuchsia",
-           link(name = "unwind"))]
-#[cfg_attr(any(target_os = "android", target_os = "openbsd"),
-           link(name = "gcc"))]
-#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")),
-           link(name = "gcc"))]
-#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"),
-           link(name = "unwind"))]
-#[cfg_attr(target_os = "dragonfly",
-           link(name = "gcc_pic"))]
-#[cfg_attr(target_os = "bitrig",
-           link(name = "c++abi"))]
-#[cfg_attr(all(target_os = "windows", target_env = "gnu"),
-           link(name = "gcc_eh"))]
-#[cfg(not(cargobuild))]
-extern "C" {}
diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml
index 2982f29f931..1fc98a78a7c 100644
--- a/src/tools/compiletest/Cargo.toml
+++ b/src/tools/compiletest/Cargo.toml
@@ -2,9 +2,9 @@
 authors = ["The Rust Project Developers"]
 name = "compiletest"
 version = "0.0.0"
-build = "build.rs"
 
 [dependencies]
 log = "0.3"
 env_logger = { version = "0.3.5", default-features = false }
 rustc-serialize = "0.3"
+filetime = "0.1"
diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs
deleted file mode 100644
index d5164b9b759..00000000000
--- a/src/tools/compiletest/build.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-}
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 71d8d62c75b..522cd222c26 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -25,6 +25,7 @@ use extract_gdb_version;
 pub struct EarlyProps {
     pub ignore: bool,
     pub should_fail: bool,
+    pub aux: Vec<String>,
 }
 
 impl EarlyProps {
@@ -32,6 +33,7 @@ impl EarlyProps {
         let mut props = EarlyProps {
             ignore: false,
             should_fail: false,
+            aux: Vec::new(),
         };
 
         iter_header(testfile,
@@ -50,6 +52,10 @@ impl EarlyProps {
                 ignore_lldb(config, ln) ||
                 ignore_llvm(config, ln);
 
+            if let Some(s) = parse_aux_build(ln) {
+                props.aux.push(s);
+            }
+
             props.should_fail = props.should_fail || parse_name_directive(ln, "should-fail");
         });
 
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 40ba66a15d5..5a97f7e3ee9 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -21,17 +21,11 @@
 extern crate libc;
 extern crate test;
 extern crate getopts;
-
-#[cfg(cargobuild)]
 extern crate rustc_serialize;
-#[cfg(not(cargobuild))]
-extern crate serialize as rustc_serialize;
-
 #[macro_use]
 extern crate log;
-
-#[cfg(cargobuild)]
 extern crate env_logger;
+extern crate filetime;
 
 use std::env;
 use std::ffi::OsString;
@@ -39,6 +33,7 @@ use std::fs;
 use std::io;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use filetime::FileTime;
 use getopts::{optopt, optflag, reqopt};
 use common::Config;
 use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode};
@@ -58,11 +53,7 @@ mod raise_fd_limit;
 mod uidiff;
 
 fn main() {
-    #[cfg(cargobuild)]
-    fn log_init() { env_logger::init().unwrap(); }
-    #[cfg(not(cargobuild))]
-    fn log_init() {}
-    log_init();
+    env_logger::init().unwrap();
 
     let config = parse_config(env::args().collect());
 
@@ -478,7 +469,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     };
 
     // Debugging emscripten code doesn't make sense today
-    let mut ignore = early_props.ignore;
+    let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props);
     if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) &&
         config.target.contains("emscripten") {
         ignore = true;
@@ -494,6 +485,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     }
 }
 
+fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
+    let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp",
+                             testpaths.file.file_name().unwrap()
+                                           .to_str().unwrap(),
+                             config.host,
+                             config.target,
+                             config.stage_id);
+    config.build_base.canonicalize()
+          .unwrap_or(config.build_base.clone())
+          .join(stamp_name)
+}
+
+fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
+    let stamp = mtime(&stamp(config, testpaths));
+    let mut inputs = vec![
+        mtime(&testpaths.file),
+        mtime(&config.rustc_path),
+    ];
+    for aux in props.aux.iter() {
+        inputs.push(mtime(&testpaths.file.parent().unwrap()
+                                         .join("auxiliary")
+                                         .join(aux)));
+    }
+    for lib in config.run_lib_path.read_dir().unwrap() {
+        let lib = lib.unwrap();
+        inputs.push(mtime(&lib.path()));
+    }
+    inputs.iter().any(|input| *input > stamp)
+}
+
+fn mtime(path: &Path) -> FileTime {
+    fs::metadata(path).map(|f| {
+        FileTime::from_last_modification_time(&f)
+    }).unwrap_or(FileTime::zero())
+}
+
 pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName {
     // Convert a complete path to something like
     //
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 9f7d4157931..bcec1f63bc0 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -80,6 +80,8 @@ pub fn run(config: Config, testpaths: &TestPaths) {
     }
 
     base_cx.complete_all();
+
+    File::create(::stamp(&config, &testpaths)).unwrap();
 }
 
 struct TestCx<'test> {