]> git.lizzy.rs Git - rust.git/blob - Makefile.in
auto merge of #12181 : sanxiyn/rust/accurate-span-4, 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 # An explanation of how the build is structured:
12 #
13 # There are multiple build stages (0-3) needed to verify that the
14 # compiler is properly self-hosting. Each stage is divided between
15 # 'host' artifacts and 'target' artifacts, where the stageN host
16 # compiler builds artifacts for 1 or more stageN target architectures.
17 # Once the stageN target compiler has been built for the host
18 # architecture it is promoted (copied) to a stageN+1 host artifact.
19 #
20 # The stage3 host compiler is a compiler that successfully builds
21 # itself and should (in theory) be bitwise identical to the stage2
22 # host compiler. The process is bootstrapped using a stage0 host
23 # compiler downloaded from a previous snapshot.
24 #
25 # At no time should stageN artifacts be interacting with artifacts
26 # from other stages. For consistency, we use the 'promotion' logic
27 # for all artifacts, even those that don't make sense on non-host
28 # architectures.
29 #
30 # The directory layout for a stage is intended to match the layout
31 # of the installed compiler, and looks like the following:
32 #
33 # stageN - this is the system root, corresponding to, e.g. /usr
34 #   bin - binaries compiled for the host
35 #   lib - libraries used by the host compiler
36 #     rustlib - rustc's own place to organize libraries
37 #       $(target) - target-specific artifacts
38 #         bin - binaries for target architectures
39 #         lib - libraries for target architectures
40 #
41 # A note about host libraries:
42 #
43 # The only libraries that get promoted to stageN/lib are those needed
44 # by rustc. In general, rust programs, even those compiled for the
45 # host architecture will use libraries from the target
46 # directories. This gives rust some freedom to experiment with how
47 # libraries are managed and versioned without polluting the common
48 # areas of the filesystem.
49 #
50 # General rust binaries may stil live in the host bin directory; they
51 # will just link against the libraries in the target lib directory.
52 #
53 # Admittedly this is a little convoluted.
54
55 STAGES = 0 1 2 3
56
57 ######################################################################
58 # Residual auto-configuration
59 ######################################################################
60
61 # Recursive wildcard function
62 # http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
63 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
64   $(filter $(subst *,%,$2),$d))
65
66 include config.mk
67
68 # We track all of the object files we might build so that we can find
69 # and include all of the .d files in one fell swoop.
70 ALL_OBJ_FILES :=
71
72 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
73 NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
74 NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
75
76 ifneq ($(MAKE_RESTARTS),)
77 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
78 endif
79
80 CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
81 CFG_INFO := $(info cfg: host triples $(CFG_HOST))
82 CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
83
84 ifneq ($(wildcard $(NON_BUILD_HOST)),)
85 CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
86 endif
87 ifneq ($(wildcard $(NON_BUILD_TARGET)),)
88 CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
89 endif
90
91 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
92 CFG_GCCISH_CFLAGS :=
93 CFG_GCCISH_LINK_FLAGS :=
94
95 ifdef CFG_DISABLE_OPTIMIZE
96   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
97   CFG_RUSTC_FLAGS +=
98 else
99   # The rtopt cfg turns off runtime sanity checks
100   CFG_RUSTC_FLAGS += -O --cfg rtopt
101 endif
102
103 ifdef CFG_DISABLE_DEBUG
104   CFG_RUSTC_FLAGS += --cfg ndebug
105   CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
106 else
107   $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
108   CFG_RUSTC_FLAGS += --cfg debug
109   CFG_GCCISH_CFLAGS += -DRUST_DEBUG
110 endif
111
112 ifdef SAVE_TEMPS
113   CFG_RUSTC_FLAGS += --save-temps
114 endif
115 ifdef ASM_COMMENTS
116   CFG_RUSTC_FLAGS += -Z asm-comments
117 endif
118 ifdef TIME_PASSES
119   CFG_RUSTC_FLAGS += -Z time-passes
120 endif
121 ifdef TIME_LLVM_PASSES
122   CFG_RUSTC_FLAGS += -Z time-llvm-passes
123 endif
124 ifdef TRACE
125   CFG_RUSTC_FLAGS += -Z trace
126 endif
127 ifdef CFG_DISABLE_RPATH
128 # NOTE: make this CFG_RUSTC_FLAGS after stage0 snapshot
129 RUSTFLAGS_STAGE1 += -C no-rpath
130 RUSTFLAGS_STAGE2 += -C no-rpath
131 RUSTFLAGS_STAGE3 += -C no-rpath
132 endif
133
134 # The executables crated during this compilation process have no need to include
135 # static copies of libstd and libextra. We also generate dynamic versions of all
136 # libraries, so in the interest of space, prefer dynamic linking throughout the
137 # compilation process.
138 #
139 # Note though that these flags are omitted for stage2+. This means that the
140 # snapshot will be generated with a statically linked rustc so we only have to
141 # worry about the distribution of one file (with its native dynamic
142 # dependencies)
143 #
144 # NOTE: after a snapshot (stage0), put this on stage0 as well
145 RUSTFLAGS_STAGE1 += -C prefer-dynamic
146
147 # platform-specific auto-configuration
148 include $(CFG_SRC_DIR)mk/platform.mk
149
150 # Run the stage1/2 compilers under valgrind
151 ifdef VALGRIND_COMPILE
152   CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
153 else
154   CFG_VALGRIND_COMPILE :=
155 endif
156
157 # version-string calculation
158 CFG_GIT_DIR := $(CFG_SRC_DIR).git
159 CFG_RELEASE = 0.10-pre
160 CFG_VERSION = $(CFG_RELEASE)
161 # windows exe's need numeric versions - don't use anything but
162 # numbers and dots here
163 CFG_VERSION_WIN = 0.10
164
165 # since $(CFG_GIT) may contain spaces (especially on Windows),
166 # we need to escape them. (" " to r"\ ")
167 # Note that $(subst ...) ignores space after `subst`,
168 # so we use a hack: define $(SPACE) which contains space character.
169 SPACE :=
170 SPACE +=
171 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
172 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
173     CFG_VERSION += $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 \
174                      --pretty=format:'(%h %ci)')
175     CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
176 endif
177 endif
178
179 ifdef CFG_ENABLE_VALGRIND
180   $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
181 else
182   CFG_VALGRIND :=
183 endif
184 ifdef CFG_BAD_VALGRIND
185   $(info cfg: disabling valgrind due to its unreliability on this platform)
186   CFG_VALGRIND :=
187 endif
188
189
190 ######################################################################
191 # Target-and-rule "utility variables"
192 ######################################################################
193
194 ifdef VERBOSE
195   Q :=
196   E =
197 else
198   Q := @
199   E = echo $(1)
200 endif
201
202 S := $(CFG_SRC_DIR)
203
204 define DEF_X
205 X_$(1) := $(CFG_EXE_SUFFIX_$(1))
206 endef
207 $(foreach target,$(CFG_TARGET),\
208   $(eval $(call DEF_X,$(target))))
209
210 # "Source" files we generate in builddir along the way.
211 GENERATED :=
212
213 # Delete the built-in rules.
214 .SUFFIXES:
215 %:: %,v
216 %:: RCS/%,v
217 %:: RCS/%
218 %:: s.%
219 %:: SCCS/s.%
220
221
222 ######################################################################
223 # Cleaning out old crates
224 ######################################################################
225
226 # $(1) is the path for directory to match against
227 # $(2) is the glob to use in the match
228 #
229 # Note that a common bug is to accidentally construct the glob denoted
230 # by $(2) with a space character prefix, which invalidates the
231 # construction $(1)$(2).
232 define CHECK_FOR_OLD_GLOB_MATCHES
233   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
234 endef
235
236 # Same interface as above, but deletes rather than just listing the files.
237 ifdef VERBOSE
238 define REMOVE_ALL_OLD_GLOB_MATCHES
239   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
240 endef
241 else
242 define REMOVE_ALL_OLD_GLOB_MATCHES
243   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
244 endef
245 endif
246
247 # We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
248 # than in the macros above because it needs the result of running the
249 # `ls` command after other rules in the command list have run; the
250 # macro-expander for $(wildcard ...) would deliver its results too
251 # soon. (This is in contrast to the macros above, which are meant to
252 # be run at the outset of a command list in a rule.)
253 ifdef VERBOSE
254 define LIST_ALL_OLD_GLOB_MATCHES
255   @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
256   @( ls $(1) 2>/dev/null || true )
257 endef
258 else
259 define LIST_ALL_OLD_GLOB_MATCHES
260 endef
261 endif
262
263 ######################################################################
264 # LLVM macros
265 ######################################################################
266
267 # FIXME: x86-ism
268 LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
269                 interpreter instrumentation
270
271 # Only build these LLVM tools
272 LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
273
274 define DEF_LLVM_VARS
275 # The configure script defines these variables with the target triples
276 # separated by Z. This defines new ones with the expected format.
277 CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
278 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
279
280 # Any rules that depend on LLVM should depend on LLVM_CONFIG
281 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
282 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
283 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
284 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
285 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
286 LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
287 LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
288 LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
289 # On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
290 # so we replace -I with -iquote to ensure that it searches bundled LLVM first.
291 LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
292 LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
293
294 LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
295 LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
296
297 endef
298
299 $(foreach host,$(CFG_HOST), \
300  $(eval $(call DEF_LLVM_VARS,$(host))))
301
302 ######################################################################
303 # Exports for sub-utilities
304 ######################################################################
305
306 # Note that any variable that re-configure should pick up needs to be
307 # exported
308
309 export CFG_SRC_DIR
310 export CFG_BUILD_DIR
311 export CFG_VERSION
312 export CFG_VERSION_WIN
313 export CFG_RELEASE
314 export CFG_BUILD
315 export CFG_LLVM_ROOT
316 export CFG_ENABLE_MINGW_CROSS
317 export CFG_PREFIX
318 export CFG_LIBDIR
319 export CFG_RUSTLIBDIR
320 export CFG_LIBDIR_RELATIVE
321 export CFG_DISABLE_INJECT_STD_VERSION
322
323 ######################################################################
324 # Per-stage targets and runner
325 ######################################################################
326
327 include $(CFG_SRC_DIR)mk/crates.mk
328
329 define SREQ
330 # $(1) is the stage number
331 # $(2) is the target triple
332 # $(3) is the host triple
333
334 # Destinations of artifacts for the host compiler
335 HROOT$(1)_H_$(3) = $(3)/stage$(1)
336 HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
337 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
338
339 # Destinations of artifacts for target architectures
340 TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
341 TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
342 TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
343
344 # Preqrequisites for using the stageN compiler
345 ifeq ($(1),0)
346 HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
347 else
348 HSREQ$(1)_H_$(3) = \
349         $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
350         $$(HLIB$(1)_H_$(3))/stamp.rustc \
351         $$(foreach dep,$$(RUST_DEPS_rustc),$$(HLIB$(1)_H_$(3))/stamp.$$(dep)) \
352         $$(MKFILE_DEPS)
353 endif
354
355 # Prerequisites for using the stageN compiler to build target artifacts
356 TSREQ$(1)_T_$(2)_H_$(3) = \
357         $$(HSREQ$(1)_H_$(3)) \
358         $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
359
360 # Prerequisites for a working stageN compiler and libraries, for a specific
361 # target
362 SREQ$(1)_T_$(2)_H_$(3) = \
363         $$(TSREQ$(1)_T_$(2)_H_$(3)) \
364         $$(foreach dep,$$(TARGET_CRATES),\
365             $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
366
367 # Prerequisites for a working stageN compiler and complete set of target
368 # libraries
369 CSREQ$(1)_T_$(2)_H_$(3) = \
370         $$(TSREQ$(1)_T_$(2)_H_$(3)) \
371         $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
372         $$(foreach dep,$$(CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
373         $$(foreach dep,$$(HOST_CRATES),$$(HLIB$(1)_H_$(3))/stamp.$$(dep))
374
375 ifeq ($(1),0)
376 # Don't run the the stage0 compiler under valgrind - that ship has sailed
377 CFG_VALGRIND_COMPILE$(1) =
378 else
379 CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
380 endif
381
382 # Add RUSTFLAGS_STAGEN values to the build command
383 EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
384
385 CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
386
387 # Pass --cfg stage0 only for the build->host part of stage0;
388 # if you're building a cross config, the host->* parts are
389 # effectively stage1, since it uses the just-built stage0.
390 ifeq ($(1),0)
391 ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
392 CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
393 endif
394 endif
395
396 ifdef CFG_DISABLE_RPATH
397 ifeq ($$(OSTYPE_$(3)),apple-darwin)
398   RPATH_VAR$(1)_T_$(2)_H_$(3) := \
399       DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
400 else
401   RPATH_VAR$(1)_T_$(2)_H_$(3) := \
402       LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
403 endif
404 else
405     RPATH_VAR$(1)_T_$(2)_H_$(3) :=
406 endif
407
408 STAGE$(1)_T_$(2)_H_$(3) :=                                              \
409         $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3))                            \
410                 $$(call CFG_RUN_TARG_$(3),$(1),                         \
411                 $$(CFG_VALGRIND_COMPILE$(1))                            \
412                 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                     \
413                 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3))                     \
414                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
415                 $$(RUSTC_FLAGS_$(2))
416
417 PERF_STAGE$(1)_T_$(2)_H_$(3) :=                                         \
418         $$(Q)$$(call CFG_RUN_TARG_$(3),$(1),                            \
419                 $$(CFG_PERF_TOOL)                                       \
420                 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                     \
421                 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3))                     \
422                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
423                 $$(RUSTC_FLAGS_$(2))
424
425 endef
426
427 $(foreach build,$(CFG_HOST), \
428  $(eval $(foreach target,$(CFG_TARGET), \
429   $(eval $(foreach stage,$(STAGES), \
430    $(eval $(call SREQ,$(stage),$(target),$(build))))))))
431
432 ######################################################################
433 # rustc-H-targets
434 #
435 # Builds a functional Rustc for the given host.
436 ######################################################################
437
438 define DEF_RUSTC_STAGE_TARGET
439 # $(1) == architecture
440 # $(2) == stage
441
442 rustc-stage$(2)-H-$(1):                                                 \
443         $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
444
445 endef
446
447 $(foreach host,$(CFG_HOST),                                             \
448  $(eval $(foreach stage,1 2 3,                                          \
449   $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
450
451 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
452 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
453 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
454
455 define DEF_RUSTC_TARGET
456 # $(1) == architecture
457
458 rustc-H-$(1): rustc-stage2-H-$(1)
459 endef
460
461 $(foreach host,$(CFG_TARGET),                   \
462  $(eval $(call DEF_RUSTC_TARGET,$(host))))
463
464 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
465 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
466 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
467 rustc: rustc-H-$(CFG_BUILD)
468
469 rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
470
471 ######################################################################
472 # Entrypoint rule
473 ######################################################################
474
475 .DEFAULT_GOAL := all
476
477 ifneq ($(CFG_IN_TRANSITION),)
478
479 CFG_INFO := $(info cfg:)
480 CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***)
481 CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
482 CFG_INFO := $(info cfg:)
483
484 #FIXME This is surely busted
485 all: $(SREQ1$(CFG_BUILD)) $(GENERATED) docs
486
487 else
488
489 define ALL_TARGET_N
490 ifneq ($$(findstring $(1),$$(CFG_HOST)),)
491 # This is a host
492 all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
493 else
494 # This is a target only
495 all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
496 endif
497 endef
498
499 $(foreach target,$(CFG_TARGET), \
500  $(foreach host,$(CFG_HOST), \
501  $(eval $(call ALL_TARGET_N,$(target),$(host)))))
502
503 ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
504         $(foreach host,$(CFG_HOST), \
505  all-target-$(target)-host-$(host)))
506
507 all: $(ALL_TARGET_RULES) $(GENERATED) docs
508
509 endif
510
511
512 ######################################################################
513 # Re-configuration
514 ######################################################################
515
516 ifndef CFG_DISABLE_MANAGE_SUBMODULES
517 # This is a pretty expensive operation but I don't see any way to avoid it
518 NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && "$(CFG_GIT)" submodule status | grep -c '^\(+\|-\)')
519 else
520 NEED_GIT_RECONFIG=0
521 endif
522
523 ifeq ($(NEED_GIT_RECONFIG),0)
524 else
525 # If the submodules have changed then always execute config.mk
526 .PHONY: config.stamp
527 endif
528
529 Makefile config.mk: config.stamp
530
531 config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
532         @$(call E, cfg: reconfiguring)
533         $(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
534
535
536 ######################################################################
537 # Primary-target makefiles
538 ######################################################################
539
540 # Issue #9531: If you change the order of any of the following (or add
541 # new definitions), make sure definitions always precede their uses,
542 # especially for the dependency lists of recipes.
543
544 include $(CFG_SRC_DIR)mk/rt.mk
545 include $(CFG_SRC_DIR)mk/target.mk
546 include $(CFG_SRC_DIR)mk/host.mk
547 include $(CFG_SRC_DIR)mk/stage0.mk
548 include $(CFG_SRC_DIR)mk/rustllvm.mk
549 include $(CFG_SRC_DIR)mk/docs.mk
550 include $(CFG_SRC_DIR)mk/llvm.mk
551
552 ######################################################################
553 # Secondary makefiles, conditionalized for speed
554 ######################################################################
555
556 ifneq ($(strip $(findstring dist,$(MAKECMDGOALS))   \
557                $(findstring check,$(MAKECMDGOALS))  \
558                $(findstring test,$(MAKECMDGOALS))   \
559                $(findstring tidy,$(MAKECMDGOALS))   \
560                $(findstring clean,$(MAKECMDGOALS))),)
561   CFG_INFO := $(info cfg: including dist rules)
562   include $(CFG_SRC_DIR)mk/dist.mk
563 endif
564
565 ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))   \
566                $(findstring clean,$(MAKECMDGOALS))),)
567   CFG_INFO := $(info cfg: including snap rules)
568   include $(CFG_SRC_DIR)mk/snap.mk
569 endif
570
571 ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
572                $(findstring test,$(MAKECMDGOALS))  \
573                $(findstring perf,$(MAKECMDGOALS))  \
574                $(findstring tidy,$(MAKECMDGOALS))),)
575   CFG_INFO := $(info cfg: including test rules)
576   include $(CFG_SRC_DIR)mk/tests.mk
577 endif
578
579 ifneq ($(findstring perf,$(MAKECMDGOALS)),)
580   CFG_INFO := $(info cfg: including perf rules)
581   include $(CFG_SRC_DIR)mk/perf.mk
582 endif
583
584 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
585   CFG_INFO := $(info cfg: including clean rules)
586   include $(CFG_SRC_DIR)mk/clean.mk
587 endif
588
589 ifneq ($(findstring install,$(MAKECMDGOALS)),)
590   CFG_INFO := $(info cfg: including install rules)
591   include $(CFG_SRC_DIR)mk/install.mk
592 endif
593
594 ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
595                $(findstring TAGS.vi,$(MAKECMDGOALS))),)
596   CFG_INFO := $(info cfg: including ctags rules)
597   include $(CFG_SRC_DIR)mk/ctags.mk
598 endif
599
600 # Find all of the .d files and include them to add information about
601 # header file dependencies.
602 ALL_DEP_FILES := $(ALL_OBJ_FILES:%.o=%.d)
603 -include $(ALL_DEP_FILES)