]> git.lizzy.rs Git - rust.git/blob - Makefile.in
auto merge of #12284 : brson/rust/install, r=alexcrichton
[rust.git] / Makefile.in
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
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 #
20 # First, start with one of these build targets:
21 #
22 #   * all - The default. Builds a complete, bootstrapped compiler.
23 #           `rustc` will be in `${target-triple}/stage2/bin/`. Run it
24 #           directly from the build directory if you like. This also
25 #           comes with docs in `doc/`.
26 #
27 #   * check - Run the complete test suite
28 #
29 #   * install - Install Rust. Note that installation is not necessary
30 #               to use the compiler.
31 #
32 #   * uninstall - Uninstall the binaries
33 #
34 # For tips on working with The Rust Build System, just:
35 #
36 #     run `make tips`
37 #
38 # Otherwise
39 #
40 #     run `make`
41 #
42 # </help>
43 #
44 # <tips>
45 #
46 # # The Rust Build System Tip Line
47 #
48 # There are a bazillion different targets you might want to build. Here
49 # are a few ideas.
50 #
51 #   * docs - Build gobs of HTML documentation and put it into `doc/`
52 #   * check-$(crate) - Test a crate, e.g. `check-std`
53 #   * check-ref - Run the language reference tests
54 #   * check-docs - Test the documentation examples
55 #   * check-stage$(stage)-$(crate) - Test a crate in a specific stage
56 #   * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/
57 #   * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests
58 #
59 # Then mix in some of these environment variables to harness the
60 # ultimate power of The Rust Build System.
61 #
62 #   * `VERBOSE=1` - Print all commands. Use this to see what's going on.
63 #   * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
64 #
65 #   * `TESTNAME=...` - Specify the name of tests to run
66 #   * `CHECK_IGNORED=1` - Run normally-ignored tests
67 #   * `NO_BENCH=1` - Don't run crate benchmarks (disable `--bench` flag)
68 #
69 #   * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
70 #   * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
71 #                            (may require `CFG_ENABLE_VALGRIND`)
72 #
73 #   * `NO_REBUILD=1` - Don't rebootstrap when testing std
74 #                      (and possibly other crates)
75 #   * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files
76 #
77 #   * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
78 #   * `ASM_COMMENTS=1` - Use `-Z asm-comments`
79 #   * `TIME_PASSES=1` - Use `-Z time-passes`
80 #   * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
81 #   * `TRACE=1` - Use `-Z trace`
82 #
83 # # Rust recipes for build system success
84 #
85 #     // Modifying libstd? Use this comment to run unit tests just on your change
86 #     make check-stage1-std NO_REBUILD=1 NO_BENCH=1
87 #
88 #     // Added a run-pass test? Use this to test running your test
89 #     make check-stage1-rpass TESTNAME=my-shiny-new-test
90 #
91 #     // Having trouble figuring out which test is failing? Turn off parallel tests
92 #     make check-stage1-std RUST_TEST_TASKS=1
93 #
94 # This is hardly all there is to know of The Rust Build System's
95 # mysteries. The tale continues on the wiki[1][2].
96 #
97 # [1]: https://github.com/mozilla/rust/wiki/Note-build-system
98 # [2]: https://github.com/mozilla/rust/wiki/Note-testsuite
99 #
100 # If you really feel like getting your hands dirty, then:
101 #
102 #     run `make nitty-gritty`
103 #
104 # </tips>
105 #
106 # <nittygritty>
107 #
108 # # The Rust Build System
109 #
110 # Gosh I wish there was something useful here (TODO).
111 #
112 # # An (old) explanation of how the build is structured:
113 #
114 # *Note: Hey, like, this is probably inaccurate, and is definitely
115 # an outdated and insufficient explanation of the remarkable
116 # Rust Build System.*
117 #
118 # There are multiple build stages (0-3) needed to verify that the
119 # compiler is properly self-hosting. Each stage is divided between
120 # 'host' artifacts and 'target' artifacts, where the stageN host
121 # compiler builds artifacts for 1 or more stageN target architectures.
122 # Once the stageN target compiler has been built for the host
123 # architecture it is promoted (copied) to a stageN+1 host artifact.
124 #
125 # The stage3 host compiler is a compiler that successfully builds
126 # itself and should (in theory) be bitwise identical to the stage2
127 # host compiler. The process is bootstrapped using a stage0 host
128 # compiler downloaded from a previous snapshot.
129 #
130 # At no time should stageN artifacts be interacting with artifacts
131 # from other stages. For consistency, we use the 'promotion' logic
132 # for all artifacts, even those that don't make sense on non-host
133 # architectures.
134 #
135 # The directory layout for a stage is intended to match the layout
136 # of the installed compiler, and looks like the following:
137 #
138 # stageN - this is the system root, corresponding to, e.g. /usr
139 #   bin - binaries compiled for the host
140 #   lib - libraries used by the host compiler
141 #     rustlib - rustc's own place to organize libraries
142 #       $(target) - target-specific artifacts
143 #         bin - binaries for target architectures
144 #         lib - libraries for target architectures
145 #
146 # A note about host libraries:
147 #
148 # The only libraries that get promoted to stageN/lib are those needed
149 # by rustc. In general, rust programs, even those compiled for the
150 # host architecture will use libraries from the target
151 # directories. This gives rust some freedom to experiment with how
152 # libraries are managed and versioned without polluting the common
153 # areas of the filesystem.
154 #
155 # General rust binaries may stil live in the host bin directory; they
156 # will just link against the libraries in the target lib directory.
157 #
158 # Admittedly this is a little convoluted.
159 #
160 # </nittygritty>
161 #
162
163 ######################################################################
164 # Primary rules
165 ######################################################################
166
167 # Issue #9531: If you change the order of any of the following (or add
168 # new definitions), make sure definitions always precede their uses,
169 # especially for the dependency lists of recipes.
170
171 # First, load the variables exported by the configure script
172 include config.mk
173
174 # Just a few macros used everywhere
175 include $(CFG_SRC_DIR)mk/util.mk
176 # All crates and their dependencies
177 include $(CFG_SRC_DIR)mk/crates.mk
178 # Reconfiguring when the makefiles or submodules change
179 include $(CFG_SRC_DIR)mk/reconfig.mk
180 # Various bits of setup, common macros, and top-level rules
181 include $(CFG_SRC_DIR)mk/main.mk
182 # C and assembly components that are not LLVM
183 include $(CFG_SRC_DIR)mk/rt.mk
184 # Rules for crates in the target directories
185 include $(CFG_SRC_DIR)mk/target.mk
186 # Rules for crates in the host directories
187 include $(CFG_SRC_DIR)mk/host.mk
188 # Special rules for bootstrapping stage0
189 include $(CFG_SRC_DIR)mk/stage0.mk
190 # Rust-specific LLVM extensions
191 include $(CFG_SRC_DIR)mk/rustllvm.mk
192 # Documentation
193 include $(CFG_SRC_DIR)mk/docs.mk
194 # LLVM
195 include $(CFG_SRC_DIR)mk/llvm.mk
196
197 ######################################################################
198 # Secondary makefiles, conditionalized for speed
199 ######################################################################
200
201 # Binary snapshots
202 ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))   \
203                $(findstring clean,$(MAKECMDGOALS))),)
204   CFG_INFO := $(info cfg: including snap rules)
205   include $(CFG_SRC_DIR)mk/snap.mk
206 endif
207
208 # The test suite
209 ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
210                $(findstring test,$(MAKECMDGOALS))  \
211                $(findstring perf,$(MAKECMDGOALS))  \
212                $(findstring tidy,$(MAKECMDGOALS))),)
213   CFG_INFO := $(info cfg: including test rules)
214   include $(CFG_SRC_DIR)mk/tests.mk
215 endif
216
217 # Performance and benchmarking
218 ifneq ($(findstring perf,$(MAKECMDGOALS)),)
219   CFG_INFO := $(info cfg: including perf rules)
220   include $(CFG_SRC_DIR)mk/perf.mk
221 endif
222
223 # Copy all the distributables to another directory for binary install
224 ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
225                $(findstring dist,$(MAKECMDGOALS)) \
226                $(findstring install,$(MAKECMDGOALS))),)
227   CFG_INFO := $(info cfg: including prepare rules)
228   include $(CFG_SRC_DIR)mk/prepare.mk
229 endif
230
231 # (Unix) Installation from the build directory
232 ifneq ($(findstring install,$(MAKECMDGOALS)),)
233   CFG_INFO := $(info cfg: including install rules)
234   include $(CFG_SRC_DIR)mk/install.mk
235 endif
236
237 # Source and binary distribution artifacts
238 ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
239                $(findstring clean,$(MAKECMDGOALS))),)
240   CFG_INFO := $(info cfg: including dist rules)
241   include $(CFG_SRC_DIR)mk/dist.mk
242 endif
243
244 # Cleaning
245 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
246   CFG_INFO := $(info cfg: including clean rules)
247   include $(CFG_SRC_DIR)mk/clean.mk
248 endif
249
250 # CTAGS building
251 ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
252                $(findstring TAGS.vi,$(MAKECMDGOALS))),)
253   CFG_INFO := $(info cfg: including ctags rules)
254   include $(CFG_SRC_DIR)mk/ctags.mk
255 endif
256
257 # Find all of the .d files and include them to add information about
258 # header file dependencies.
259 ALL_DEP_FILES := $(ALL_OBJ_FILES:%.o=%.d)
260 -include $(ALL_DEP_FILES)