diff --git a/Makefile.in b/Makefile.in index b9920aa60ad..bca52e09885 100644 --- a/Makefile.in +++ b/Makefile.in @@ -42,6 +42,8 @@ # # Admittedly this is a little convoluted. +STAGES = 0 1 2 3 + ###################################################################### # Residual auto-configuration ###################################################################### @@ -243,51 +245,52 @@ export CFG_PREFIX ###################################################################### define SREQ +# $(1) is the stage number +# $(2) is the target triple +# $(3) is the build triple # Destinations of artifacts for the host compiler -HOST_ROOT$(1) = stage$(1) -HOST_BIN$(1) = $$(HOST_ROOT$(1))/bin -HOST_LIB$(1) = $$(HOST_ROOT$(1))/lib +HROOT$(1)_H_$(3) = $(3)/stage$(1) +HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin +HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib # Destinations of artifacts for target architectures -TARGET_ROOT$(1)$(2) = $$(HOST_LIB$(1))/rustc/$(2) -TARGET_BIN$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/bin -TARGET_LIB$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/lib - -# The target locations of artifacts for the host architecture (used for -# promoting target binaries to host binaries) -TARGET_HOST_ROOT$(1) = $$(TARGET_ROOT$(1)$$(CFG_HOST_TRIPLE)) -TARGET_HOST_BIN$(1) = $$(TARGET_BIN$(1)$$(CFG_HOST_TRIPLE)) -TARGET_HOST_LIB$(1) = $$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE)) +TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustc/$(2) +TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin +TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib # The name of the standard library used by rustc ifdef CFG_DISABLE_SHAREDSTD - HOST_STDLIB_DEFAULT$(1) = $$(HOST_LIB$(1))/libstd.rlib - TARGET_STDLIB_DEFAULT$(1)$(2) = $$(TARGET_LIB$(1)$(2))/libstd.rlib + HSTDLIB_DEFAULT$(1)_H_$(3) = \ + $$(HLIB$(1)_H_$(3))/libstd.rlib + TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \ + $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib else - HOST_STDLIB_DEFAULT$(1) = $$(HOST_LIB$(1))/$(CFG_STDLIB) - TARGET_STDLIB_DEFAULT$(1)$(2) = $$(TARGET_LIB$(1)$(2))/$(CFG_STDLIB) + HSTDLIB_DEFAULT$(1)_H_$(3) = \ + $$(HLIB$(1)_H_$(3))/$(CFG_STDLIB) + TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \ + $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB) endif # Preqrequisites for using the stageN compiler -HOST_SREQ$(1) = \ - $$(HOST_BIN$(1))/rustc$$(X) \ - $$(HOST_LIB$(1))/$$(CFG_RUNTIME) \ - $$(HOST_LIB$(1))/$$(CFG_RUSTLLVM) \ - $$(HOST_STDLIB_DEFAULT$(1)) \ +HSREQ$(1)_H_$(3) = \ + $$(HBIN$(1)_H_$(3))/rustc$$(X) \ + $$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME) \ + $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLLVM) \ + $$(HSTDLIB_DEFAULT$(1)_H_$(3)) \ $$(MKFILES) # Prerequisites for using the stageN compiler to build target artifacts -TARGET_SREQ$(1)$(2) = \ - $$(HOST_SREQ$(1)) \ - $$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME) \ - $$(TARGET_LIB$(1)$(2))/intrinsics.bc \ - $$(TARGET_LIB$(1)$(2))/libmorestack.a +TSREQ$(1)_T_$(2)_H_$(3) = \ + $$(HSREQ$(1)_H_$(3)) \ + $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME) \ + $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc \ + $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a # Prerequisites for complete stageN targets -SREQ$(1)$(2) = \ - $$(TARGET_SREQ$(1)$(2)) \ - $$(TARGET_LIB$(1)$(2))/$$(CFG_STDLIB) +SREQ$(1)_T_$(2)_H_$(3) = \ + $$(TSREQ$(1)_T_$(2)_H_$(3)) \ + $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB) ifeq ($(1),0) # Don't run the the stage0 compiler under valgrind - that ship has sailed @@ -296,21 +299,24 @@ else CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE) endif -STAGE$(1)_$(2) := $$(Q)$$(call CFG_RUN_TARG,$(1), \ - $$(CFG_VALGRIND_COMPILE$(1)) $$(HOST_BIN$(1))/rustc$$(X) \ - $$(CFG_RUSTC_FLAGS) --target=$(2)) +STAGE$(1)_T_$(2)_H_$(3) := \ + $$(Q)$$(call CFG_RUN_TARG,$(1), \ + $$(CFG_VALGRIND_COMPILE$(1)) \ + $$(HBIN$(1)_H_$(3))/rustc$$(X) \ + $$(CFG_RUSTC_FLAGS) --target=$(2)) -PERF_STAGE$(1)_$(2) := $$(Q)$$(call CFG_RUN_TARG,$(1), \ - $$(CFG_PERF_TOOL) $$(HOST_BIN$(1))/rustc$$(X) \ - $$(CFG_RUSTC_FLAGS) --target=$(2)) +PERF_STAGE$(1)_T_$(2)_H_$(3) := \ + $$(Q)$$(call CFG_RUN_TARG,$(1), \ + $$(CFG_PERF_TOOL) \ + $$(HBIN$(1)_H_$(3))/rustc$$(X) \ + $$(CFG_RUSTC_FLAGS) --target=$(2)) endef -$(foreach target,$(CFG_TARGET_TRIPLES), \ - $(eval $(call SREQ,0,$(target))) \ - $(eval $(call SREQ,1,$(target))) \ - $(eval $(call SREQ,2,$(target))) \ - $(eval $(call SREQ,3,$(target)))) +$(foreach build,$(CFG_TARGET_TRIPLES), \ + $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \ + $(eval $(foreach stage,$(STAGES), \ + $(eval $(call SREQ,$(stage),$(target),$(build)))))))) ###################################################################### # Entrypoint rule @@ -327,11 +333,13 @@ all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS) else -TARGET_SREQS := $(foreach target,$(CFG_TARGET_TRIPLES),$(SREQ3$(target))) -FUZZ := $(HOST_BIN3)/fuzzer$(X) +TSREQS := \ + $(foreach target,$(CFG_TARGET_TRIPLES), \ + $(SREQ3_T_$(target)_H_$(CFG_HOST_TRIPLE))) +FUZZ := $(HBIN3_H_$(CFG_HOST_TRIPLE))/fuzzer$(X) #all: $(SREQ3$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS) $(FUZZ) -all: $(TARGET_SREQS) $(GENERATED) $(DOCS) $(FUZZ) +all: $(TSREQS) $(GENERATED) $(DOCS) $(FUZZ) endif diff --git a/configure b/configure index dc539d0af0c..96141cd4007 100755 --- a/configure +++ b/configure @@ -380,25 +380,27 @@ do done done -for t in $CFG_TARGET_TRIPLES +for h in $CFG_TARGET_TRIPLES do - for i in 0 1 2 3 + for t in $CFG_TARGET_TRIPLES do - # host bin dir - make_dir stage$i/bin + for i in 0 1 2 3 + do + # host bin dir + make_dir $h/stage$i/bin - # host lib dir - make_dir stage$i/lib + # host lib dir + make_dir $h/stage$i/lib - # target bin dir - make_dir stage$i/lib/rustc/$t/bin + # target bin dir + make_dir $h/stage$i/lib/rustc/$t/bin - # target lib dir - make_dir stage$i/lib/rustc/$t/lib + # target lib dir + make_dir $h/stage$i/lib/rustc/$t/lib + done done done - # Configure submodules step_msg "configuring submodules" diff --git a/mk/clean.mk b/mk/clean.mk index 688dbab073e..c38bf492667 100644 --- a/mk/clean.mk +++ b/mk/clean.mk @@ -2,12 +2,16 @@ # Cleanup ###################################################################### -CLEAN_STAGE_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \ - clean0$(target) clean1$(target) clean2$(target) clean3$(target)) \ - clean0 clean1 clean2 clean3 +CLEAN_STAGE_RULES = \ + $(foreach stage, $(STAGES), \ + $(foreach host, $(CFG_TARGET_TRIPLES), \ + clean$(stage)_H_$(host) \ + $(foreach target, $(CFG_TARGET_TRIPLES), \ + clean$(stage)_H_$(host)_T_$(target)))) -CLEAN_LLVM_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \ - clean-llvm$(target)) +CLEAN_LLVM_RULES = \ + $(foreach target, $(CFG_TARGET_TRIPLES), \ + clean-llvm$(target)) .PHONY: clean clean-all clean-misc @@ -45,41 +49,45 @@ clean-misc: $(Q)rm -Rf doc/version.texi $(Q)rm -rf libuv -define CLEAN_STAGE_N +define CLEAN_HOST_STAGE_N -clean$(1): - $(Q)rm -f $$(HOST_BIN$(1))/rustc$(X) - $(Q)rm -f $$(HOST_BIN$(1))/fuzzer$(X) - $(Q)rm -f $$(HOST_LIB$(1))/$(CFG_RUNTIME) - $(Q)rm -f $$(HOST_LIB$(1))/$(CFG_STDLIB) - $(Q)rm -f $$(HOST_LIB$(1))/$(CFG_RUSTLLVM) - $(Q)rm -f $$(HOST_LIB$(1))/libstd.rlib - -clean$(1)$(2): - $(Q)rm -f $$(TARGET_BIN$(1)$(2))/rustc$(X) - $(Q)rm -f $$(TARGET_BIN$(1)$(2))/fuzzer$(X) - $(Q)rm -f $$(TARGET_LIB$(1)$(2))/$(CFG_RUNTIME) - $(Q)rm -f $$(TARGET_LIB$(1)$(2))/$(CFG_STDLIB) - $(Q)rm -f $$(TARGET_LIB$(1)$(2))/$(CFG_RUSTLLVM) - $(Q)rm -f $$(TARGET_LIB$(1)$(2))/libstd.rlib - $(Q)rm -f $$(TARGET_LIB$(1)$(2))/intrinsics.bc +clean$(1)_H_$(2): + $(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X) + $(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X) + $(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME) + $(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB) + $(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM) + $(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib endef -$(foreach target, $(CFG_TARGET_TRIPLES), \ - $(eval $(call CLEAN_STAGE_N,0,$(target))) \ - $(eval $(call CLEAN_STAGE_N,1,$(target))) \ - $(eval $(call CLEAN_STAGE_N,2,$(target))) \ - $(eval $(call CLEAN_STAGE_N,3,$(target)))) +$(foreach host, $(CFG_TARGET_TRIPLES), \ + $(eval $(foreach stage, $(STAGES), \ + $(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host)))))) +define CLEAN_TARGET_STAGE_N + +clean$(1)_T_$(2)_H$(3): + $(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X) + $(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X) + $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME) + $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB) + $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM) + $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib + $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc + +endef + +$(foreach host, $(CFG_TARGET_TRIPLES), \ + $(eval $(foreach target, $(CFG_TARGET_TRIPLES), \ + $(eval $(foreach stage, $(STAGES), \ + $(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host)))))))) define DEF_CLEAN_LLVM_TARGET ifeq ($(CFG_LLVM_ROOT),) - clean-llvm$(1): $$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean else - clean-llvm$(1): ; endif diff --git a/mk/host.mk b/mk/host.mk index 31e995d22c6..eae38abc64f 100644 --- a/mk/host.mk +++ b/mk/host.mk @@ -1,56 +1,59 @@ -# HOST_STAGE_N template: arg 1 is the N we're promoting *from*, arg 2 -# is N+1. Must be invoked to promote target artifacts to host artifacts -# for stage 1-3 (stage0 host artifacts come from the snapshot). +# CP_HOST_STAGE_N template: arg 1 is the N we're promoting *from*, arg +# 2 is N+1. Must be invoked to promote target artifacts to host +# artifacts for stage 1-3 (stage0 host artifacts come from the +# snapshot). Arg 3 is the triple we're copying FROM and arg 4 is the +# triple we're copying TO. # # The easiest way to read this template is to assume we're promoting # stage1 to stage2 and mentally gloss $(1) as 1, $(2) as 2. -define HOST_STAGE_N +define CP_HOST_STAGE_N # Host libraries and executables (stage$(2)/bin/rustc and its runtime needs) -$$(HOST_BIN$(2))/rustc$$(X): \ - $$(TARGET_HOST_BIN$(1))/rustc$$(X) \ - $$(HOST_LIB$(2))/$$(CFG_RUNTIME) \ - $$(HOST_LIB$(2))/$$(CFG_RUSTLLVM) \ - $$(HOST_STDLIB_DEFAULT$(2)) +$$(HBIN$(2)_H_$(4))/rustc$$(X): \ + $$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \ + $$(HSTDLIB_DEFAULT$(2)_H_$(4)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ # FIXME: The fuzzer depends on this. Remove once it's rpathed to correctly # find it in the appropriate target directory -$$(HOST_LIB$(2))/$$(CFG_LIBRUSTC): \ - $$(TARGET_HOST_LIB$(1))/$$(CFG_LIBRUSTC) \ - $$(HOST_LIB$(2))/$$(CFG_RUNTIME) \ - $$(HOST_LIB$(2))/$$(CFG_RUSTLLVM) \ - $$(HOST_STDLIB_DEFAULT$(2)) +$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC): \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \ + $$(HSTDLIB_DEFAULT$(2)_H_$(3)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(HOST_LIB$(2))/$$(CFG_RUNTIME): \ - $$(TARGET_HOST_LIB$(1))/$$(CFG_RUNTIME) +$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME): \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_RUNTIME) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(HOST_LIB$(2))/$$(CFG_STDLIB): \ - $$(TARGET_HOST_LIB$(1))/$$(CFG_STDLIB) \ - $$(HOST_LIB$(2))/$$(CFG_RUNTIME) +$$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(HOST_LIB$(2))/libstd.rlib: \ - $$(TARGET_HOST_LIB$(1))/libstd.rlib \ - $$(HOST_LIB$(2))/$$(CFG_RUNTIME) +$$(HLIB$(2)_H_$(4))/libstd.rlib: \ + $$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \ + $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(HOST_LIB$(2))/$$(CFG_RUSTLLVM): \ - $$(TARGET_HOST_LIB$(1))/$$(CFG_RUSTLLVM) +$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM): \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_RUSTLLVM) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ endef -$(eval $(call HOST_STAGE_N,0,1)) -$(eval $(call HOST_STAGE_N,1,2)) -$(eval $(call HOST_STAGE_N,2,3)) +$(foreach t,$(CFG_TARGET_TRIPLES), \ + $(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \ + $(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \ + $(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t)))) diff --git a/mk/install.mk b/mk/install.mk index 13730dc3563..b5aeeaeb322 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -17,43 +17,44 @@ PREFIX_ROOT = $(CFG_PREFIX) PREFIX_BIN = $(PREFIX_ROOT)/bin PREFIX_LIB = $(PREFIX_ROOT)/lib +define INSTALL_TARGET_N + # $(1) is the target triple + # $(2) is the host triple + +# T{B,L} == Target {Bin, Lib} for stage ${ISTAGE} +TB$(1)_H_$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2)) +TL$(1)_H_$(2) = $$(TLIB$$(ISTAGE))_T_$(1)_H_$(2)) + +# PT{R,B,L} == Prefix Target {Root, Bin, Lib} +PTR_T_$(1)_H_$(2) = $$(PREFIX_LIB)/rustc/$(1) +PTB_T_$(1)_H_$(2) = $$(PTR_T_$(1)_H_$(2))/bin +PTL_T_$(1)_H_$(2) = $$(PTR_T_$(1)_H_$(2))/lib + +install-target-$(1)-host-$(2): $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2)) + $(Q)mkdir -p $$(PTL_$(1)_H_$(2)) + $(Q)$(call INSTALL,$$(TL$(1)_H_$(2)),$$(PTL$(1)_H_$(2)),$$(CFG_RUNTIME)) + $(Q)$(call INSTALL,$$(TL$(1)_H_$(2)),$$(PTL$(1)_H_$(2)),$$(CFG_STDLIB)) + $(Q)$(call INSTALL,$$(TL$(1)_H_$(2)),$$(PTL$(1)_H_$(2)),intrinsics.bc) + $(Q)$(call INSTALL,$$(TL$(1)_H_$(2)),$$(PTL$(1)_H_$(2)),libmorestack.a) +endef + +$(foreach target,$(CFG_TARGET_TRIPLES), \ + $(eval $(call INSTALL_TARGET_N,$(target),$(CFG_HOST_TRIPLE)))) + +INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \ + install-target-$(target)-host-$(CFG_HOST_TRIPLE)) + +install: install-host install-targets + # Shorthand for build/stageN/bin -HB = $(HOST_BIN$(ISTAGE)) +HB = $(HBIN$(ISTAGE)_H_$(HT)) # Shorthand for build/stageN/lib -HL = $(HOST_LIB$(ISTAGE)) +HL = $(HLIB$(ISTAGE)_H_$(HT)) # Shorthand for the prefix bin directory PHB = $(PREFIX_BIN) # Shorthand for the prefix bin directory PHL = $(PREFIX_LIB) -define INSTALL_TARGET_N - -PREFIX_TARGET_ROOT$(1) = $$(PREFIX_LIB)/rustc/$(1) -PREFIX_TARGET_BIN$(1) = $$(PREFIX_TARGET_ROOT$(1))/bin -PREFIX_TARGET_LIB$(1) = $$(PREFIX_TARGET_ROOT$(1))/lib - -# Similar to the H* macros above but for each target triple -TB$(1) = $$(TARGET_BIN$$(ISTAGE)$(1)) -TL$(1) = $$(TARGET_LIB$$(ISTAGE)$(1)) -PTB$(1) = $$(PREFIX_TARGET_BIN$(1)) -PTL$(1) = $$(PREFIX_TARGET_LIB$(1)) - -install-target$(1): $$(SREQ$$(ISTAGE)$(1)) - $(Q)mkdir -p $$(PREFIX_TARGET_LIB$(1)) - $(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),$$(CFG_RUNTIME)) - $(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),$$(CFG_STDLIB)) - $(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),intrinsics.bc) - $(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),libmorestack.a) -endef - -$(foreach target,$(CFG_TARGET_TRIPLES), \ - $(eval $(call INSTALL_TARGET_N,$(target)))) - -INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \ - install-target$(target)) - -install: install-host install-targets - install-host: $(SREQ$(ISTAGE)$(CFG_HOST_TRIPLE)) $(Q)mkdir -p $(PREFIX_BIN) $(Q)mkdir -p $(PREFIX_LIB) diff --git a/mk/perf.mk b/mk/perf.mk index 56eb1ef4ec1..50ca3274753 100644 --- a/mk/perf.mk +++ b/mk/perf.mk @@ -1,11 +1,11 @@ ifdef CFG_PERF_TOOL -rustc-perf$(X): stage2/bin/rustc$(X) +rustc-perf$(X): $(CFG_HOST_TRIPLE)/stage2/bin/rustc$(X) @$(call E, perf compile: $@) $(PERF_STAGE2_$(CFG_HOST_TRIPLE)) -o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1 $(Q)rm -f $@ else -rustc-perf$(X): stage2/bin/rustc$(X) +rustc-perf$(X): $(CFG_HOST_TRIPLE)/stage2/bin/rustc$(X) $(Q)touch $@ endif diff --git a/mk/platform.mk b/mk/platform.mk index a2bdc19a0de..2b790794072 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -101,7 +101,7 @@ else CFG_GCCISH_CFLAGS += -O2 endif -CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \ +CFG_TESTLIB=$(CFG_BUILD_DIR)/$(CFG_HOST_TRIPLE)/$(strip \ $(if $(findstring stage0,$(1)), \ stage0/lib, \ $(if $(findstring stage1,$(1)), \ diff --git a/mk/pp.mk b/mk/pp.mk index a70fce3c8a1..15b537a5823 100644 --- a/mk/pp.mk +++ b/mk/pp.mk @@ -15,7 +15,7 @@ endif reformat: $(SREQ1$(CFG_HOST_TRIPLE)) @$(call E, reformat [stage1]: $@) for i in $(PP_INPUTS_FILTERED); \ - do $(call CFG_RUN_TARG,1,stage1/rustc$(X)) \ + do $(call CFG_RUN_TARG,1,$(CFG_HOST_TRIPLE)/stage1/rustc$(X)) \ --pretty normal $$i >$$i.tmp; \ if [ $$? -ne 0 ]; \ then echo failed to print $$i; rm $$i.tmp; \ diff --git a/mk/snap.mk b/mk/snap.mk index 7a0ed8ddb92..8fa0a43b3a7 100644 --- a/mk/snap.mk +++ b/mk/snap.mk @@ -1,9 +1,9 @@ -snap-stage1: $(HOST_SREQ1) - $(S)src/etc/make-snapshot.py stage1 +snap-stage1: $(HSREQ1_H_$(CFG_HOST_TRIPLE)) + $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage1 -snap-stage2: $(HOST_SREQ2) - $(S)src/etc/make-snapshot.py stage2 +snap-stage2: $(HSREQ2_H_$(CFG_HOST_TRIPLE) + $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage2 -snap-stage3: $(HOST_SREQ3) - $(S)src/etc/make-snapshot.py stage3 +snap-stage3: $(HSREQ3_H_$(CFG_HOST_TRIPLE) + $(S)src/etc/make-snapshot.py $(CFG_HOST_TRIPLE)/stage3 diff --git a/mk/stage0.mk b/mk/stage0.mk index c2cb26da527..b1a0f1eb3a0 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -1,19 +1,22 @@ # Extract the snapshot host compiler -$(HOST_BIN0)/rustc$(X): \ - $(S)src/snapshots.txt \ - $(S)src/etc/get-snapshot.py $(MKFILES) +$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \ + $(S)src/snapshots.txt \ + $(S)src/etc/get-snapshot.py $(MKFILES) @$(call E, fetch: $@) - $(Q)$(S)src/etc/get-snapshot.py + $(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(Q)touch $@ # Host libs will be extracted by the above rule -$(HOST_LIB0)/$(CFG_RUNTIME): $(HOST_BIN0)/rustc$(X) +$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUNTIME): \ + $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X) $(Q)touch $@ -$(HOST_LIB0)/$(CFG_STDLIB): $(HOST_BIN0)/rustc$(X) +$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \ + $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X) $(Q)touch $@ -$(HOST_LIB0)/$(CFG_RUSTLLVM): $(HOST_BIN0)/rustc$(X) +$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \ + $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X) $(Q)touch $@ diff --git a/mk/target.mk b/mk/target.mk index e659b796369..07c9fb03f16 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -1,67 +1,64 @@ # TARGET_STAGE_N template: This defines how target artifacts are built -# for all stage/target architecture combinations. Argument 1 is the -# stage and arg 2 is the target triple - -# FIXME: We don't actually know how to build many of these when host -# and target architectures are not the same +# for all stage/target architecture combinations. The arguments: +# $(1) is the stage +# $(2) is the target triple +# $(3) is the host triple define TARGET_STAGE_N -$$(TARGET_LIB$(1)$(2))/intrinsics.ll: \ +$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll: \ $$(S)src/rt/intrinsics/intrinsics.$(HOST_$(2)).ll.in @$$(call E, sed: $$@) $$(Q)sed s/@CFG_TARGET_TRIPLE@/$(2)/ $$< > $$@ -$$(TARGET_LIB$(1)$(2))/intrinsics.bc: $$(TARGET_LIB$(1)$(2))/intrinsics.ll \ +$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc: \ + $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll \ $$(LLVM_CONFIG_$(2)) @$$(call E, llvms-as: $$@) $$(Q)$$(LLVM_AS_$(2)) -o $$@ $$< -$$(TARGET_LIB$(1)$(2))/libmorestack.a: rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a +$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \ + rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(TARGET_LIB$(1)$(2))/$$(CFG_STDLIB): \ - $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ - $$(TARGET_SREQ$(1)$(2)) +$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \ + $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ + $$(TSREQ$(1)_T_$(2)_H_$(3)) @$$(call E, compile_and_link: $$@) - $$(STAGE$(1)_$(2)) --lib -o $$@ $$< + $$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$< -$$(TARGET_LIB$(1)$(2))/libstd.rlib: \ - $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ - $$(TARGET_SREQ$(1)$(2)) - @$$(call E, compile_and_link: $$@) - $$(STAGE$(1)_$(2)) --lib --static -o $$@ $$< - -$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): rt/$(2)/$$(CFG_RUNTIME) +$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \ + rt/$(2)/$$(CFG_RUNTIME) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM): rustllvm/$(2)/$$(CFG_RUSTLLVM) +$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \ + rustllvm/$(2)/$$(CFG_RUSTLLVM) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(TARGET_BIN$(1)$(2))/rustc$$(X): \ - $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \ - $$(TARGET_SREQ$(1)$(2)) \ - $$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM) \ - $$(TARGET_STDLIB_DEFAULT$(1)$(2)) - @$$(call E, compile_and_link: $$@ for stage $(1) and target $(2)) - $$(STAGE$(1)_$(2)) -o $$@ $$< - -$$(TARGET_LIB$(1)$(2))/$$(CFG_LIBRUSTC): \ - $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \ - $$(TARGET_SREQ$(1)$(2)) \ - $$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM) \ - $$(TARGET_STDLIB_DEFAULT$(1)$(2)) +$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \ + $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \ + $$(TSREQ$(1)_T_$(2)_H_$(3)) \ + $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \ + $$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) @$$(call E, compile_and_link: $$@) - $$(STAGE$(1)_$(2)) --lib -o $$@ $$< + $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< + +$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \ + $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \ + $$(TSREQ$(1)_T_$(2)_H_$(3)) \ + $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \ + $$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) + @$$(call E, compile_and_link: $$@) + $$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$< endef # Instantiate template for all stages $(foreach target,$(CFG_TARGET_TRIPLES), \ - $(eval $(call TARGET_STAGE_N,0,$(target))) \ - $(eval $(call TARGET_STAGE_N,1,$(target))) \ - $(eval $(call TARGET_STAGE_N,2,$(target))) \ - $(eval $(call TARGET_STAGE_N,3,$(target)))) + $(eval $(call TARGET_STAGE_N,0,$(target),$(CFG_HOST_TRIPLE))) \ + $(eval $(call TARGET_STAGE_N,1,$(target),$(CFG_HOST_TRIPLE))) \ + $(eval $(call TARGET_STAGE_N,2,$(target),$(CFG_HOST_TRIPLE))) \ + $(eval $(call TARGET_STAGE_N,3,$(target),$(CFG_HOST_TRIPLE)))) diff --git a/mk/tests.mk b/mk/tests.mk index 39fc505c2bb..6966dcddb85 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -112,180 +112,204 @@ define TEST_STAGEN # command line. # # $(1) is the stage number -# $(2) is the target triple +# $(2) is the target triple to test +# $(3) is the host triple to test -check-stage$(1)-$(2): tidy \ - check-stage$(1)-$(2)-rustc \ - check-stage$(1)-$(2)-std \ - check-stage$(1)-$(2)-rpass \ - check-stage$(1)-$(2)-rfail \ - check-stage$(1)-$(2)-cfail \ - check-stage$(1)-$(2)-bench \ - check-stage$(1)-$(2)-pretty +check-stage$(1)-$(2)-H-$(3): tidy \ + check-stage$(1)-$(2)-H-$(3)-rustc \ + check-stage$(1)-$(2)-H-$(3)-std \ + check-stage$(1)-$(2)-H-$(3)-rpass \ + check-stage$(1)-$(2)-H-$(3)-rfail \ + check-stage$(1)-$(2)-H-$(3)-cfail \ + check-stage$(1)-$(2)-H-$(3)-bench \ + check-stage$(1)-$(2)-H-$(3)-pretty -check-stage$(1)-$(2)-std: check-stage$(1)-$(2)-std-dummy +check-stage$(1)-$(2)-H-$(3)-std: \ + check-stage$(1)-$(2)-H-$(3)-std-dummy -check-stage$(1)-$(2)-rustc: check-stage$(1)-$(2)-rustc-dummy +check-stage$(1)-$(2)-H-$(3)-rustc: \ + check-stage$(1)-$(2)-H-$(3)-rustc-dummy -check-stage$(1)-$(2)-cfail: check-stage$(1)-$(2)-cfail-dummy +check-stage$(1)-$(2)-H-$(3)-cfail: \ + check-stage$(1)-$(2)-H-$(3)-cfail-dummy -check-stage$(1)-$(2)-rfail: check-stage$(1)-$(2)-rfail-dummy +check-stage$(1)-$(2)-H-$(3)-rfail: \ + check-stage$(1)-$(2)-H-$(3)-rfail-dummy -check-stage$(1)-$(2)-rpass: check-stage$(1)-$(2)-rpass-dummy +check-stage$(1)-$(2)-H-$(3)-rpass: \ + check-stage$(1)-$(2)-H-$(3)-rpass-dummy -check-stage$(1)-$(2)-bench: check-stage$(1)-$(2)-bench-dummy +check-stage$(1)-$(2)-H-$(3)-bench: \ + check-stage$(1)-$(2)-H-$(3)-bench-dummy -check-stage$(1)-$(2)-perf: check-stage$(1)-$(2)-perf-dummy +check-stage$(1)-$(2)-H-$(3)-perf: \ + check-stage$(1)-$(2)-H-$(3)-perf-dummy -check-stage$(1)-$(2)-pretty: check-stage$(1)-$(2)-pretty-rpass \ - check-stage$(1)-$(2)-pretty-rfail \ - check-stage$(1)-$(2)-pretty-bench \ - check-stage$(1)-$(2)-pretty-pretty +check-stage$(1)-$(2)-H-$(3)-pretty: \ + check-stage$(1)-$(2)-H-$(3)-pretty-rpass \ + check-stage$(1)-$(2)-H-$(3)-pretty-rfail \ + check-stage$(1)-$(2)-H-$(3)-pretty-bench \ + check-stage$(1)-$(2)-H-$(3)-pretty-pretty -check-stage$(1)-$(2)-pretty-rpass: check-stage$(1)-$(2)-pretty-rpass-dummy +check-stage$(1)-$(2)-H-$(3)-pretty-rpass: \ + check-stage$(1)-$(2)-H-$(3)-pretty-rpass-dummy -check-stage$(1)-$(2)-pretty-rfail: check-stage$(1)-$(2)-pretty-rfail-dummy +check-stage$(1)-$(2)-H-$(3)-pretty-rfail: \ + check-stage$(1)-$(2)-H-$(3)-pretty-rfail-dummy -check-stage$(1)-$(2)-pretty-bench: check-stage$(1)-$(2)-pretty-bench-dummy - -check-stage$(1)-$(2)-pretty-pretty: check-stage$(1)-$(2)-pretty-pretty-dummy +check-stage$(1)-$(2)-H-$(3)-pretty-bench: \ + check-stage$(1)-$(2)-H-$(3)-pretty-bench-dummy +check-stage$(1)-$(2)-H-$(3)-pretty-pretty: \ + check-stage$(1)-$(2)-H-$(3)-pretty-pretty-dummy # Rules for the standard library test runner -test/stdtest.stage$(1)-$(2)$$(X): $$(STDTEST_CRATE) $$(STDTEST_INPUTS) \ - $$(SREQ$(1)$(2)) +$(3)/test/stdtest.stage$(1)-$(2)$$(X): \ + $$(STDTEST_CRATE) $$(STDTEST_INPUTS) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) @$$(call E, compile_and_link: $$@) $$(STAGE$(1)_$(2)) -o $$@ $$< --test -check-stage$(1)-$(2)-std-dummy: test/stdtest.stage$(1)-$(2)$$(X) +check-stage$(1)-$(2)-H-$(3)-std-dummy: \ + $(3)/test/stdtest.stage$(1)-$(2)$$(X) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_TEST,$$<) $$(TESTARGS) - # Rules for the rustc test runner -test/rustctest.stage$(1)-$(2)$$(X): \ - $$(COMPILER_CRATE) $$(COMPILER_INPUTS) $$(SREQ$(1)$(2)) \ - $$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM) +$(3)/test/rustctest.stage$(1)-$(2)$$(X): \ + $$(COMPILER_CRATE) \ + $$(COMPILER_INPUTS) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(TARGET_LIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) @$$(call E, compile_and_link: $$@) $$(STAGE$(1)_$(2)) -o $$@ $$< --test -check-stage$(1)-$(2)-rustc-dummy: test/rustctest.stage$(1)-$(2)$$(X) +check-stage$(1)-$(2)-H-$(3)-rustc-dummy: \ + $(3)/test/rustctest.stage$(1)-$(2)$$(X) @$$(call E, run: $$<) - $$(Q)$$(call CFG_RUN_TEST,$$<) \ - $$(TESTARGS) - + $$(Q)$$(call CFG_RUN_TEST,$$<) $$(TESTARGS) # Rules for the cfail/rfail/rpass/bench/perf test runner -CTEST_COMMON_ARGS$(1)-$(2) := --compile-lib-path $$(HOST_LIB$(1)) \ - --run-lib-path $$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE)) \ - --rustc-path $$(HOST_BIN$(1))/rustc$$(X) \ - --stage-id stage$(1)-$(2) \ - --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \ - $$(CTEST_TESTARGS) +CTEST_COMMON_ARGS$(1)-$(2)-$(3) := \ + --compile-lib-path $$(HLIB$(1)_H_$(3)) \ + --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \ + --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X) \ + --stage-id stage$(1)-$(2) \ + --rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \ + $$(CTEST_TESTARGS) -CFAIL_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/compile-fail/ \ - --build-base test/compile-fail/ \ - --mode compile-fail +CFAIL_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/compile-fail/ \ + --build-base test/compile-fail/ \ + --mode compile-fail -RFAIL_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/run-fail/ \ - --build-base test/run-fail/ \ - --mode run-fail \ - $$(CTEST_RUNTOOL) +RFAIL_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/run-fail/ \ + --build-base test/run-fail/ \ + --mode run-fail \ + $$(CTEST_RUNTOOL) -RPASS_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/run-pass/ \ - --build-base test/run-pass/ \ - --mode run-pass \ - $$(CTEST_RUNTOOL) +RPASS_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/run-pass/ \ + --build-base test/run-pass/ \ + --mode run-pass \ + $$(CTEST_RUNTOOL) -BENCH_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/bench/ \ - --build-base test/bench/ \ - --mode run-pass \ - $$(CTEST_RUNTOOL) +BENCH_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/bench/ \ + --build-base test/bench/ \ + --mode run-pass \ + $$(CTEST_RUNTOOL) -PERF_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/bench/ \ - --build-base test/perf/ \ - --mode run-pass \ - $$(CTEST_PERF_RUNTOOL) +PERF_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/bench/ \ + --build-base test/perf/ \ + --mode run-pass \ + $$(CTEST_PERF_RUNTOOL) -PRETTY_RPASS_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/run-pass/ \ - --build-base test/run-pass/ \ +PRETTY_RPASS_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/run-pass/ \ + --build-base test/run-pass/ \ --mode pretty -PRETTY_RFAIL_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/run-fail/ \ - --build-base test/run-fail/ \ +PRETTY_RFAIL_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/run-fail/ \ + --build-base test/run-fail/ \ --mode pretty -PRETTY_BENCH_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/bench/ \ - --build-base test/bench/ \ +PRETTY_BENCH_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/bench/ \ + --build-base test/bench/ \ --mode pretty -PRETTY_PRETTY_ARGS$(1)-$(2) := $$(CTEST_COMMON_ARGS$(1)-$(2)) \ - --src-base $$(S)src/test/pretty/ \ - --build-base test/pretty/ \ +PRETTY_PRETTY_ARGS$(1)-$(2)-$(3) := $$(CTEST_COMMON_ARGS$(1)-$(2)-$(3)) \ + --src-base $$(S)src/test/pretty/ \ + --build-base test/pretty/ \ --mode pretty -check-stage$(1)-$(2)-cfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(CFAIL_TESTS) +check-stage$(1)-$(2)-$(3)-cfail-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(CFAIL_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(CFAIL_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-rfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(RFAIL_TESTS) +check-stage$(1)-$(2)-$(3)-rfail-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(RFAIL_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(RFAIL_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-rpass-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(RPASS_TESTS) +check-stage$(1)-$(2)-$(3)-rpass-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(RPASS_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(RPASS_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-bench-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(BENCH_TESTS) +check-stage$(1)-$(2)-$(3)-bench-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(BENCH_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(BENCH_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-perf-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(BENCH_TESTS) +check-stage$(1)-$(2)-$(3)-perf-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(BENCH_TESTS) @$$(call E, perf: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PERF_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-pretty-rpass-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(RPASS_TESTS) +check-stage$(1)-$(2)-$(3)-pretty-rpass-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(RPASS_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_RPASS_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-pretty-rfail-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(RFAIL_TESTS) +check-stage$(1)-$(2)-pretty-rfail-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(RFAIL_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_RFAIL_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-pretty-bench-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(BENCH_TESTS) +check-stage$(1)-$(2)-pretty-bench-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(BENCH_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_BENCH_ARGS$(1)-$(2)) -check-stage$(1)-$(2)-pretty-pretty-dummy: $$(HOST_BIN$(1))/compiletest$$(X) \ - $$(SREQ$(1)$(2)) \ - $$(PRETTY_TESTS) +check-stage$(1)-$(2)-pretty-pretty-dummy: \ + $$(HBIN$(1)_H_$(3))/compiletest$$(X) \ + $$(SREQ$(1)_T_$(2)_H_$(3)) \ + $$(PRETTY_TESTS) @$$(call E, run: $$<) $$(Q)$$(call CFG_RUN_CTEST,$(1),$$<) $$(PRETTY_PRETTY_ARGS$(1)-$(2)) diff --git a/mk/tools.mk b/mk/tools.mk index f0ff2e2407b..b87eb19e885 100644 --- a/mk/tools.mk +++ b/mk/tools.mk @@ -12,39 +12,39 @@ COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs) # have tools that need to built for other targets. define TOOLS_STAGE_N -$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X): \ - $$(FUZZER_CRATE) $$(FUZZER_INPUTS) \ - $$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \ - $$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) \ - $$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_LIBRUSTC) +$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X): \ + $$(FUZZER_CRATE) $$(FUZZER_INPUTS) \ + $$(TSREQ$(1)_T_$(4)_H_$(3)) \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC) @$$(call E, compile_and_link: $$@) - $$(STAGE$(1)_$$(CFG_HOST_TRIPLE)) -o $$@ $$< + $$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< # Promote the stageN target to stageN+1 host # FIXME: Shouldn't need to depend on host/librustc.so once # rpath is working -$$(HOST_BIN$(2))/fuzzer$$(X): \ - $$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X) \ - $$(HOST_LIB$(2))/$$(CFG_LIBRUSTC) \ - $$(HOST_SREQ$(2)) +$$(HBIN$(2)_H_$(4))/fuzzer$$(X): \ + $$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X) \ + $$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC) \ + $$(HSREQ$(2)_H_$(4)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ -$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X): \ - $$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \ - $$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \ - $$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) +$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X): \ + $$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \ + $$(TSREQ$(1)_T_$(4)_H_$(3)) \ + $$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) @$$(call E, compile_and_link: $$@) - $$(STAGE$(1)_$$(CFG_HOST_TRIPLE)) -o $$@ $$< + $$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< -$$(HOST_BIN$(2))/compiletest$$(X): \ - $$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X) \ - $$(HOST_SREQ$(2)) +$$(HBIN$(2)_H_$(4))/compiletest$$(X): \ + $$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X) \ + $$(HSREQ$(2)_$(4)) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ endef -$(eval $(call TOOLS_STAGE_N,0,1)) -$(eval $(call TOOLS_STAGE_N,1,2)) -$(eval $(call TOOLS_STAGE_N,2,3)) +$(eval $(call TOOLS_STAGE_N,0,1,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) +$(eval $(call TOOLS_STAGE_N,1,2,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) +$(eval $(call TOOLS_STAGE_N,2,3,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py index 98e480defda..5c0dec8eb41 100755 --- a/src/etc/get-snapshot.py +++ b/src/etc/get-snapshot.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import os, tarfile, hashlib, re, shutil +import os, tarfile, hashlib, re, shutil, sys from snapshot import * @@ -11,7 +11,8 @@ def unpack_snapshot(snap): kernel = get_kernel() for name in snapshot_files[kernel]: p = "rust-stage0/" + name - fp = os.path.join("stage0", name) + stagep = os.path.join(triple, "stage0") + fp = os.path.join(stagep, name) print("extracting " + fp) tar.extract(p, download_unpack_base) tp = os.path.join(download_unpack_base, p) @@ -57,6 +58,7 @@ def determine_curr_snapshot_for_platform(): # Main +triple = sys.argv[1] snap = determine_curr_snapshot_for_platform() dl = os.path.join(download_dir_base, snap) url = download_url_base + "/" + snap