summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-08-21 14:07:05 -0700
committerKhem Raj <raj.khem@gmail.com>2015-08-21 14:07:05 -0700
commit1b0f5de3b3137509a7c60d372c5e58782144ac57 (patch)
tree4c50d5c024fe0f5ac690d522da16fe6a8280318a /classes
parent94749d600c974c773800192687cb284a8c35b483 (diff)
downloadmeta-clang-1b0f5de3b3137509a7c60d372c5e58782144ac57.tar.gz
clang/classes: Invert the logic to select toolchain and default to clang
So far we have been selecting which packages are compiled using clang this patch changes the logic to use clang by default unless selecting TOOLCHAIN = "gcc" explicitly in the recipe We have not yet enabled clang for native recipes, its only enabled for target recipes needing cross compilation as of now. Get rid of configuration file and move the code to clang.bbclass, simplifies the logic If needed to select gcc to be default system compiler set TOOLCHAIN = "gcc" in local.conf Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'classes')
-rw-r--r--classes/clang.bbclass43
1 files changed, 37 insertions, 6 deletions
diff --git a/classes/clang.bbclass b/classes/clang.bbclass
index f6cb648..b560289 100644
--- a/classes/clang.bbclass
+++ b/classes/clang.bbclass
@@ -1,10 +1,41 @@
1
2# Add the necessary override 1# Add the necessary override
3TOOLCHAINOVERRIDES = ":toolchain-${TOOLCHAIN}" 2CC_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
4TOOLCHAINOVERRIDES[vardepsexclude] = "TOOLCHAIN" 3CXX_toolchain-clang = "${TARGET_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
4CPP_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E"
5CCLD_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
6THUMB_TUNE_CCARGS_remove_toolchain-clang = "-mthumb-interwork"
7TUNE_CCARGS_append_toolchain-clang = " -D__extern_always_inline=inline -no-integrated-as"
8
9TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
10TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2"
11
12# choose between 'gcc' 'clang' an empty '' can be used as well
13TOOLCHAIN ??= "clang"
14
15TOOLCHAIN_class-native = "gcc"
16
17OVERRIDES .= "${@['', ':toolchain-${TOOLCHAIN}']['${TOOLCHAIN}' != '']}"
18OVERRIDES[vardepsexclude] += "TOOLCHAIN"
19
20#DEPENDS_append_toolchain-clang_class-target = " clang-cross-${TARGET_ARCH} "
21#DEPENDS_remove_toolchain-clang_allarch = "clang-cross-${TARGET_ARCH}"
22
23def clang_dep_prepend(d):
24 #
25 # Ideally this will check a flag so we will operate properly in
26 # the case where host == build == target, for now we don't work in
27 # that case though.
28 #
5 29
6OVERRIDES .= "${TOOLCHAINOVERRIDES}" 30 deps = ""
7OVERRIDES[vardepsexclude] += "TOOLCHAINOVERRIDES" 31 # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
32 # we need that built is the responsibility of the patch function / class, not
33 # the application.
34 if not d.getVar('INHIBIT_DEFAULT_DEPS', False):
35 if not oe.utils.inherits(d, 'allarch'):
36 deps += " clang-cross-${TARGET_ARCH} "
37 return deps
8 38
9require conf/clang.conf 39CLANGDEPENDS = "${@clang_dep_prepend(d)}"
10 40
41DEPENDS_prepend_toolchain-clang_class-target = "${CLANGDEPENDS} "