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