]> git.lizzy.rs Git - rust.git/blob - Makefile.in
mk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes
[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>
12 #
13 # # The Rust Build System
14 #
15 # Start with these these build targets:
16 #
17 # * all - The default rule. Builds a complete stage2 compiler, std,
18 #           and extra for all hosts and targets
19 # * docs - Generate HTML documentation for the std and extra libraries
20 #            from source code comments
21 # * rustc - The stage 2 compiler for the build platform with standard
22 #             and extra libraries
23 # * install
24 # * uninstall
25 # * check - Run tests
26 # * check-stage1-$(crate) - Run tests for a crate, e.g. `check-stage1-std`
27 # * check-stage1-rpass - Run the language tests
28 # * check-docs - Run the doc tests
29 #
30 # Then mix in some of these environment variables to harness the
31 # ultimate power of Rust Build System.
32 #
33 # * `VERBOSE=1` - Print all commands. Use this to see what's going on.
34 # * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
35 # * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
36 # * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
37 #                          (may require `CFG_ENABLE_VALGRIND`)
38 # * `NO_REBUILD=1` - Don't rebootstrap when testing std
39 #                    (and possibly other crates)
40 # * `NO_MKFILE_DEPS=1` - Don rebuild for modified .mk files
41 # * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
42 # * `ASM_COMMENTS=1` - Use `-Z asm-comments`
43 # * `TIME_PASSES=1` - Use `-Z time-passes`
44 # * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
45 # * `TRACE=1` - Use `-Z trace`
46 #
47 # This is hardly all there is to know of The Rust Build System's
48 # mysteries. Your journey continues on the wiki[1][2].
49 #
50 # [1]: https://github.com/mozilla/rust/wiki/Note-build-system
51 # [2]: https://github.com/mozilla/rust/wiki/Note-testsuite
52 #
53 # </help>
54 #
55 # # An (old) explanation of how the build is structured:
56 #
57 # *Note: Hey, like, this is probably inaccurate, and is definitely
58 # an outdated and insufficient explanation of the remarkable
59 # and discomfiting Rust Build System.*
60 #
61 # There are multiple build stages (0-3) needed to verify that the
62 # compiler is properly self-hosting. Each stage is divided between
63 # 'host' artifacts and 'target' artifacts, where the stageN host
64 # compiler builds artifacts for 1 or more stageN target architectures.
65 # Once the stageN target compiler has been built for the host
66 # architecture it is promoted (copied) to a stageN+1 host artifact.
67 #
68 # The stage3 host compiler is a compiler that successfully builds
69 # itself and should (in theory) be bitwise identical to the stage2
70 # host compiler. The process is bootstrapped using a stage0 host
71 # compiler downloaded from a previous snapshot.
72 #
73 # At no time should stageN artifacts be interacting with artifacts
74 # from other stages. For consistency, we use the 'promotion' logic
75 # for all artifacts, even those that don't make sense on non-host
76 # architectures.
77 #
78 # The directory layout for a stage is intended to match the layout
79 # of the installed compiler, and looks like the following:
80 #
81 # stageN - this is the system root, corresponding to, e.g. /usr
82 #   bin - binaries compiled for the host
83 #   lib - libraries used by the host compiler
84 #     rustlib - rustc's own place to organize libraries
85 #       $(target) - target-specific artifacts
86 #         bin - binaries for target architectures
87 #         lib - libraries for target architectures
88 #
89 # A note about host libraries:
90 #
91 # The only libraries that get promoted to stageN/lib are those needed
92 # by rustc. In general, rust programs, even those compiled for the
93 # host architecture will use libraries from the target
94 # directories. This gives rust some freedom to experiment with how
95 # libraries are managed and versioned without polluting the common
96 # areas of the filesystem.
97 #
98 # General rust binaries may stil live in the host bin directory; they
99 # will just link against the libraries in the target lib directory.
100 #
101 # Admittedly this is a little convoluted.
102
103 ######################################################################
104 # Primary rules
105 ######################################################################
106
107 # Issue #9531: If you change the order of any of the following (or add
108 # new definitions), make sure definitions always precede their uses,
109 # especially for the dependency lists of recipes.
110
111 # First, load the variables exported by the configure script
112 include config.mk
113
114 # Just a few macros used everywhere
115 include $(CFG_SRC_DIR)mk/util.mk
116 # All crates and their dependencies
117 include $(CFG_SRC_DIR)mk/crates.mk
118 # Reconfiguring when the makefiles or submodules change
119 include $(CFG_SRC_DIR)mk/reconfig.mk
120 # Various bits of setup, common macros, and top-level rules
121 include $(CFG_SRC_DIR)mk/main.mk
122 # C and assembly components that are not LLVM
123 include $(CFG_SRC_DIR)mk/rt.mk
124 # Rules for crates in the target directories
125 include $(CFG_SRC_DIR)mk/target.mk
126 # Rules for crates in the host directories
127 include $(CFG_SRC_DIR)mk/host.mk
128 # Special rules for bootstrapping stage0
129 include $(CFG_SRC_DIR)mk/stage0.mk
130 # Rust-specific LLVM extensions
131 include $(CFG_SRC_DIR)mk/rustllvm.mk
132 # Documentation
133 include $(CFG_SRC_DIR)mk/docs.mk
134 # LLVM
135 include $(CFG_SRC_DIR)mk/llvm.mk
136
137 ######################################################################
138 # Secondary makefiles, conditionalized for speed
139 ######################################################################
140
141 # Source and binary distribution artifacts
142 ifneq ($(strip $(findstring dist,$(MAKECMDGOALS))   \
143                $(findstring check,$(MAKECMDGOALS))  \
144                $(findstring test,$(MAKECMDGOALS))   \
145                $(findstring tidy,$(MAKECMDGOALS))   \
146                $(findstring clean,$(MAKECMDGOALS))),)
147   CFG_INFO := $(info cfg: including dist rules)
148   include $(CFG_SRC_DIR)mk/dist.mk
149 endif
150
151 # Binary snapshots
152 ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))   \
153                $(findstring clean,$(MAKECMDGOALS))),)
154   CFG_INFO := $(info cfg: including snap rules)
155   include $(CFG_SRC_DIR)mk/snap.mk
156 endif
157
158 # The test suite
159 ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
160                $(findstring test,$(MAKECMDGOALS))  \
161                $(findstring perf,$(MAKECMDGOALS))  \
162                $(findstring tidy,$(MAKECMDGOALS))),)
163   CFG_INFO := $(info cfg: including test rules)
164   include $(CFG_SRC_DIR)mk/tests.mk
165 endif
166
167 # Performance and benchmarking
168 ifneq ($(findstring perf,$(MAKECMDGOALS)),)
169   CFG_INFO := $(info cfg: including perf rules)
170   include $(CFG_SRC_DIR)mk/perf.mk
171 endif
172
173 # Cleaning
174 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
175   CFG_INFO := $(info cfg: including clean rules)
176   include $(CFG_SRC_DIR)mk/clean.mk
177 endif
178
179 # Installation from the build directory
180 ifneq ($(findstring install,$(MAKECMDGOALS)),)
181   CFG_INFO := $(info cfg: including install rules)
182   include $(CFG_SRC_DIR)mk/install.mk
183 endif
184
185 # CTAGS building
186 ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
187                $(findstring TAGS.vi,$(MAKECMDGOALS))),)
188   CFG_INFO := $(info cfg: including ctags rules)
189   include $(CFG_SRC_DIR)mk/ctags.mk
190 endif
191
192 # Find all of the .d files and include them to add information about
193 # header file dependencies.
194 ALL_DEP_FILES := $(ALL_OBJ_FILES:%.o=%.d)
195 -include $(ALL_DEP_FILES)