1 # Copyright 2014-2015 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.
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.
11 ######################################################################
12 # Version numbers and strings
13 ######################################################################
18 # An optional number to put after the label, e.g. '.2' -> '-beta.2'
19 # NB Make sure it starts with a dot to conform to semver pre-release
20 # versions (section 9)
21 CFG_PRERELEASE_VERSION=
23 CFG_FILENAME_EXTRA=4e7c5e5c
25 ifeq ($(CFG_RELEASE_CHANNEL),stable)
26 # This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
27 CFG_RELEASE=$(CFG_RELEASE_NUM)
28 # This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
29 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
30 CFG_DISABLE_UNSTABLE_FEATURES=1
32 ifeq ($(CFG_RELEASE_CHANNEL),beta)
33 CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
34 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
35 CFG_DISABLE_UNSTABLE_FEATURES=1
37 ifeq ($(CFG_RELEASE_CHANNEL),nightly)
38 CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
39 # When building nightly distributables just reuse the same "nightly" name
40 # so when we upload we'll always override the previous nighly. This
41 # doesn't actually impact the version reported by rustc - it's just
43 CFG_PACKAGE_VERS=nightly
45 ifeq ($(CFG_RELEASE_CHANNEL),dev)
46 CFG_RELEASE=$(CFG_RELEASE_NUM)-dev
47 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev
50 # The name of the package to use for creating tarballs, installers etc.
51 CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
53 # The version string plus commit information - this is what rustc reports
54 CFG_VERSION = $(CFG_RELEASE)
55 CFG_GIT_DIR := $(CFG_SRC_DIR).git
56 # since $(CFG_GIT) may contain spaces (especially on Windows),
57 # we need to escape them. (" " to r"\ ")
58 # Note that $(subst ...) ignores space after `subst`,
59 # so we use a hack: define $(SPACE) which contains space character.
63 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
64 CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
65 CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
66 CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
67 CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
71 CFG_BUILD_DATE = $(shell date +%F)
72 CFG_VERSION += (built $(CFG_BUILD_DATE))
74 # Windows exe's need numeric versions - don't use anything but
75 # numbers and dots here
76 CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
78 CFG_INFO := $(info cfg: version $(CFG_VERSION))
80 ######################################################################
82 ######################################################################
84 # We track all of the object files we might build so that we can find
85 # and include all of the .d files in one fell swoop.
88 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
89 MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
90 ifneq ($(NO_MKFILE_DEPS),)
93 NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
94 NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
96 ifneq ($(MAKE_RESTARTS),)
97 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
100 CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
101 CFG_INFO := $(info cfg: host triples $(CFG_HOST))
102 CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
104 ifneq ($(wildcard $(NON_BUILD_HOST)),)
105 CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
107 ifneq ($(wildcard $(NON_BUILD_TARGET)),)
108 CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
111 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
113 CFG_GCCISH_LINK_FLAGS :=
115 # Turn off broken quarantine (see jemalloc/jemalloc#161)
116 CFG_JEMALLOC_FLAGS := --disable-fill
118 ifdef CFG_DISABLE_OPTIMIZE
119 $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
121 CFG_JEMALLOC_FLAGS += --enable-debug
123 # The rtopt cfg turns off runtime sanity checks
124 CFG_RUSTC_FLAGS += -O --cfg rtopt
127 CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
129 ifdef CFG_ENABLE_DEBUG_ASSERTIONS
130 $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG_ASSERTIONS))
131 CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on
133 CFG_RUSTC_FLAGS += --cfg ndebug
137 CFG_RUSTC_FLAGS += --save-temps
140 CFG_RUSTC_FLAGS += -Z asm-comments
143 CFG_RUSTC_FLAGS += -Z time-passes
145 ifdef TIME_LLVM_PASSES
146 CFG_RUSTC_FLAGS += -Z time-llvm-passes
149 CFG_RUSTC_FLAGS += -Z trace
151 ifdef CFG_ENABLE_RPATH
152 CFG_RUSTC_FLAGS += -C rpath
155 # The executables crated during this compilation process have no need to include
156 # static copies of libstd and libextra. We also generate dynamic versions of all
157 # libraries, so in the interest of space, prefer dynamic linking throughout the
158 # compilation process.
160 # Note though that these flags are omitted for the *bins* in stage2+. This means
161 # that the snapshot will be generated with a statically linked rustc so we only
162 # have to worry about the distribution of one file (with its native dynamic
164 RUSTFLAGS_STAGE0 += -C prefer-dynamic
165 RUSTFLAGS_STAGE1 += -C prefer-dynamic
166 RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
167 RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
169 # Landing pads require a lot of codegen. We can get through bootstrapping faster
170 # by not emitting them.
171 RUSTFLAGS_STAGE0 += -Z no-landing-pads
173 # platform-specific auto-configuration
174 include $(CFG_SRC_DIR)mk/platform.mk
176 # Run the stage1/2 compilers under valgrind
177 ifdef VALGRIND_COMPILE
178 CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
180 CFG_VALGRIND_COMPILE :=
184 ifndef CFG_DISABLE_VALGRIND_RPASS
185 $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS))
186 $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND))
187 CFG_VALGRIND_RPASS :=$(CFG_VALGRIND)
189 CFG_VALGRIND_RPASS :=
193 ifdef CFG_ENABLE_VALGRIND
194 $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
199 ######################################################################
200 # Target-and-rule "utility variables"
201 ######################################################################
203 define DEF_FOR_TARGET
204 X_$(1) := $(CFG_EXE_SUFFIX_$(1))
205 ifndef CFG_LLVM_TARGET_$(1)
206 CFG_LLVM_TARGET_$(1) := $(1)
209 $(foreach target,$(CFG_TARGET), \
210 $(eval $(call DEF_FOR_TARGET,$(target))))
212 # "Source" files we generate in builddir along the way.
215 # Delete the built-in rules.
224 ######################################################################
225 # Cleaning out old crates
226 ######################################################################
228 # $(1) is the path for directory to match against
229 # $(2) is the glob to use in the match
231 # Note that a common bug is to accidentally construct the glob denoted
232 # by $(2) with a space character prefix, which invalidates the
233 # construction $(1)$(2).
234 define CHECK_FOR_OLD_GLOB_MATCHES
235 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
238 # Same interface as above, but deletes rather than just listing the files.
240 define REMOVE_ALL_OLD_GLOB_MATCHES
241 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
244 define REMOVE_ALL_OLD_GLOB_MATCHES
245 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
249 # We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
250 # than in the macros above because it needs the result of running the
251 # `ls` command after other rules in the command list have run; the
252 # macro-expander for $(wildcard ...) would deliver its results too
253 # soon. (This is in contrast to the macros above, which are meant to
254 # be run at the outset of a command list in a rule.)
256 define LIST_ALL_OLD_GLOB_MATCHES
257 @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
258 @( ls $(1) 2>/dev/null || true )
261 define LIST_ALL_OLD_GLOB_MATCHES
265 ######################################################################
267 ######################################################################
270 LLVM_COMPONENTS=x86 arm aarch64 mips powerpc ipo bitreader bitwriter linker asmparser mcjit \
271 interpreter instrumentation
273 # Only build these LLVM tools
274 LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
277 # The configure script defines these variables with the target triples
278 # separated by Z. This defines new ones with the expected format.
279 ifeq ($$(CFG_LLVM_ROOT),)
280 CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
281 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
283 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT)
286 # Any rules that depend on LLVM should depend on LLVM_CONFIG
287 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
288 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
289 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
290 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
291 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
292 LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
293 LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
294 LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
295 LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
296 # On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
297 # so we replace -I with -iquote to ensure that it searches bundled LLVM first.
298 LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
299 LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
301 LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
302 LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
306 $(foreach host,$(CFG_HOST), \
307 $(eval $(call DEF_LLVM_VARS,$(host))))
309 ######################################################################
310 # Exports for sub-utilities
311 ######################################################################
313 # Note that any variable that re-configure should pick up needs to be
324 export CFG_BUILD_DATE
326 export CFG_VERSION_WIN
328 export CFG_PACKAGE_NAME
330 export CFG_RELEASE_CHANNEL
334 export CFG_LIBDIR_RELATIVE
335 export CFG_DISABLE_INJECT_STD_VERSION
336 ifdef CFG_DISABLE_UNSTABLE_FEATURES
337 CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
338 # Turn on feature-staging
339 export CFG_DISABLE_UNSTABLE_FEATURES
340 # Subvert unstable feature lints to do the self-build
341 export RUSTC_BOOTSTRAP_KEY:=$(CFG_BOOTSTRAP_KEY)
343 export CFG_BOOTSTRAP_KEY
345 ######################################################################
346 # Per-stage targets and runner
347 ######################################################################
349 # Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
350 # This 'function' will determine which debugger scripts to copy based on a
351 # target triple. See debuggers.mk for more information.
352 TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
353 $(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb))
358 # $(1) is the stage number
359 # $(2) is the target triple
360 # $(3) is the host triple
362 # Destinations of artifacts for the host compiler
363 HROOT$(1)_H_$(3) = $(3)/stage$(1)
364 HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
365 ifeq ($$(CFG_WINDOWSY_$(3)),1)
366 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
369 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
371 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
375 # Destinations of artifacts for target architectures
376 TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
377 TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
378 TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
380 # Preqrequisites for using the stageN compiler
382 HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
385 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
387 tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
390 # Prerequisites for using the stageN compiler to build target artifacts
391 TSREQ$(1)_T_$(2)_H_$(3) = \
392 $$(HSREQ$(1)_H_$(3)) \
393 $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a \
394 $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
396 # Prerequisites for a working stageN compiler and libraries, for a specific
398 SREQ$(1)_T_$(2)_H_$(3) = \
399 $$(TSREQ$(1)_T_$(2)_H_$(3)) \
400 $$(foreach dep,$$(TARGET_CRATES), \
401 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
402 tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
404 # Prerequisites for a working stageN compiler and complete set of target
406 CSREQ$(1)_T_$(2)_H_$(3) = \
407 $$(TSREQ$(1)_T_$(2)_H_$(3)) \
408 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
409 $$(foreach dep,$$(CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
412 # Don't run the stage0 compiler under valgrind - that ship has sailed
413 CFG_VALGRIND_COMPILE$(1) =
415 CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
418 # Add RUSTFLAGS_STAGEN values to the build command
419 EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
421 CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
425 # Same macro/variables as above, but defined in a separate loop so it can use
426 # all the variables above for all archs. The RPATH_VAR setup sometimes needs to
427 # reach across triples to get things in order.
429 # Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
430 # * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
431 # environment to access or extend the lookup path for dynamic
432 # libraries. Note on Windows, that key is `$PATH`, and thus not
433 # only conflates programs with dynamic libraries, but also often
434 # contains spaces which confuse make.
435 # * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
436 # * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
438 # Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
443 ifeq ($$(OSTYPE_$(3)),apple-darwin)
444 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
446 ifeq ($$(CFG_WINDOWSY_$(3)),1)
447 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
449 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
453 LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
454 $$(CURDIR)/$$(HLIB$(1)_H_$(3))
455 LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
456 $$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
458 HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
459 $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
460 TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
461 $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
463 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
465 # Pass --cfg stage0 only for the build->host part of stage0;
466 # if you're building a cross config, the host->* parts are
467 # effectively stage1, since it uses the just-built stage0.
469 # This logic is similar to how the LD_LIBRARY_PATH variable must
470 # change be slightly different when doing cross compilations.
471 # The build doesn't copy over all target libraries into
472 # a new directory, so we need to point the library path at
473 # the build directory where all the target libraries came
474 # from (the stage0 build host). Otherwise the relative rpaths
475 # inside of the rustc binary won't get resolved correctly.
477 ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
478 CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
480 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
484 STAGE$(1)_T_$(2)_H_$(3) := \
485 $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
486 $$(call CFG_RUN_TARG_$(3),$(1), \
487 $$(CFG_VALGRIND_COMPILE$(1)) \
488 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
489 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
490 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
493 PERF_STAGE$(1)_T_$(2)_H_$(3) := \
494 $$(Q)$$(call CFG_RUN_TARG_$(3),$(1), \
496 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
497 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
498 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
503 $(foreach build,$(CFG_HOST), \
504 $(eval $(foreach target,$(CFG_TARGET), \
505 $(eval $(foreach stage,$(STAGES), \
506 $(eval $(call SREQ,$(stage),$(target),$(build))))))))
508 $(foreach build,$(CFG_HOST), \
509 $(eval $(foreach target,$(CFG_TARGET), \
510 $(eval $(foreach stage,$(STAGES), \
511 $(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
513 ######################################################################
516 # Builds a functional Rustc for the given host.
517 ######################################################################
519 define DEF_RUSTC_STAGE_TARGET
520 # $(1) == architecture
523 rustc-stage$(2)-H-$(1): \
524 $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
528 $(foreach host,$(CFG_HOST), \
529 $(eval $(foreach stage,1 2 3, \
530 $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
532 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
533 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
534 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
536 define DEF_RUSTC_TARGET
537 # $(1) == architecture
539 rustc-H-$(1): rustc-stage2-H-$(1)
542 $(foreach host,$(CFG_TARGET), \
543 $(eval $(call DEF_RUSTC_TARGET,$(host))))
545 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
546 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
547 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
548 rustc: rustc-H-$(CFG_BUILD)
550 rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
552 ######################################################################
554 ######################################################################
559 ifneq ($$(findstring $(1),$$(CFG_HOST)),)
561 all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
563 # This is a target only
564 all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
568 $(foreach target,$(CFG_TARGET), \
569 $(foreach host,$(CFG_HOST), \
570 $(eval $(call ALL_TARGET_N,$(target),$(host)))))
572 ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
573 $(foreach host,$(CFG_HOST), \
574 all-target-$(target)-host-$(host)))
576 all: $(ALL_TARGET_RULES) $(GENERATED) docs
578 ######################################################################
579 # Build system documentation
580 ######################################################################
582 # $(1) is the name of the doc <section> in Makefile.in
583 # pick everything between tags | remove first line | remove last line
584 # | remove extra (?) line | strip leading `#` from lines
585 SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
588 $(call SHOW_DOCS,help)
591 $(call SHOW_DOCS,tips)
594 $(call SHOW_DOCS,nitty-gritty)