ARC: build: Try to guess CROSS_COMPILE with cc-cross-prefix
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>
Mon, 3 Jun 2019 06:31:19 +0000 (09:31 +0300)
committerVineet Gupta <vgupta@synopsys.com>
Tue, 11 Jun 2019 18:48:34 +0000 (11:48 -0700)
commit2bc42bfba9b247abd93991195b71f35a484531d1
tree5097d776c50a56a91571b6e8e2fb41c32aeea3a8
parentd1fdb6d8f6a4109a4263176c84b899076a5f8008
ARC: build: Try to guess CROSS_COMPILE with cc-cross-prefix

For a long time we used to hard-code CROSS_COMPILE prefix
for ARC until it started to cause problems, so we decided to
solely rely on CROSS_COMPILE externally set by a user:
commit 40660f1fcee8 ("ARC: build: Don't set CROSS_COMPILE in arch's Makefile").

While it works perfectly fine for build-systems where the prefix
gets defined anyways for us human beings it's quite an annoying
requirement especially given most of time the same one prefix
"arc-linux-" is all what we need.

It looks like finally we're getting the best of both worlds:
 1. W/o cross-toolchain we still may install headers, build .dtb etc
 2. W/ cross-toolchain get the kerne built with only ARCH=arc

Inspired by [1] & [2].

[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17

A side note: even though "cc-cross-prefix" does its job it pollutes
console with output of "which" for all the prefixes it didn't manage to find
a matching cross-compiler for like that:
| # ARCH=arc make defconfig
| which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin)
| *** Default configuration is based on 'nsim_hs_defconfig'

Suggested-by: Vineet Gupta <vgupta@synopsys.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/Makefile