2012-12-11 02:32:48 +01:00
|
|
|
# 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.
|
|
|
|
|
2014-02-14 12:34:18 +01:00
|
|
|
# <help> \(^o^)/
|
2014-02-14 06:22:08 +01:00
|
|
|
#
|
2014-02-14 12:34:18 +01:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# First, start with one of these build targets:
|
|
|
|
#
|
2014-02-18 11:55:34 +01:00
|
|
|
# * all - The default. Build a complete, bootstrapped compiler.
|
2014-02-14 12:34:18 +01:00
|
|
|
# `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
|
|
|
|
#
|
2015-09-19 14:10:54 +02:00
|
|
|
# * clean - Clean the build repository. It is advised to run this
|
2014-02-18 11:55:34 +01:00
|
|
|
# command if you want to build Rust again, after an update
|
|
|
|
# of the git repository.
|
|
|
|
#
|
2014-02-14 12:34:18 +01:00
|
|
|
# * install - Install Rust. Note that installation is not necessary
|
|
|
|
# to use the compiler.
|
|
|
|
#
|
|
|
|
# * uninstall - Uninstall the binaries
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# For tips on working with The Rust Build System, just:
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# run `make tips`
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# Otherwise
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# run `make`
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# </help>
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# <tips>
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# # The Rust Build System Tip Line
|
|
|
|
#
|
|
|
|
# There are a bazillion different targets you might want to build. Here
|
|
|
|
# are a few ideas.
|
2014-02-14 06:22:08 +01:00
|
|
|
#
|
2014-02-14 12:34:18 +01:00
|
|
|
# * 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
|
2014-02-15 04:17:50 +01:00
|
|
|
# * 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
|
2016-05-03 07:13:10 +02:00
|
|
|
# * tidy - Basic style check, show highest rustc error code and
|
|
|
|
# the status of language and lib features
|
2015-06-29 03:49:22 +02:00
|
|
|
# * rustc-stage$(stage) - Only build up to a specific stage
|
2016-06-02 22:19:20 +02:00
|
|
|
# * $host/stage1/bin/rustc - Only build stage1 rustc, not libstd. For further
|
|
|
|
# information see "Rust recipes for build system success" below.
|
2014-02-14 06:22:08 +01:00
|
|
|
#
|
|
|
|
# Then mix in some of these environment variables to harness the
|
2014-02-14 12:34:18 +01:00
|
|
|
# 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
|
2014-09-07 20:05:32 +02:00
|
|
|
# * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# * `TESTNAME=...` - Specify the name of tests to run
|
|
|
|
# * `CHECK_IGNORED=1` - Run normally-ignored tests
|
2014-05-15 20:15:35 +02:00
|
|
|
# * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag)
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
|
|
|
|
# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
|
2015-04-17 16:35:35 +02:00
|
|
|
# (requires `CFG_ENABLE_VALGRIND`)
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# * `NO_REBUILD=1` - Don't rebootstrap when testing std
|
|
|
|
# (and possibly other crates)
|
2014-02-15 04:17:50 +01:00
|
|
|
# * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# * `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`
|
2014-02-14 06:22:08 +01:00
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# # Rust recipes for build system success
|
|
|
|
#
|
2015-06-29 04:05:09 +02:00
|
|
|
# // Modifying libstd? Use this command to run unit tests just on your change
|
2014-02-15 04:17:50 +01:00
|
|
|
# make check-stage1-std NO_REBUILD=1 NO_BENCH=1
|
|
|
|
#
|
2016-06-02 22:19:20 +02:00
|
|
|
# // 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
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# // 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
|
2015-03-19 20:42:53 +01:00
|
|
|
# make check-stage1-std RUST_TEST_THREADS=1
|
2014-02-15 04:17:50 +01:00
|
|
|
#
|
2016-02-25 05:51:32 +01:00
|
|
|
# // To make debug!() and other logging calls visible, reconfigure:
|
|
|
|
# ./configure --enable-debug-assertions
|
|
|
|
# make ....
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# If you really feel like getting your hands dirty, then:
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# run `make nitty-gritty`
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2016-05-07 23:51:13 +02:00
|
|
|
# # 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!
|
|
|
|
#
|
2014-02-15 04:17:50 +01:00
|
|
|
# </tips>
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2014-02-18 11:53:23 +01:00
|
|
|
# <nitty-gritty>
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
|
|
|
# # The Rust Build System
|
|
|
|
#
|
|
|
|
# Gosh I wish there was something useful here (TODO).
|
2014-02-14 06:22:08 +01:00
|
|
|
#
|
|
|
|
# # 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
|
2014-02-14 12:34:18 +01:00
|
|
|
# Rust Build System.*
|
2011-10-02 05:12:08 +02:00
|
|
|
#
|
|
|
|
# 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
|
2014-01-05 02:55:20 +01:00
|
|
|
# rustlib - rustc's own place to organize libraries
|
2011-10-02 05:12:08 +02:00
|
|
|
# $(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
|
2011-11-03 18:53:49 +01:00
|
|
|
# by rustc. In general, rust programs, even those compiled for the
|
2011-10-02 05:12:08 +02:00
|
|
|
# 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.
|
|
|
|
#
|
2014-02-18 11:55:34 +01:00
|
|
|
# General rust binaries may still live in the host bin directory; they
|
2011-10-02 05:12:08 +02:00
|
|
|
# will just link against the libraries in the target lib directory.
|
|
|
|
#
|
|
|
|
# Admittedly this is a little convoluted.
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2015-04-11 02:01:09 +02:00
|
|
|
# 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
|
|
|
|
#
|
2014-02-18 11:53:23 +01:00
|
|
|
# </nitty-gritty>
|
2014-02-14 12:34:18 +01:00
|
|
|
#
|
2011-10-02 05:12:08 +02:00
|
|
|
|
2013-03-02 13:25:12 +01:00
|
|
|
######################################################################
|
2014-02-14 08:55:49 +01:00
|
|
|
# Primary rules
|
2011-03-21 19:23:19 +01:00
|
|
|
######################################################################
|
|
|
|
|
2013-09-26 23:56:53 +02:00
|
|
|
# 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.
|
|
|
|
|
2014-02-14 08:55:49 +01:00
|
|
|
# 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
|
2014-03-25 23:40:52 +01:00
|
|
|
# All crates and their dependencies
|
|
|
|
include $(CFG_SRC_DIR)mk/crates.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# 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
|
2013-10-31 07:57:27 +01:00
|
|
|
include $(CFG_SRC_DIR)mk/rt.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# Rules for crates in the target directories
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/target.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# Rules for crates in the host directories
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/host.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# Special rules for bootstrapping stage0
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/stage0.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# Rust-specific LLVM extensions
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/rustllvm.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# Documentation
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/docs.mk
|
2014-02-14 08:55:49 +01:00
|
|
|
# LLVM
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/llvm.mk
|
2014-11-13 17:25:15 +01:00
|
|
|
# Rules for installing debugger scripts
|
|
|
|
include $(CFG_SRC_DIR)mk/debuggers.mk
|
2011-06-25 21:23:27 +02:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Secondary makefiles, conditionalized for speed
|
|
|
|
######################################################################
|
|
|
|
|
2014-02-14 08:55:49 +01:00
|
|
|
# The test suite
|
2011-06-30 22:41:20 +02:00
|
|
|
ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
|
|
|
|
$(findstring test,$(MAKECMDGOALS)) \
|
|
|
|
$(findstring tidy,$(MAKECMDGOALS))),)
|
|
|
|
CFG_INFO := $(info cfg: including test rules)
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/tests.mk
|
2014-07-21 22:04:35 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/grammar.mk
|
2011-06-25 21:23:27 +02:00
|
|
|
endif
|
|
|
|
|
2014-02-13 02:26:10 +01:00
|
|
|
# Copy all the distributables to another directory for binary install
|
|
|
|
ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
|
2014-02-13 09:22:18 +01:00
|
|
|
$(findstring dist,$(MAKECMDGOALS)) \
|
2014-02-13 02:26:10 +01:00
|
|
|
$(findstring install,$(MAKECMDGOALS))),)
|
|
|
|
CFG_INFO := $(info cfg: including prepare rules)
|
|
|
|
include $(CFG_SRC_DIR)mk/prepare.mk
|
2011-07-21 20:58:01 +02:00
|
|
|
endif
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2014-02-13 02:26:10 +01:00
|
|
|
# Source and binary distribution artifacts
|
|
|
|
ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
|
2014-03-26 01:54:26 +01:00
|
|
|
$(findstring install,$(MAKECMDGOALS)) \
|
2014-02-13 02:26:10 +01:00
|
|
|
$(findstring clean,$(MAKECMDGOALS))),)
|
|
|
|
CFG_INFO := $(info cfg: including dist rules)
|
|
|
|
include $(CFG_SRC_DIR)mk/dist.mk
|
|
|
|
endif
|
|
|
|
|
2014-03-26 01:54:26 +01:00
|
|
|
# (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
|
|
|
|
|
2014-02-13 02:26:10 +01:00
|
|
|
# Cleaning
|
|
|
|
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
|
|
|
CFG_INFO := $(info cfg: including clean rules)
|
|
|
|
include $(CFG_SRC_DIR)mk/clean.mk
|
|
|
|
endif
|
|
|
|
|
2014-02-14 08:55:49 +01:00
|
|
|
# CTAGS building
|
2011-10-12 21:10:21 +02:00
|
|
|
ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
|
2016-06-17 12:07:48 +02:00
|
|
|
$(findstring TAGS.vi,$(MAKECMDGOALS)) \
|
|
|
|
$(findstring TAGS.rustc.emacs,$(MAKECMDGOALS)) \
|
|
|
|
$(findstring TAGS.rustc.vi,$(MAKECMDGOALS))),)
|
2011-10-12 21:10:21 +02:00
|
|
|
CFG_INFO := $(info cfg: including ctags rules)
|
2012-03-27 01:05:33 +02:00
|
|
|
include $(CFG_SRC_DIR)mk/ctags.mk
|
2011-10-12 21:10:21 +02:00
|
|
|
endif
|
2016-05-07 23:51:13 +02:00
|
|
|
|
|
|
|
.DEFAULT:
|
2016-05-22 08:28:42 +02:00
|
|
|
@echo
|
|
|
|
@echo "======================================================"
|
2016-05-07 23:51:13 +02:00
|
|
|
@echo "== If you need help, run 'make help' or 'make tips' =="
|
2016-05-22 08:28:42 +02:00
|
|
|
@echo "======================================================"
|
|
|
|
@echo
|
2016-05-07 23:51:13 +02:00
|
|
|
exit 1
|