From b53587b72a3b2749cde347c60050a9258a86ba5f Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Fri, 19 Oct 2007 21:46:01 +0200 Subject: [PATCH] --- yaml --- r: 71663 b: refs/heads/master c: 910b40468a9ce3f2f5d48c5d260329c27d45adb5 h: refs/heads/master i: 71661: e0a08bd475b67bf6260513716255d54fc40b3478 71659: 398902df0f1408bf3c48fed0583948df7ed9a933 71655: 03f66a9e0b843ace99e730f69ebd0065dd2fbaa8 71647: df8799facd02f2135bce3e409d545362ffe0064b v: v3 --- [refs] | 2 +- trunk/Documentation/kbuild/makefiles.txt | 22 ++++++++++++++++++++++ trunk/scripts/Kbuild.include | 11 +++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 488a609c90f0..2dbf630583be 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 50a8ec31c3a00594ceb7c5f1dcf2ecdaf6a5b847 +refs/heads/master: 910b40468a9ce3f2f5d48c5d260329c27d45adb5 diff --git a/trunk/Documentation/kbuild/makefiles.txt b/trunk/Documentation/kbuild/makefiles.txt index f099b814d383..6166e2d7da76 100644 --- a/trunk/Documentation/kbuild/makefiles.txt +++ b/trunk/Documentation/kbuild/makefiles.txt @@ -518,6 +518,28 @@ more details, with real examples. In this example for a specific GCC version the build will error out explaining to the user why it stops. + cc-cross-prefix + cc-cross-prefix is used to check if there exist a $(CC) in path with + one of the listed prefixes. The first prefix where there exist a + prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found + then nothing is returned. + Additional prefixes are separated by a single space in the + call of cc-cross-prefix. + This functionality is usefull for architecture Makefile that try + to set CROSS_COMPILE to well know values but may have several + values to select between. + It is recommended only to try to set CROSS_COMPILE is it is a cross + build (host arch is different from target arch). And is CROSS_COMPILE + is already set then leave it with the old value. + + Example: + #arch/m68k/Makefile + ifneq ($(SUBARCH),$(ARCH)) + ifeq ($(CROSS_COMPILE),) + CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-) + endif + endif + === 4 Host Program support Kbuild supports building executables on the host for use during the diff --git a/trunk/scripts/Kbuild.include b/trunk/scripts/Kbuild.include index de7bb284c611..b96ea8d6a5ed 100644 --- a/trunk/scripts/Kbuild.include +++ b/trunk/scripts/Kbuild.include @@ -56,6 +56,17 @@ endef # gcc support functions # See documentation in Documentation/kbuild/makefiles.txt +# cc-cross-prefix +# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) +# Return first prefix where a prefix$(CC) is found in PATH. +# If no $(CC) found in PATH with listed prefixes return nothing +cc-cross-prefix = \ + $(word 1, $(foreach c,$(1), \ + $(shell set -e; \ + if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ + echo $(c); \ + fi))) + # output directory for tests below TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)