From f61713a5eb91b7cb9d11405e1bb1c7d94504a41b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sat, 31 Aug 2013 21:44:50 +0200 Subject: [PATCH 1/2] hypothetical fix for #8865. --- mk/target.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mk/target.mk b/mk/target.mk index 0d798f4cc1b4c..2d6074c5a054c 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -32,13 +32,15 @@ define TARGET_STAGE_N $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \ rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \ - | $$(TLIB$(1)_T_$(2)_H_$(3))/ + | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ + $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \ rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \ - | $$(TLIB$(1)_T_$(2)_H_$(3))/ + | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ + $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ @@ -77,7 +79,8 @@ ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \ rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \ - | $$(TLIB$(1)_T_$(2)_H_$(3))/ + | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ + $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ From b1a22518f0c687db008c4abf5e8e0411fb58c2f5 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sun, 1 Sep 2013 00:53:56 +0200 Subject: [PATCH 2/2] small cleanup of previous commit with mucho comments. --- mk/stage0.mk | 4 +++- mk/target.mk | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mk/stage0.mk b/mk/stage0.mk index 7d0255db4ac4c..b11dca3aa06b8 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -6,7 +6,9 @@ $(HBIN0_H_$(CFG_BUILD_TRIPLE))/: $(HLIB0_H_$(CFG_BUILD_TRIPLE))/: mkdir -p $@ -$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)): \ +SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) + +$(SNAPSHOT_RUSTC_POST_CLEANUP): \ $(S)src/snapshots.txt \ $(S)src/etc/get-snapshot.py $(MKFILE_DEPS) \ | $(HBIN0_H_$(CFG_BUILD_TRIPLE))/ diff --git a/mk/target.mk b/mk/target.mk index 2d6074c5a054c..0ddeb84e06aae 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -27,20 +27,28 @@ WFLAGS_ST2 = -D warnings # $(2) is the target triple # $(3) is the host triple +# Every recipe in TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3), +# a directory that can be cleaned out during the middle of a run of +# the get-snapshot.py script. Therefore, every recipe needs to have +# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or +# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be +# put into the target area until after the get-snapshot.py script has +# had its chance to clean it out; otherwise the other products will be +# inadvertantly included in the clean out. define TARGET_STAGE_N $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \ rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ - $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) + $(SNAPSHOT_RUSTC_POST_CLEANUP) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \ rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ - $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) + $(SNAPSHOT_RUSTC_POST_CLEANUP) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ @@ -80,7 +88,7 @@ ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \ rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \ | $$(TLIB$(1)_T_$(2)_H_$(3))/ \ - $(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)) + $(SNAPSHOT_RUSTC_POST_CLEANUP) @$$(call E, cp: $$@) $$(Q)cp $$< $$@