]> git.baikalelectronics.ru Git - kernel.git/commit
Makefile: Fix detection of clang when cross-compiling
authorPaul Cercueil <paul@crapouillou.net>
Fri, 17 Apr 2015 21:35:04 +0000 (23:35 +0200)
committerMichal Marek <mmarek@suse.cz>
Mon, 27 Apr 2015 12:21:10 +0000 (14:21 +0200)
commit25f31f6a164aaa1a1ada8b8777c0c01e61bac2bb
tree75fcc453aaac8d5c752c0be269dc917938cd6854
parentdd4a0ac5a66093ba1477238fa2d0e835dd935ff6
Makefile: Fix detection of clang when cross-compiling

When the host's C compiler is clang, and when attempting to
cross-compile Linux e.g. to MIPS with mipsel-linux-gcc, the Makefile
would incorrectly detect the use of clang, which resulted in
clang-specific flags being passed to mipsel-linux-gcc.

This can be verified under Debian by installing the "clang" package,
and then using it as the default compiler with:
sudo update-alternatives --config cc

This patch moves the detection of clang after the $(CC) variable is
initialized to the name of the cross-compiler, so that the check applies
to the cross-compiler and not the host's C compiler.

v2: Move the detection of clang after the inclusion of the
arch/*/Makefile (as they might set $(CROSS_COMPILE))

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Makefile