commit:     9ee32ad958ba2b6596396eded3ccf060e18f41ba
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 13 21:21:32 2018 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Aug 21 20:37:25 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ee32ad9

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.

 eclass/toolchain-funcs.eclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index cea8949b45d..fbd1a8d5e2b 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:

Reply via email to