From 9ee32ad958ba2b6596396eded3ccf060e18f41ba Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Mon, 13 Aug 2018 22:21:32 +0100 Subject: [PATCH] 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 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: # @DESCRIPTION: -- 2.26.2