History

kbuild: introduce cc-cross-prefix

cc-cross-prefix is useful for the architecture that like to provide a default CROSS_COMPILE value, but may have several to select between. Sample usage: ifneq ($(SUBARCH),$(ARCH)) ifeq ($(CROSS_COMPILE),) CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) endif endif Actual usage by the different archs will taken care of later.

Sam Ravnborg committed 19 years ago

Commit 910b4041 parent 50a8ec32 files · +33 −0Browse files

Showing the changes to scripts (1 of 2 files). Show all

Unified · Split

scripts/Kbuild.include+11−0
@@ -56,6 +56,17 @@ endef · 55 unmodified lines
5656 # gcc support functions
5757 # See documentation in Documentation/kbuild/makefiles.txt
5858
59+# cc-cross-prefix
60+# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
61+# Return first prefix where a prefix$(CC) is found in PATH.
62+# If no $(CC) found in PATH with listed prefixes return nothing
63+cc-cross-prefix = \
64+ $(word 1, $(foreach c,$(1), \
65+ $(shell set -e; \
66+ if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
67+ echo $(c); \
68+ fi)))
69+
5970 # output directory for tests below
6071 TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
6172