@@ -37,10 +37,7 @@ CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
3737 $$(foreach dep,$$(NATIVE_DEPS_$(4 ) ) , \
3838 $$(RT_OUTPUT_DIR_$(2 ) ) /$$(call CFG_STATIC_LIB_NAME_$(2 ) ,$$(dep ) ) ) \
3939 $$(foreach dep,$$(NATIVE_DEPS_$(4 ) _T_$(2 ) ) , \
40- $$(RT_OUTPUT_DIR_$(2 ) ) /$$(dep ) ) \
41- $$(foreach dep,$$(NATIVE_TOOL_DEPS_$(4 ) _T_$(2 ) ) , \
42- $$(TBIN$(1 ) _T_$(3 ) _H_$(3 ) ) /$$(dep ) ) \
43- $$(CUSTOM_DEPS$(1 ) _$(4 ) _T_$(2 ) )
40+ $$(RT_OUTPUT_DIR_$(2 ) ) /$$(dep ) )
4441endef
4542
4643$(foreach host,$(CFG_HOST), \
@@ -142,21 +139,13 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
142139
143140define TARGET_HOST_RULES
144141
145- $$(TBIN$(1 ) _T_$(2 ) _H_$(3 ) ) /:
146- mkdir -p $$@
147-
148142$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /:
149143 mkdir -p $$@
150144
151145$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /%: $$(RT_OUTPUT_DIR_$(2 ) ) /% \
152146 | $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) / $$(SNAPSHOT_RUSTC_POST_CLEANUP )
153147 @$$(call E, cp: $$@ )
154148 $$(Q ) cp $$< $$@
155-
156- $$(TBIN$(1 ) _T_$(2 ) _H_$(3 ) ) /%: $$(CFG_LLVM_INST_DIR_$(2 ) ) /bin/% \
157- | $$(TBIN$(1 ) _T_$(2 ) _H_$(3 ) ) / $$(SNAPSHOT_RUSTC_POST_CLEANUP )
158- @$$(call E, cp: $$@ )
159- $$(Q ) cp $$< $$@
160149endef
161150
162151$(foreach source,$(CFG_HOST), \
@@ -180,83 +169,3 @@ $(foreach host,$(CFG_HOST), \
180169 $(foreach stage,$(STAGES), \
181170 $(foreach tool,$(TOOLS), \
182171 $(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))
183-
184- # We have some triples which are bootstrapped from other triples, and this means
185- # that we need to fixup some of the native tools that a triple depends on.
186- #
187- # For example, MSVC requires the llvm-ar.exe executable to manage archives, but
188- # it bootstraps from the GNU Windows triple. This means that the compiler will
189- # add this directory to PATH when executing new processes:
190- #
191- # $SYSROOT/rustlib/x86_64-pc-windows-gnu/bin
192- #
193- # Unfortunately, however, the GNU triple is not known about in stage0, so the
194- # tools are actually located in:
195- #
196- # $SYSROOT/rustlib/x86_64-pc-windows-msvc/bin
197- #
198- # To remedy this problem, the rules below copy all native tool dependencies into
199- # the bootstrap triple's location in stage 0 so the bootstrap compiler can find
200- # the right sets of tools. Later stages (1+) will have the right host triple for
201- # the compiler, so there's no need to worry there.
202- #
203- # $(1) - stage
204- # $(2) - triple that's being used as host/target
205- # $(3) - triple snapshot is built for
206- # $(4) - crate
207- # $(5) - tool
208- #
209- # FIXME(stage0): remove this and all other relevant support in the makefiles
210- # after a snapshot is made
211- define MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR
212- ifneq (,$(3 ) )
213- $$(TLIB$(1 ) _T_$(2 ) _H_$(2 ) ) /stamp.$(4 ) : $$(HLIB$(1 ) _H_$(2 ) ) /rustlib/$(3 ) /bin/$(5 )
214-
215- $$(HLIB$(1 ) _H_$(2 ) ) /rustlib/$(3 ) /bin/$(5 ) : $$(TBIN$(1 ) _T_$(2 ) _H_$(2 ) ) /$(5 )
216- mkdir -p $$(@D )
217- cp $$< $$@
218- endif
219- endef
220-
221- $(foreach target,$(CFG_TARGET), \
222- $(foreach crate,$(CRATES), \
223- $(foreach tool,$(NATIVE_TOOL_DEPS_$(crate)_T_$(target)), \
224- $(eval $(call MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR,0,$(target),$(BOOTSTRAP_FROM_$(target)),$(crate),$(tool))))))
225-
226- # For MSVC targets we need to set up some environment variables for the linker
227- # to work correctly when building Rust crates. These two variables are:
228- #
229- # - LIB tells the linker the default search path for finding system libraries,
230- # for example kernel32.dll
231- # - PATH needs to be modified to ensure that MSVC's link.exe is first in the
232- # path instead of MinGW's /usr/bin/link.exe (entirely unrelated)
233- #
234- # The values for these variables are detected by the configure script.
235- #
236- # FIXME(stage0): remove this and all other relevant support in the makefiles
237- # after a snapshot is made
238- define SETUP_LIB_MSVC_ENV_VARS
239- ifeq ($$(findstring msvc,$(2 ) ) ,msvc)
240- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$(4 ) : \
241- export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2 ) ) )
242- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$(4 ) : \
243- export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2 ) ) ) :$$(PATH )
244- endif
245- endef
246- define SETUP_TOOL_MSVC_ENV_VARS
247- ifeq ($$(findstring msvc,$(2 ) ) ,msvc)
248- $$(TBIN$(1 ) _T_$(2 ) _H_$(3 ) ) /$(4 )$$(X_$(2 ) ) : \
249- export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2 ) ) )
250- $$(TBIN$(1 ) _T_$(2 ) _H_$(3 ) ) /$(4 )$$(X_$(2 ) ) : \
251- export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2 ) ) ) :$$(PATH )
252- endif
253- endef
254-
255- $(foreach host,$(CFG_HOST), \
256- $(foreach target,$(CFG_TARGET), \
257- $(foreach crate,$(CRATES), \
258- $(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
259- $(foreach host,$(CFG_HOST), \
260- $(foreach target,$(CFG_TARGET), \
261- $(foreach tool,$(TOOLS), \
262- $(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))
0 commit comments