]> git.proxmox.com Git - rustc.git/blame - Makefile.in
New upstream version 1.16.0+dfsg1
[rustc.git] / Makefile.in
CommitLineData
223e47cc
LB
1# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2# file at the top-level directory of this distribution and at
3# http://rust-lang.org/COPYRIGHT.
4#
5# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8# option. This file may not be copied, modified, or distributed
9# except according to those terms.
10
1a4d82fc
JJ
11# <help> \(^o^)/
12#
13# Greetings, adventurer! The Rust Build System is at your service.
14#
15# Whether you want a genuine copy of `rustc`, access to the latest and
16# most authoritative Rust documentation, or even to investigate the
17# most intimate workings of the compiler itself, you've come to the
18# right place. Let's see what's on the menu.
19#
32a655c1
SL
20# Please note that most of these options only work if configure was
21# run with --disable-rustbuild. For documentation on the new build
22# system, see CONTRIBUTING.md.
23#
1a4d82fc
JJ
24# First, start with one of these build targets:
25#
26# * all - The default. Build a complete, bootstrapped compiler.
27# `rustc` will be in `${target-triple}/stage2/bin/`. Run it
28# directly from the build directory if you like. This also
29# comes with docs in `doc/`.
30#
31# * check - Run the complete test suite
32#
b039eaaf 33# * clean - Clean the build repository. It is advised to run this
1a4d82fc
JJ
34# command if you want to build Rust again, after an update
35# of the git repository.
36#
37# * install - Install Rust. Note that installation is not necessary
38# to use the compiler.
39#
40# * uninstall - Uninstall the binaries
41#
42# For tips on working with The Rust Build System, just:
43#
44# run `make tips`
45#
46# Otherwise
47#
48# run `make`
49#
50# </help>
51#
52# <tips>
53#
54# # The Rust Build System Tip Line
55#
56# There are a bazillion different targets you might want to build. Here
57# are a few ideas.
58#
59# * docs - Build gobs of HTML documentation and put it into `doc/`
60# * check-$(crate) - Test a crate, e.g. `check-std`
61# * check-ref - Run the language reference tests
62# * check-docs - Test the documentation examples
63# * check-stage$(stage)-$(crate) - Test a crate in a specific stage
64# * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/
65# * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests
a7813a04
XL
66# * tidy - Basic style check, show highest rustc error code and
67# the status of language and lib features
c1a9b12d 68# * rustc-stage$(stage) - Only build up to a specific stage
3157f602
XL
69# * $host/stage1/bin/rustc - Only build stage1 rustc, not libstd. For further
70# information see "Rust recipes for build system success" below.
1a4d82fc
JJ
71#
72# Then mix in some of these environment variables to harness the
73# ultimate power of The Rust Build System.
74#
75# * `VERBOSE=1` - Print all commands. Use this to see what's going on.
76# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
77# * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script
78#
79# * `TESTNAME=...` - Specify the name of tests to run
80# * `CHECK_IGNORED=1` - Run normally-ignored tests
81# * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag)
82#
83# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
84# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
d9579d0f 85# (requires `CFG_ENABLE_VALGRIND`)
1a4d82fc
JJ
86#
87# * `NO_REBUILD=1` - Don't rebootstrap when testing std
88# (and possibly other crates)
89# * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files
90#
91# * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
92# * `ASM_COMMENTS=1` - Use `-Z asm-comments`
93# * `TIME_PASSES=1` - Use `-Z time-passes`
94# * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
95# * `TRACE=1` - Use `-Z trace`
96#
97# # Rust recipes for build system success
98#
c1a9b12d 99# // Modifying libstd? Use this command to run unit tests just on your change
1a4d82fc
JJ
100# make check-stage1-std NO_REBUILD=1 NO_BENCH=1
101#
3157f602
XL
102# // Modifying just rustc?
103# // Compile rustc+libstd once
104# make rustc-stage1
105# // From now on use this command to rebuild just rustc and reuse the previously built libstd
106# // $host is a target triple, eg. x86_64-unknown-linux-gnu
107# // The resulting binary is located at $host/stage1/bin/rustc.
108# // If there are any issues with libstd recompile it with the command above.
109# make $host/stage1/bin/rustc
110#
1a4d82fc
JJ
111# // Added a run-pass test? Use this to test running your test
112# make check-stage1-rpass TESTNAME=my-shiny-new-test
113#
114# // Having trouble figuring out which test is failing? Turn off parallel tests
c34b1796 115# make check-stage1-std RUST_TEST_THREADS=1
1a4d82fc 116#
7453a54e
SL
117# // To make debug!() and other logging calls visible, reconfigure:
118# ./configure --enable-debug-assertions
119# make ....
120#
1a4d82fc
JJ
121# If you really feel like getting your hands dirty, then:
122#
123# run `make nitty-gritty`
124#
a7813a04
XL
125# # Make command examples
126#
127# ## Docs linked commands
128#
129# * make check-stage1-rustdocck: Builds rustdoc. It has the advantage to compile
130# quite quickly since we're only using stage1
131# executables.
132# * make doc/error-index.md: Gets all doc blocks from doc comments and error
133# explanations to put them in a markdown file. You
134# can then test them by running
135# "rustdoc --test error-index.md".
136#
137# And of course, the wonderfully useful 'make tidy'! Always run it before opening a pull request to rust!
138#
1a4d82fc
JJ
139# </tips>
140#
141# <nitty-gritty>
142#
143# # The Rust Build System
144#
145# Gosh I wish there was something useful here (TODO).
146#
147# # An (old) explanation of how the build is structured:
148#
149# *Note: Hey, like, this is probably inaccurate, and is definitely
150# an outdated and insufficient explanation of the remarkable
151# Rust Build System.*
223e47cc
LB
152#
153# There are multiple build stages (0-3) needed to verify that the
154# compiler is properly self-hosting. Each stage is divided between
155# 'host' artifacts and 'target' artifacts, where the stageN host
156# compiler builds artifacts for 1 or more stageN target architectures.
157# Once the stageN target compiler has been built for the host
158# architecture it is promoted (copied) to a stageN+1 host artifact.
159#
160# The stage3 host compiler is a compiler that successfully builds
161# itself and should (in theory) be bitwise identical to the stage2
162# host compiler. The process is bootstrapped using a stage0 host
163# compiler downloaded from a previous snapshot.
164#
165# At no time should stageN artifacts be interacting with artifacts
166# from other stages. For consistency, we use the 'promotion' logic
167# for all artifacts, even those that don't make sense on non-host
168# architectures.
169#
170# The directory layout for a stage is intended to match the layout
171# of the installed compiler, and looks like the following:
172#
173# stageN - this is the system root, corresponding to, e.g. /usr
174# bin - binaries compiled for the host
175# lib - libraries used by the host compiler
1a4d82fc 176# rustlib - rustc's own place to organize libraries
223e47cc
LB
177# $(target) - target-specific artifacts
178# bin - binaries for target architectures
179# lib - libraries for target architectures
180#
181# A note about host libraries:
182#
183# The only libraries that get promoted to stageN/lib are those needed
184# by rustc. In general, rust programs, even those compiled for the
185# host architecture will use libraries from the target
186# directories. This gives rust some freedom to experiment with how
187# libraries are managed and versioned without polluting the common
188# areas of the filesystem.
189#
1a4d82fc 190# General rust binaries may still live in the host bin directory; they
223e47cc
LB
191# will just link against the libraries in the target lib directory.
192#
193# Admittedly this is a little convoluted.
223e47cc 194#
9346a6ac
AL
195# If you find yourself working on the make infrastructure itself, and trying to
196# find the value of a given variable after expansion, you can use:
197#
198# make print-VARIABLE_NAME
199#
200# To extract it
201#
1a4d82fc
JJ
202# </nitty-gritty>
203#
223e47cc
LB
204
205######################################################################
1a4d82fc 206# Primary rules
223e47cc
LB
207######################################################################
208
1a4d82fc
JJ
209# Issue #9531: If you change the order of any of the following (or add
210# new definitions), make sure definitions always precede their uses,
211# especially for the dependency lists of recipes.
223e47cc 212
1a4d82fc
JJ
213# First, load the variables exported by the configure script
214include config.mk
223e47cc 215
1a4d82fc
JJ
216# Just a few macros used everywhere
217include $(CFG_SRC_DIR)mk/util.mk
218# Reconfiguring when the makefiles or submodules change
219include $(CFG_SRC_DIR)mk/reconfig.mk
220# All crates and their dependencies
221include $(CFG_SRC_DIR)mk/crates.mk
222# Various bits of setup, common macros, and top-level rules
223include $(CFG_SRC_DIR)mk/main.mk
224# C and assembly components that are not LLVM
225include $(CFG_SRC_DIR)mk/rt.mk
226# Rules for crates in the target directories
223e47cc 227include $(CFG_SRC_DIR)mk/target.mk
1a4d82fc 228# Rules for crates in the host directories
223e47cc 229include $(CFG_SRC_DIR)mk/host.mk
1a4d82fc 230# Special rules for bootstrapping stage0
223e47cc 231include $(CFG_SRC_DIR)mk/stage0.mk
1a4d82fc 232# Rust-specific LLVM extensions
223e47cc 233include $(CFG_SRC_DIR)mk/rustllvm.mk
1a4d82fc 234# Documentation
223e47cc 235include $(CFG_SRC_DIR)mk/docs.mk
1a4d82fc 236# LLVM
223e47cc 237include $(CFG_SRC_DIR)mk/llvm.mk
1a4d82fc
JJ
238# Rules for installing debugger scripts
239include $(CFG_SRC_DIR)mk/debuggers.mk
223e47cc
LB
240
241######################################################################
242# Secondary makefiles, conditionalized for speed
243######################################################################
244
1a4d82fc 245# The test suite
223e47cc
LB
246ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
247 $(findstring test,$(MAKECMDGOALS)) \
223e47cc
LB
248 $(findstring tidy,$(MAKECMDGOALS))),)
249 CFG_INFO := $(info cfg: including test rules)
250 include $(CFG_SRC_DIR)mk/tests.mk
1a4d82fc 251 include $(CFG_SRC_DIR)mk/grammar.mk
223e47cc
LB
252endif
253
1a4d82fc
JJ
254# Copy all the distributables to another directory for binary install
255ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
256 $(findstring dist,$(MAKECMDGOALS)) \
257 $(findstring install,$(MAKECMDGOALS))),)
258 CFG_INFO := $(info cfg: including prepare rules)
259 include $(CFG_SRC_DIR)mk/prepare.mk
223e47cc
LB
260endif
261
1a4d82fc
JJ
262# Source and binary distribution artifacts
263ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
264 $(findstring install,$(MAKECMDGOALS)) \
265 $(findstring clean,$(MAKECMDGOALS))),)
266 CFG_INFO := $(info cfg: including dist rules)
267 include $(CFG_SRC_DIR)mk/dist.mk
268endif
223e47cc 269
1a4d82fc
JJ
270# (Unix) Installation from the build directory
271ifneq ($(findstring install,$(MAKECMDGOALS)),)
223e47cc
LB
272 CFG_INFO := $(info cfg: including install rules)
273 include $(CFG_SRC_DIR)mk/install.mk
274endif
275
1a4d82fc
JJ
276# Cleaning
277ifneq ($(findstring clean,$(MAKECMDGOALS)),)
278 CFG_INFO := $(info cfg: including clean rules)
279 include $(CFG_SRC_DIR)mk/clean.mk
280endif
281
282# CTAGS building
223e47cc 283ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
3157f602
XL
284 $(findstring TAGS.vi,$(MAKECMDGOALS)) \
285 $(findstring TAGS.rustc.emacs,$(MAKECMDGOALS)) \
286 $(findstring TAGS.rustc.vi,$(MAKECMDGOALS))),)
223e47cc
LB
287 CFG_INFO := $(info cfg: including ctags rules)
288 include $(CFG_SRC_DIR)mk/ctags.mk
289endif
a7813a04
XL
290
291.DEFAULT:
3157f602
XL
292 @echo
293 @echo "======================================================"
a7813a04 294 @echo "== If you need help, run 'make help' or 'make tips' =="
3157f602
XL
295 @echo "======================================================"
296 @echo
a7813a04 297 exit 1