]> git.lizzy.rs Git - rust.git/commitdiff
mk: Pass exact compile to rustc on cross compiles
authorAlex Crichton <alex@alexcrichton.com>
Sat, 19 Apr 2014 20:18:25 +0000 (13:18 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 19 Apr 2014 20:18:25 +0000 (13:18 -0700)
Instead of passing through CC which may have things like ccache and other
arguments (when using clang) this commit filters out the necessary arguments
from CC to pass the right linker to rustc.

Closes #13562

mk/platform.mk

index cf6178ec5b0432f9b02186ced9e5c449c0d86b02..56864f585f2fe6ad58e338b8a5718302dd49d454 100644 (file)
@@ -542,6 +542,8 @@ ifdef CFG_CCACHE_BASEDIR
   export CCACHE_BASEDIR
 endif
 
+FIND_COMPILER = $(word 1,$(1:ccache=))
+
 define CFG_MAKE_TOOLCHAIN
   # Prepend the tools with their prefix if cross compiling
   ifneq ($(CFG_BUILD),$(1))
@@ -549,7 +551,8 @@ define CFG_MAKE_TOOLCHAIN
        CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
        CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
        AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
-       RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(CXX_$(1)) -C ar=$$(AR_$(1)) $(RUSTC_CROSS_FLAGS_$(1))
+       RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CXX_$(1))) \
+           -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
 
        RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
   endif