]> git.lizzy.rs Git - rust.git/blobdiff - mk/target.mk
Auto merge of #28455 - nrc:span-bang, r=alexcrichton
[rust.git] / mk / target.mk
index 63ce003c810ddc715e99ce9d7130b29548aa9824..d6fa55bf7f51661429b997992350324cc6f9f586 100644 (file)
 # this exists can be found on issue #2400
 export CFG_COMPILER_HOST_TRIPLE
 
+# Used as defaults for the runtime ar and cc tools
+export CFG_DEFAULT_LINKER
+export CFG_DEFAULT_AR
+
 # The standard libraries should be held up to a higher standard than any old
 # code, make sure that these common warnings are denied by default. These can
 # be overridden during development temporarily. For stage0, we allow warnings
@@ -37,10 +41,7 @@ CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
                $$(foreach dep,$$(NATIVE_DEPS_$(4)), \
                  $$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
                $$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
-                 $$(RT_OUTPUT_DIR_$(2))/$$(dep)) \
-               $$(foreach dep,$$(NATIVE_TOOL_DEPS_$(4)_T_$(2)), \
-                 $$(TBIN$(1)_T_$(3)_H_$(3))/$$(dep)) \
-               $$(CUSTOM_DEPS$(1)_$(4)_T_$(2))
+                 $$(RT_OUTPUT_DIR_$(2))/$$(dep))
 endef
 
 $(foreach host,$(CFG_HOST), \
@@ -92,6 +93,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
                $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
                $$(LLVM_STDCPP_RUSTFLAGS_$(2)) \
                $$(RUSTFLAGS_$(4)) \
+               $$(RUSTFLAGS$(1)_$(4)) \
                $$(RUSTFLAGS$(1)_$(4)_T_$(2)) \
                --out-dir $$(@D) \
                -C extra-filename=-$$(CFG_FILENAME_EXTRA) \
@@ -142,9 +144,6 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
 
 define TARGET_HOST_RULES
 
-$$(TBIN$(1)_T_$(2)_H_$(3))/:
-       mkdir -p $$@
-
 $$(TLIB$(1)_T_$(2)_H_$(3))/:
        mkdir -p $$@
 
@@ -152,11 +151,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
            | $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
        @$$(call E, cp: $$@)
        $$(Q)cp $$< $$@
-
-$$(TBIN$(1)_T_$(2)_H_$(3))/%: $$(CFG_LLVM_INST_DIR_$(2))/bin/% \
-           | $$(TBIN$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
-       @$$(call E, cp: $$@)
-       $$(Q)cp $$< $$@
 endef
 
 $(foreach source,$(CFG_HOST), \
@@ -180,83 +174,3 @@ $(foreach host,$(CFG_HOST), \
   $(foreach stage,$(STAGES), \
    $(foreach tool,$(TOOLS), \
     $(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))
-
-# We have some triples which are bootstrapped from other triples, and this means
-# that we need to fixup some of the native tools that a triple depends on.
-#
-# For example, MSVC requires the llvm-ar.exe executable to manage archives, but
-# it bootstraps from the GNU Windows triple. This means that the compiler will
-# add this directory to PATH when executing new processes:
-#
-#      $SYSROOT/rustlib/x86_64-pc-windows-gnu/bin
-#
-# Unfortunately, however, the GNU triple is not known about in stage0, so the
-# tools are actually located in:
-#
-#      $SYSROOT/rustlib/x86_64-pc-windows-msvc/bin
-#
-# To remedy this problem, the rules below copy all native tool dependencies into
-# the bootstrap triple's location in stage 0 so the bootstrap compiler can find
-# the right sets of tools. Later stages (1+) will have the right host triple for
-# the compiler, so there's no need to worry there.
-#
-# $(1) - stage
-# $(2) - triple that's being used as host/target
-# $(3) - triple snapshot is built for
-# $(4) - crate
-# $(5) - tool
-#
-# FIXME(stage0): remove this and all other relevant support in the makefiles
-#                after a snapshot is made
-define MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR
-ifneq (,$(3))
-$$(TLIB$(1)_T_$(2)_H_$(2))/stamp.$(4): $$(HLIB$(1)_H_$(2))/rustlib/$(3)/bin/$(5)
-
-$$(HLIB$(1)_H_$(2))/rustlib/$(3)/bin/$(5): $$(TBIN$(1)_T_$(2)_H_$(2))/$(5)
-       mkdir -p $$(@D)
-       cp $$< $$@
-endif
-endef
-
-$(foreach target,$(CFG_TARGET), \
- $(foreach crate,$(CRATES), \
-  $(foreach tool,$(NATIVE_TOOL_DEPS_$(crate)_T_$(target)), \
-   $(eval $(call MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR,0,$(target),$(BOOTSTRAP_FROM_$(target)),$(crate),$(tool))))))
-
-# For MSVC targets we need to set up some environment variables for the linker
-# to work correctly when building Rust crates. These two variables are:
-#
-# - LIB tells the linker the default search path for finding system libraries,
-#   for example kernel32.dll
-# - PATH needs to be modified to ensure that MSVC's link.exe is first in the
-#   path instead of MinGW's /usr/bin/link.exe (entirely unrelated)
-#
-# The values for these variables are detected by the configure script.
-#
-# FIXME(stage0): remove this and all other relevant support in the makefiles
-#                after a snapshot is made
-define SETUP_LIB_MSVC_ENV_VARS
-ifeq ($$(findstring msvc,$(2)),msvc)
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
-       export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
-$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
-       export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
-endif
-endef
-define SETUP_TOOL_MSVC_ENV_VARS
-ifeq ($$(findstring msvc,$(2)),msvc)
-$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
-       export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
-$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
-       export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
-endif
-endef
-
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach crate,$(CRATES), \
-   $(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
-$(foreach host,$(CFG_HOST), \
- $(foreach target,$(CFG_TARGET), \
-  $(foreach tool,$(TOOLS), \
-   $(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))