Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev@l.g.o
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [arm17] [PATCH 1/3] toolchain-funcs.eclass: New tc-getTARGET_CPP function
Date: Tue, 14 Aug 2018 20:34:04
Message-Id: 20180814203304.27305-2-chewi@gentoo.org
In Reply to: [gentoo-dev] [arm17] [PATCH 0/3] toolchain-funcs.eclass: tc-is-softfloat for ARM and associated functions by James Le Cuirot
1 This returns the name of the C preprocessor for the toolchain being
2 built if CTARGET is defined, or the toolchain being used otherwise. It
3 is primarily intended to determine characteristics about an existing
4 toolchain's target as these may differ from what the tuple suggests.
5
6 It is not necessary to add the full set of tc-getTARGET_* helper
7 functions as this is probably the only reason we would ever invoke a
8 toolchain in the context of CTARGET.
9 ---
10 eclass/toolchain-funcs.eclass | 11 +++++++++++
11 1 file changed, 11 insertions(+)
12
13 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
14 index cea8949b45d7..fbd1a8d5e2bf 100644
15 --- a/eclass/toolchain-funcs.eclass
16 +++ b/eclass/toolchain-funcs.eclass
17 @@ -167,6 +167,17 @@ tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; }
18 # @RETURN: name of the pkg-config tool for building binaries to run on the build machine
19 tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; }
20
21 +# @FUNCTION: tc-getTARGET_CPP
22 +# @USAGE: [toolchain prefix]
23 +# @RETURN: name of the C preprocessor for the toolchain being built (or used)
24 +tc-getTARGET_CPP() {
25 + if [[ -n ${CTARGET} ]]; then
26 + _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@"
27 + else
28 + tc-getCPP "$@"
29 + fi
30 +}
31 +
32 # @FUNCTION: tc-export
33 # @USAGE: <list of toolchain variables>
34 # @DESCRIPTION:
35 --
36 2.17.0