summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2018-08-13 22:21:32 +0100
committerJames Le Cuirot <chewi@gentoo.org>2018-08-21 21:37:25 +0100
commit9ee32ad958ba2b6596396eded3ccf060e18f41ba (patch)
treef7d940b3b7cc619e39dad17bb5bcd7b55211f014 /eclass
parentdev-util/shellcheck: require quickcheck[template_haskell] (diff)
downloadgentoo-9ee32ad958ba2b6596396eded3ccf060e18f41ba.tar.gz
gentoo-9ee32ad958ba2b6596396eded3ccf060e18f41ba.tar.bz2
gentoo-9ee32ad958ba2b6596396eded3ccf060e18f41ba.zip
toolchain-funcs.eclass: New tc-getTARGET_CPP function
This returns the name of the C preprocessor for the toolchain being built if CTARGET is defined, or the toolchain being used otherwise. It is primarily intended to determine characteristics about an existing toolchain's target as these may differ from what the tuple suggests. It is not necessary to add the full set of tc-getTARGET_* helper functions as this is probably the only reason we would ever invoke a toolchain in the context of CTARGET.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass11
1 files changed, 11 insertions, 0 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index cea8949b45d7..fbd1a8d5e2bf 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -167,6 +167,17 @@ tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; }
# @RETURN: name of the pkg-config tool for building binaries to run on the build machine
tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; }
+# @FUNCTION: tc-getTARGET_CPP
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C preprocessor for the toolchain being built (or used)
+tc-getTARGET_CPP() {
+ if [[ -n ${CTARGET} ]]; then
+ _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@"
+ else
+ tc-getCPP "$@"
+ fi
+}
+
# @FUNCTION: tc-export
# @USAGE: <list of toolchain variables>
# @DESCRIPTION: