Skip to content

Commit

Permalink
Change logic for "what is cross toolchain"
Browse files Browse the repository at this point in the history
Try to detect a cross-compiler based on if $CC contains "-".  Notably,
"cc" might still be a cross-compiler in the strictest sense of the
word if we're e.g. building rumprun.  Here, the driving logic is to
make locating the rest of the toolchain easy without the user having
specify everything.  For example, if CC=cc is given, then it's a good
bet that NM=nm.  Likewise, if CC=foo-bar-cc is given, then it's a good
bet that NM=foo-bar-nm.
  • Loading branch information
anttikantee committed Jun 18, 2015
1 parent 7bbbbbb commit c33edc5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion buildrump.sh
Expand Up @@ -911,9 +911,22 @@ evaltoolchain ()
fi
MACH_ARCH=$(echo ${CC_TARGET} | sed 's/-.*//' )

#
# Try to figure out if we're using the native toolchain or
# a cross one. Assume that a native cc doesn't have '-'
# in its name. We use this information in the step below
# where we guess toolchain defaults.
#
basecc="$(basename ${CC})"
if [ "${basecc}" = "${basecc#*-}" ]; then
crosstools=false
else
crosstools=true
fi

# Set names of tools we're going to use. try to guess them
# for common scenarios
if ${NATIVEBUILD} || ${KERNONLY}; then
if ${NATIVEBUILD} || ! ${crosstools}; then
: ${AR:=ar}
: ${NM:=nm}
: ${OBJCOPY:=objcopy}
Expand Down

0 comments on commit c33edc5

Please sign in to comment.