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=.1
23 # Append a version-dependent hash to each library, so we can install different
24 # versions in the same place
25 CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE) | $(CFG_HASH_COMMAND))
27 ifeq ($(CFG_RELEASE_CHANNEL),stable)
28 # This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
29 CFG_RELEASE=$(CFG_RELEASE_NUM)
30 # This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
31 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
32 CFG_DISABLE_UNSTABLE_FEATURES=1
34 ifeq ($(CFG_RELEASE_CHANNEL),beta)
35 CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
36 # When building beta distributables just reuse the same "beta" name
37 # so when we upload we'll always override the previous beta. This
38 # doesn't actually impact the version reported by rustc - it's just
41 CFG_DISABLE_UNSTABLE_FEATURES=1
43 ifeq ($(CFG_RELEASE_CHANNEL),nightly)
44 CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
45 # When building nightly distributables just reuse the same "nightly" name
46 # so when we upload we'll always override the previous nighly. This
47 # doesn't actually impact the version reported by rustc - it's just
49 CFG_PACKAGE_VERS=nightly
51 ifeq ($(CFG_RELEASE_CHANNEL),dev)
52 CFG_RELEASE=$(CFG_RELEASE_NUM)-dev
53 CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev
56 # The name of the package to use for creating tarballs, installers etc.
57 CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
59 # The version string plus commit information - this is what rustc reports
60 CFG_VERSION = $(CFG_RELEASE)
61 CFG_GIT_DIR := $(CFG_SRC_DIR).git
62 # since $(CFG_GIT) may contain spaces (especially on Windows),
63 # we need to escape them. (" " to r"\ ")
64 # Note that $(subst ...) ignores space after `subst`,
65 # so we use a hack: define $(SPACE) which contains space character.
69 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
70 CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
71 CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
72 CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
73 CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
77 # Windows exe's need numeric versions - don't use anything but
78 # numbers and dots here
79 CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
81 CFG_INFO := $(info cfg: version $(CFG_VERSION))
83 ######################################################################
85 ######################################################################
87 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
88 MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
89 ifneq ($(NO_MKFILE_DEPS),)
92 NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
93 NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
95 ifneq ($(MAKE_RESTARTS),)
96 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
99 CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
100 CFG_INFO := $(info cfg: host triples $(CFG_HOST))
101 CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
103 ifneq ($(wildcard $(NON_BUILD_HOST)),)
104 CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
106 ifneq ($(wildcard $(NON_BUILD_TARGET)),)
107 CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
110 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
112 CFG_GCCISH_LINK_FLAGS :=
114 # Turn off broken quarantine (see jemalloc/jemalloc#161)
115 CFG_JEMALLOC_FLAGS := --disable-fill
117 ifdef CFG_DISABLE_OPTIMIZE
118 $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
120 CFG_JEMALLOC_FLAGS += --enable-debug
122 # The rtopt cfg turns off runtime sanity checks
123 CFG_RUSTC_FLAGS += -O --cfg rtopt
126 CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
128 ifdef CFG_ENABLE_DEBUG_ASSERTIONS
129 $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
130 CFG_RUSTC_FLAGS += -C debug-assertions=on
133 ifdef CFG_ENABLE_DEBUGINFO
134 $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO))
135 CFG_RUSTC_FLAGS += -g
139 CFG_RUSTC_FLAGS += --save-temps
142 CFG_RUSTC_FLAGS += -Z asm-comments
145 CFG_RUSTC_FLAGS += -Z time-passes
147 ifdef TIME_LLVM_PASSES
148 CFG_RUSTC_FLAGS += -Z time-llvm-passes
151 CFG_RUSTC_FLAGS += -Z trace
153 ifdef CFG_ENABLE_RPATH
154 CFG_RUSTC_FLAGS += -C rpath
157 # The executables crated during this compilation process have no need to include
158 # static copies of libstd and libextra. We also generate dynamic versions of all
159 # libraries, so in the interest of space, prefer dynamic linking throughout the
160 # compilation process.
162 # Note though that these flags are omitted for the *bins* in stage2+. This means
163 # that the snapshot will be generated with a statically linked rustc so we only
164 # have to worry about the distribution of one file (with its native dynamic
166 RUSTFLAGS_STAGE0 += -C prefer-dynamic -C no-stack-check
167 RUSTFLAGS_STAGE1 += -C prefer-dynamic
168 RUST_LIB_FLAGS_ST2 += -C prefer-dynamic
169 RUST_LIB_FLAGS_ST3 += -C prefer-dynamic
171 # Landing pads require a lot of codegen. We can get through bootstrapping faster
172 # by not emitting them.
173 RUSTFLAGS_STAGE0 += -Z no-landing-pads
175 # platform-specific auto-configuration
176 include $(CFG_SRC_DIR)mk/platform.mk
178 # Run the stage1/2 compilers under valgrind
179 ifdef VALGRIND_COMPILE
180 CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
182 CFG_VALGRIND_COMPILE :=
186 ifndef CFG_DISABLE_VALGRIND_RPASS
187 $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS))
188 $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND))
189 CFG_VALGRIND_RPASS :=$(CFG_VALGRIND)
191 $(info cfg: disabling valgrind run-pass tests)
192 CFG_VALGRIND_RPASS :=
196 ifdef CFG_ENABLE_VALGRIND
197 $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
202 ######################################################################
203 # Target-and-rule "utility variables"
204 ######################################################################
206 define DEF_FOR_TARGET
207 X_$(1) := $(CFG_EXE_SUFFIX_$(1))
208 ifndef CFG_LLVM_TARGET_$(1)
209 CFG_LLVM_TARGET_$(1) := $(1)
212 $(foreach target,$(CFG_TARGET), \
213 $(eval $(call DEF_FOR_TARGET,$(target))))
215 # "Source" files we generate in builddir along the way.
218 # Delete the built-in rules.
227 ######################################################################
228 # Cleaning out old crates
229 ######################################################################
231 # $(1) is the path for directory to match against
232 # $(2) is the glob to use in the match
234 # Note that a common bug is to accidentally construct the glob denoted
235 # by $(2) with a space character prefix, which invalidates the
236 # construction $(1)$(2).
237 define CHECK_FOR_OLD_GLOB_MATCHES
238 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
241 # Same interface as above, but deletes rather than just listing the files.
243 define REMOVE_ALL_OLD_GLOB_MATCHES
244 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
247 define REMOVE_ALL_OLD_GLOB_MATCHES
248 $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
252 # We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
253 # than in the macros above because it needs the result of running the
254 # `ls` command after other rules in the command list have run; the
255 # macro-expander for $(wildcard ...) would deliver its results too
256 # soon. (This is in contrast to the macros above, which are meant to
257 # be run at the outset of a command list in a rule.)
259 define LIST_ALL_OLD_GLOB_MATCHES
260 @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
261 @( ls $(1) 2>/dev/null || true )
264 define LIST_ALL_OLD_GLOB_MATCHES
268 ######################################################################
270 ######################################################################
273 LLVM_COMPONENTS=x86 arm aarch64 mips powerpc ipo bitreader bitwriter linker asmparser mcjit \
274 interpreter instrumentation
276 # Only build these LLVM tools
277 LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
280 # The configure script defines these variables with the target triples
281 # separated by Z. This defines new ones with the expected format.
282 ifeq ($$(CFG_LLVM_ROOT),)
283 CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
284 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
286 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT)
289 # Any rules that depend on LLVM should depend on LLVM_CONFIG
290 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
291 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
292 LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1))
293 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
294 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296 LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297 LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298 LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
299 ifeq ($$(findstring freebsd,$(1)),freebsd)
300 # On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
301 # so we replace -I with -iquote to ensure that it searches bundled LLVM first.
302 LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
304 LLVM_CXXFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags)
306 LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
308 LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
309 LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
313 $(foreach host,$(CFG_HOST), \
314 $(eval $(call DEF_LLVM_VARS,$(host))))
316 ######################################################################
317 # Exports for sub-utilities
318 ######################################################################
320 # Note that any variable that re-configure should pick up needs to be
324 export CFG_SRC_DIR_RELATIVE
333 export CFG_VERSION_WIN
335 export CFG_PACKAGE_NAME
337 export CFG_RELEASE_CHANNEL
341 export CFG_LIBDIR_RELATIVE
342 export CFG_DISABLE_INJECT_STD_VERSION
343 ifdef CFG_DISABLE_UNSTABLE_FEATURES
344 CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
345 # Turn on feature-staging
346 export CFG_DISABLE_UNSTABLE_FEATURES
347 # Subvert unstable feature lints to do the self-build
348 export RUSTC_BOOTSTRAP_KEY:=$(CFG_BOOTSTRAP_KEY)
350 export CFG_BOOTSTRAP_KEY
352 ######################################################################
353 # Per-stage targets and runner
354 ######################################################################
356 # Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
357 # This 'function' will determine which debugger scripts to copy based on a
358 # target triple. See debuggers.mk for more information.
359 TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
360 $(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb))
365 # $(1) is the stage number
366 # $(2) is the target triple
367 # $(3) is the host triple
369 # Destinations of artifacts for the host compiler
370 HROOT$(1)_H_$(3) = $(3)/stage$(1)
371 HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
372 ifeq ($$(CFG_WINDOWSY_$(3)),1)
373 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
376 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
378 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
382 # Destinations of artifacts for target architectures
383 TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
384 TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
385 TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
387 # Preqrequisites for using the stageN compiler
389 HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
392 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
394 tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
397 # Prerequisites for using the stageN compiler to build target artifacts
398 TSREQ$(1)_T_$(2)_H_$(3) = \
399 $$(HSREQ$(1)_H_$(3)) \
400 $$(foreach obj,$$(INSTALLED_OBJECTS_$(2)),\
401 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))
404 TSREQ$(1)_T_$(2)_H_$(3) += \
405 $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_STATIC_LIB_NAME_$(2),morestack)
408 # Prerequisites for a working stageN compiler and libraries, for a specific
410 SREQ$(1)_T_$(2)_H_$(3) = \
411 $$(TSREQ$(1)_T_$(2)_H_$(3)) \
412 $$(foreach dep,$$(TARGET_CRATES), \
413 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
414 tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
416 # Prerequisites for a working stageN compiler and complete set of target
418 CSREQ$(1)_T_$(2)_H_$(3) = \
419 $$(TSREQ$(1)_T_$(2)_H_$(3)) \
420 $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
421 $$(foreach dep,$$(CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
424 # Don't run the stage0 compiler under valgrind - that ship has sailed
425 CFG_VALGRIND_COMPILE$(1) =
427 CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
430 # Add RUSTFLAGS_STAGEN values to the build command
431 EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
433 CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
437 # Same macro/variables as above, but defined in a separate loop so it can use
438 # all the variables above for all archs. The RPATH_VAR setup sometimes needs to
439 # reach across triples to get things in order.
441 # Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
442 # * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
443 # environment to access or extend the lookup path for dynamic
444 # libraries. Note on Windows, that key is `$PATH`, and thus not
445 # only conflates programs with dynamic libraries, but also often
446 # contains spaces which confuse make.
447 # * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
448 # * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
450 # Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
455 ifeq ($$(OSTYPE_$(3)),apple-darwin)
456 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
458 ifeq ($$(CFG_WINDOWSY_$(3)),1)
459 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
461 LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
465 LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
466 $$(CURDIR)/$$(HLIB$(1)_H_$(3))
467 LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
468 $$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
470 HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
471 $$(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))
472 TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
473 $$(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))
475 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
477 # Pass --cfg stage0 only for the build->host part of stage0;
478 # if you're building a cross config, the host->* parts are
479 # effectively stage1, since it uses the just-built stage0.
481 # This logic is similar to how the LD_LIBRARY_PATH variable must
482 # change be slightly different when doing cross compilations.
483 # The build doesn't copy over all target libraries into
484 # a new directory, so we need to point the library path at
485 # the build directory where all the target libraries came
486 # from (the stage0 build host). Otherwise the relative rpaths
487 # inside of the rustc binary won't get resolved correctly.
489 ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
490 CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
492 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
496 STAGE$(1)_T_$(2)_H_$(3) := \
497 $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
498 $$(call CFG_RUN_TARG_$(3),$(1), \
499 $$(CFG_VALGRIND_COMPILE$(1)) \
500 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
501 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
502 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
505 PERF_STAGE$(1)_T_$(2)_H_$(3) := \
506 $$(Q)$$(call CFG_RUN_TARG_$(3),$(1), \
508 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
509 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
510 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
515 $(foreach build,$(CFG_HOST), \
516 $(eval $(foreach target,$(CFG_TARGET), \
517 $(eval $(foreach stage,$(STAGES), \
518 $(eval $(call SREQ,$(stage),$(target),$(build))))))))
520 $(foreach build,$(CFG_HOST), \
521 $(eval $(foreach target,$(CFG_TARGET), \
522 $(eval $(foreach stage,$(STAGES), \
523 $(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
525 ######################################################################
528 # Builds a functional Rustc for the given host.
529 ######################################################################
531 define DEF_RUSTC_STAGE_TARGET
532 # $(1) == architecture
535 rustc-stage$(2)-H-$(1): \
536 $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
540 $(foreach host,$(CFG_HOST), \
541 $(eval $(foreach stage,1 2 3, \
542 $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
544 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
545 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
546 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
548 define DEF_RUSTC_TARGET
549 # $(1) == architecture
551 rustc-H-$(1): rustc-stage2-H-$(1)
554 $(foreach host,$(CFG_TARGET), \
555 $(eval $(call DEF_RUSTC_TARGET,$(host))))
557 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
558 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
559 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
560 rustc: rustc-H-$(CFG_BUILD)
562 rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
564 ######################################################################
566 ######################################################################
571 ifneq ($$(findstring $(1),$$(CFG_HOST)),)
573 all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
575 # This is a target only
576 all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
580 $(foreach target,$(CFG_TARGET), \
581 $(foreach host,$(CFG_HOST), \
582 $(eval $(call ALL_TARGET_N,$(target),$(host)))))
584 ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
585 $(foreach host,$(CFG_HOST), \
586 all-target-$(target)-host-$(host)))
588 all: $(ALL_TARGET_RULES) $(GENERATED) docs
590 ######################################################################
591 # Build system documentation
592 ######################################################################
594 # $(1) is the name of the doc <section> in Makefile.in
595 # pick everything between tags | remove first line | remove last line
596 # | remove extra (?) line | strip leading `#` from lines
597 SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
600 $(call SHOW_DOCS,help)
603 $(call SHOW_DOCS,tips)
606 $(call SHOW_DOCS,nitty-gritty)