]> git.lizzy.rs Git - rust.git/blob - mk/stage0.mk
auto merge of #13791 : lifthrasiir/rust/mod-inner-span, r=huonw
[rust.git] / mk / stage0.mk
1 # Extract the snapshot host compiler
2
3 $(HBIN0_H_$(CFG_BUILD))/:
4         mkdir -p $@
5
6 $(HLIB0_H_$(CFG_BUILD))/:
7         mkdir -p $@
8
9 $(SNAPSHOT_RUSTC_POST_CLEANUP):                                         \
10                 $(S)src/snapshots.txt                                   \
11                 $(S)src/etc/get-snapshot.py $(MKFILE_DEPS)              \
12                 | $(HBIN0_H_$(CFG_BUILD))/
13
14         @$(call E, fetch: $@)
15 #   Note: the variable "SNAPSHOT_FILE" is generally not set, and so
16 #   we generally only pass one argument to this script.
17 ifdef CFG_ENABLE_LOCAL_RUST
18         $(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
19 else
20         $(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
21 ifdef CFG_ENABLE_PAX_FLAGS
22         @$(call E, apply PaX flags: $@)
23         @"$(CFG_PAXCTL)" -cm "$@"
24 endif
25 endif
26         $(Q)touch $@
27
28 # For other targets, let the host build the target:
29
30 define BOOTSTRAP_STAGE0
31   # $(1) target to bootstrap
32   # $(2) stage to bootstrap from
33   # $(3) target to bootstrap from
34
35 $(HBIN0_H_$(1))/:
36         mkdir -p $@
37
38 $(HLIB0_H_$(1))/:
39         mkdir -p $@
40
41 $$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
42                 $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X_$(1)) \
43                 | $(HBIN0_H_$(1))/
44         @$$(call E, cp: $$@)
45         $$(Q)cp $$< $$@
46
47 endef
48
49 # Use stage1 to build other architectures: then you don't have to wait
50 # for stage2, but you get the latest updates to the compiler source.
51 $(foreach t,$(NON_BUILD_HOST),                                                          \
52  $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_BUILD))))