1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
|
#!/bin/sh
# $Id: env.sh 3295 2019-01-10 16:35:56Z bird $
## @file
# Environment setup script.
#
#
# Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
#
# This file is part of kBuild.
#
# kBuild is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# kBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kBuild; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
#set -x
#
# Check if we're in eval mode or not.
#
ERR_REDIR=1
DBG_REDIR=1
EVAL_OPT=
EVAL_EXPORT="export "
DBG_OPT=
QUIET_OPT=
FULL_OPT=
FULL_WITH_BIN_OPT=
LEGACY_OPT=
VAR_OPT=
VALUE_ONLY_OPT=
EXP_TYPE_OPT=
while test $# -gt 0;
do
case "$1" in
"--debug-script")
DBG_OPT="true"
;;
"--no-debug-script")
DBG_OPT=
;;
"--quiet")
QUIET_OPT="true"
;;
"--verbose")
QUIET_OPT=
;;
"--full")
FULL_OPT="true"
;;
"--full-with-bin")
FULL_OPT="true"
FULL_WITH_BIN_OPT="true"
;;
"--normal")
FULL_OPT=
;;
"--legacy")
LEGACY_OPT="true"
;;
"--no-legacy")
LEGACY_OPT=
;;
"--eval")
EVAL_OPT="true"
ERR_REDIR=2
DBG_REDIR=2
;;
"--set")
EVAL_OPT="true"
EVAL_EXPORT=""
ERR_REDIR=2
DBG_REDIR=2
;;
"--var")
shift
VAR_OPT="${VAR_OPT} $1"
ERR_REDIR=2
DBG_REDIR=2
;;
"--value-only")
VALUE_ONLY_OPT="true"
;;
"--name-and-value")
VALUE_ONLY_OPT=
;;
"--release")
EXP_TYPE_OPT=1
KBUILD_TYPE=release
BUILD_TYPE=
;;
"--debug")
EXP_TYPE_OPT=1
KBUILD_TYPE=debug
BUILD_TYPE=
;;
"--profile")
EXP_TYPE_OPT=1
KBUILD_TYPE=profile
BUILD_TYPE=
;;
"--help")
echo "kBuild Environment Setup Script, v0.2.0-pre"
echo ""
echo "syntax: $0 [options] [command [args]]"
echo " or: $0 [options] --var <varname>"
echo " or: $0 [options] --eval"
echo " or: $0 [options] --eval --var <varname>"
echo ""
echo "The first form will execute the command, or if no command is given start"
echo "an interactive shell."
echo "The second form will print the specfified variable(s)."
echo "The third form will print all exported variables suitable for bourne shell"
echo "evaluation."
echo "The forth form will only print the specified variable(s)."
echo ""
echo "Options:"
echo " --debug, --release, --profile"
echo " Alternative way of specifying KBUILD_TYPE."
echo " --debug-script, --no-debug-script"
echo " Controls debug output. Default: --no-debug-script"
echo " --quiet, --verbose"
echo " Controls informational output. Default: --verbose"
echo " --full, --full-with-bin, --normal"
echo " Controls the variable set. Default: --normal"
echo " --legacy, --no-legacy"
echo " Include legacy variables in result. Default: --no-legacy"
echo " --value-only, --name-and-value"
echo " Controls what the result of a --var query. Default: --name-and-value"
echo " --set, --export"
echo " Whether --eval explicitly export the variables. --set is useful for"
echo " getting a list of environment vars for a commandline, while --eval"
echo ' is useful for eval `env.sh`. Default: --export'
echo ""
exit 1
;;
*)
break
;;
esac
shift
done
#
# Deal with legacy environment variables.
#
if test -n "$PATH_KBUILD"; then
if test -n "$KBUILD_PATH" -a "$KBUILD_PATH" != "$PATH_KBUILD"; then
echo "$0: error: KBUILD_PATH ($KBUILD_PATH) and PATH_KBUILD ($PATH_KBUILD) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_PATH=$PATH_KBUILD
fi
if test -n "$PATH_KBUILD_BIN"; then
if test -n "$KBUILD_BIN_PATH" -a "$KBUILD_BIN_PATH" != "$PATH_KBUILD_BIN"; then
echo "$0: error: KBUILD_BIN_PATH ($KBUILD_BIN_PATH) and PATH_KBUILD_BIN ($PATH_KBUILD_BIN) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_BIN_PATH=$PATH_KBUILD_BIN
fi
if test -n "$BUILD_TYPE"; then
if test -n "$KBUILD_TYPE" -a "$KBUILD_TYPE" != "$BUILD_TYPE"; then
echo "$0: error: KBUILD_TYPE ($KBUILD_TYPE) and BUILD_TYPE ($BUILD_TYPE) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_TYPE=$BUILD_TYPE
fi
if test -n "$BUILD_PLATFORM"; then
if test -n "$KBUILD_HOST" -a "$KBUILD_HOST" != "$BUILD_PLATFORM"; then
echo "$0: error: KBUILD_HOST ($KBUILD_HOST) and BUILD_PLATFORM ($BUILD_PLATFORM) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_HOST=$BUILD_PLATFORM
fi
if test -n "$BUILD_PLATFORM_ARCH"; then
if test -n "$KBUILD_HOST_ARCH" -a "$KBUILD_HOST_ARCH" != "$BUILD_PLATFORM_ARCH"; then
echo "$0: error: KBUILD_HOST_ARCH ($KBUILD_HOST_ARCH) and BUILD_PLATFORM_ARCH ($BUILD_PLATFORM_ARCH) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_HOST_ARCH=$BUILD_PLATFORM_ARCH
fi
if test -n "$BUILD_PLATFORM_CPU"; then
if test -n "$KBUILD_HOST_CPU" -a "$KBUILD_HOST_CPU" != "$BUILD_PLATFORM_CPU"; then
echo "$0: error: KBUILD_HOST_CPU ($KBUILD_HOST_CPU) and BUILD_PLATFORM_CPU ($BUILD_PLATFORM_CPU) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_HOST_CPU=$BUILD_PLATFORM_CPU
fi
if test -n "$BUILD_TARGET"; then
if test -n "$KBUILD_TARGET" -a "$KBUILD_TARGET" != "$BUILD_TARGET"; then
echo "$0: error: KBUILD_TARGET ($KBUILD_TARGET) and BUILD_TARGET ($BUILD_TARGET) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_TARGET=$BUILD_TARGET
fi
if test -n "$BUILD_TARGET_ARCH"; then
if test -n "$KBUILD_TARGET_ARCH" -a "$KBUILD_TARGET_ARCH" != "$BUILD_TARGET_ARCH"; then
echo "$0: error: KBUILD_TARGET_ARCH ($KBUILD_TARGET_ARCH) and BUILD_TARGET_ARCH ($BUILD_TARGET_ARCH) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_TARGET_ARCH=$BUILD_TARGET_ARCH
fi
if test -n "$BUILD_TARGET_CPU"; then
if test -n "$KBUILD_TARGET_CPU" -a "$KBUILD_TARGET_CPU" != "$BUILD_TARGET_CPU"; then
echo "$0: error: KBUILD_TARGET_CPU ($KBUILD_TARGET_CPU) and BUILD_TARGET_CPU ($BUILD_TARGET_CPU) disagree." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
KBUILD_TARGET_CPU=$BUILD_TARGET_CPU
fi
#
# Set default build type.
#
if test -z "$KBUILD_TYPE"; then
KBUILD_TYPE=release
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_TYPE=$KBUILD_TYPE" 1>&${DBG_REDIR}
#
# Determin the host platform.
#
# The CPU isn't important, only the other two are. But, since the cpu,
# arch and platform (and build type) share a common key space, try make
# sure any new additions are unique. (See header.kmk, KBUILD_OSES/ARCHES.)
#
if test -z "$KBUILD_HOST"; then
KBUILD_HOST=`uname`
case "$KBUILD_HOST" in
Darwin|darwin)
KBUILD_HOST=darwin
;;
DragonFly)
KBUILD_HOST=dragonfly
;;
freebsd|FreeBSD|FREEBSD)
KBUILD_HOST=freebsd
;;
GNU)
KBUILD_HOST=gnuhurd
;;
GNU/kFreeBSD)
KBUILD_HOST=gnukfbsd
;;
GNU/kNetBSD|GNU/NetBSD)
KBUILD_HOST=gnuknbsd
;;
Haiku)
KBUILD_HOST=haiku
;;
linux|Linux|GNU/Linux|LINUX)
KBUILD_HOST=linux
;;
netbsd|NetBSD|NETBSD)
KBUILD_HOST=netbsd
;;
openbsd|OpenBSD|OPENBSD)
KBUILD_HOST=openbsd
;;
os2|OS/2|OS2)
KBUILD_HOST=os2
;;
SunOS)
KBUILD_HOST=solaris
;;
WindowsNT|CYGWIN_NT-*)
KBUILD_HOST=win
;;
*)
echo "$0: unknown os $KBUILD_HOST" 1>&${ERR_REDIR}
sleep 1
exit 1
;;
esac
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST=$KBUILD_HOST" 1>&${DBG_REDIR}
if test -z "$KBUILD_HOST_ARCH"; then
# Try deduce it from the cpu if given.
if test -n "$KBUILD_HOST_CPU"; then
case "$KBUILD_HOST_CPU" in
i[3456789]86)
KBUILD_HOST_ARCH='x86'
;;
k8|k8l|k9|k10)
KBUILD_HOST_ARCH='amd64'
;;
esac
fi
fi
if test -z "$KBUILD_HOST_ARCH"; then
# Use uname -m or isainfo (lots of guesses here, please help clean this up...)
if test "$KBUILD_HOST" = "solaris"; then
KBUILD_HOST_ARCH=`isainfo | cut -f 1 -d ' '`
else
KBUILD_HOST_ARCH=`uname -m`
fi
case "$KBUILD_HOST_ARCH" in
x86_64|AMD64|amd64|k8|k8l|k9|k10)
KBUILD_HOST_ARCH='amd64'
# Try detect debian x32.
if test "$KBUILD_HOST" = "linux"; then
if test -z "${DEB_HOST_ARCH}"; then
DEB_HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null`;
if test -z "${DEB_HOST_ARCH}"; then
DEB_HOST_ARCH=`dpkg --print-architecture 2> /dev/null`;
fi
fi
case "${DEB_HOST_ARCH}" in
"x32")
KBUILD_HOST_ARCH=x32
;;
"") case "`uname -v`" in
*Debian*+x32+*) KBUILD_HOST_ARCH=x32 ;;
esac
;;
esac
fi
;;
x86|i86pc|ia32|i[3456789]86|BePC|i[3456789]86-AT[3456789]86)
KBUILD_HOST_ARCH='x86'
;;
alpha)
KBUILD_HOST_ARCH='alpha'
;;
aarch32|arm|arm1|arm2|arm3|arm6|armv1|armv2|armv3*|armv4*|armv5*|armv6*|armv7*|armv8*)
KBUILD_HOST_ARCH='arm32'
;;
aarch64*)
KBUILD_HOST_ARCH='arm64'
;;
hppa32|parisc32|parisc)
KBUILD_HOST_ARCH='hppa32'
;;
hppa64|parisc64)
KBUILD_HOST_ARCH='hppa64'
;;
ia64)
KBUILD_HOST_ARCH='ia64'
;;
ppc32|ppc|powerpc)
KBUILD_HOST_ARCH='ppc32'
;;
ppc64|ppc64le|powerpc64|powerpc64le)
KBUILD_HOST_ARCH='ppc64'
;;
m68k)
KBUILD_HOST_ARCH='m68k'
;;
mips32|mips)
KBUILD_HOST_ARCH='mips32'
;;
mips64)
KBUILD_HOST_ARCH='mips64'
;;
s390)
KBUILD_HOST_ARCH='s390'
;;
s390x)
KBUILD_HOST_ARCH='s390x'
;;
sh|sh2|sh2a|sh3|sh3|sh4|sh4a|sh4al|sh4al-dsp|shmedia)
KBUILD_HOST_ARCH='sh32'
;;
sh64)
KBUILD_HOST_ARCH='sh64'
;;
sparc32|sparc|sparcv8|sparcv7|sparcv8e)
KBUILD_HOST_ARCH='sparc32'
;;
sparc64|sparcv9)
KBUILD_HOST_ARCH='sparc64'
;;
*) echo "$0: unknown cpu/arch - $KBUILD_HOST_ARCH" 1>&${ERR_REDIR}
sleep 1
exit 1
;;
esac
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST_ARCH=$KBUILD_HOST_ARCH" 1>&${DBG_REDIR}
if test -z "$KBUILD_HOST_CPU"; then
KBUILD_HOST_CPU="blend"
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_HOST_CPU=$KBUILD_HOST_CPU" 1>&${DBG_REDIR}
#
# The target platform.
# Defaults to the host when not specified.
#
if test -z "$KBUILD_TARGET"; then
KBUILD_TARGET="$KBUILD_HOST"
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET=$KBUILD_TARGET" 1>&${DBG_REDIR}
if test -z "$KBUILD_TARGET_ARCH"; then
KBUILD_TARGET_ARCH="$KBUILD_HOST_ARCH"
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET_ARCH=$KBUILD_TARGET_ARCH" 1>&${DBG_REDIR}
if test -z "$KBUILD_TARGET_CPU"; then
if test "$KBUILD_TARGET_ARCH" = "$KBUILD_HOST_ARCH"; then
KBUILD_TARGET_CPU="$KBUILD_HOST_CPU"
else
KBUILD_TARGET_CPU="blend"
fi
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_TARGET_CPU=$KBUILD_TARGET_CPU" 1>&${DBG_REDIR}
#
# Determin executable extension and path separator.
#
_SUFF_EXE=
_PATH_SEP=":"
case "$KBUILD_HOST" in
os2|win|nt)
_SUFF_EXE=".exe"
_PATH_SEP=";"
;;
esac
#
# Determin KBUILD_PATH from the script location and calc KBUILD_BIN_PATH from there.
#
if test -z "$KBUILD_PATH"; then
KBUILD_PATH=`dirname "$0"`
KBUILD_PATH=`cd "$KBUILD_PATH" ; /bin/pwd`
fi
if test ! -f "$KBUILD_PATH/footer.kmk" -o ! -f "$KBUILD_PATH/header.kmk" -o ! -f "$KBUILD_PATH/rules.kmk"; then
echo "$0: error: KBUILD_PATH ($KBUILD_PATH) is not pointing to a popluated kBuild directory." 1>&${ERR_REDIR}
sleep 1
exit 1
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_PATH=$KBUILD_PATH" 1>&${DBG_REDIR}
if test -z "$KBUILD_BIN_PATH"; then
KBUILD_BIN_PATH="${KBUILD_PATH}/bin/${KBUILD_HOST}.${KBUILD_HOST_ARCH}"
fi
test -n "$DBG_OPT" && echo "dbg: KBUILD_BIN_PATH=${KBUILD_BIN_PATH}" 1>&${DBG_REDIR}
#
# Add the bin/x.y/ directory to the PATH.
# NOTE! Once bootstrapped this is the only thing that is actually necessary.
#
PATH="${KBUILD_BIN_PATH}${_PATH_SEP}$PATH"
test -n "$DBG_OPT" && echo "dbg: PATH=$PATH" 1>&${DBG_REDIR}
#
# Sanity and x bits.
#
if test ! -d "${KBUILD_BIN_PATH}/"; then
echo "$0: warning: The bin directory for this platform doesn't exist. (${KBUILD_BIN_PATH}/)" 1>&${ERR_REDIR}
else
for prog in kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_rm kmk_rmdir kmk_sed;
do
chmod a+x ${KBUILD_BIN_PATH}/${prog} > /dev/null 2>&1
if test ! -f "${KBUILD_BIN_PATH}/${prog}${_SUFF_EXE}"; then
echo "$0: warning: The ${prog} program doesn't exist for this platform. (${KBUILD_BIN_PATH}/${prog}${_SUFF_EXE})" 1>&${ERR_REDIR}
fi
done
fi
#
# The environment is in place, now take the requested action.
#
MY_RC=0
if test -n "${VAR_OPT}"; then
# Echo variable values or variable export statements.
for var in ${VAR_OPT};
do
val=
case "$var" in
PATH)
val=$PATH
;;
KBUILD_PATH)
val=$KBUILD_PATH
;;
KBUILD_BIN_PATH)
val=$KBUILD_BIN_PATH
;;
KBUILD_HOST)
val=$KBUILD_HOST
;;
KBUILD_HOST_ARCH)
val=$KBUILD_HOST_ARCH
;;
KBUILD_HOST_CPU)
val=$KBUILD_HOST_CPU
;;
KBUILD_TARGET)
val=$KBUILD_TARGET
;;
KBUILD_TARGET_ARCH)
val=$KBUILD_TARGET_ARCH
;;
KBUILD_TARGET_CPU)
val=$KBUILD_TARGET_CPU
;;
KBUILD_TYPE)
val=$KBUILD_TYPE
;;
*)
echo "$0: error: Unknown variable $var specified in --var request." 1>&${ERR_REDIR}
sleep 1
exit 1
;;
esac
if test -n "$EVAL_OPT"; then
echo "${EVAL_EXPORT} $var=$val"
else
if test -n "$VALUE_ONLY_OPT"; then
echo "$val"
else
echo "$var=$val"
fi
fi
done
else
if test -n "$EVAL_OPT"; then
# Echo statements for the shell to evaluate.
test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR}
echo "${EVAL_EXPORT} PATH=${PATH}"
test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && echo "${EVAL_EXPORT} KBUILD_TYPE=${KBUILD_TYPE}"
if test -n "${FULL_OPT}"; then
echo "${EVAL_EXPORT} KBUILD_PATH=${KBUILD_PATH}"
if test -n "{FULL_WITH_BIN_OPT}"; then
echo "${EVAL_EXPORT} KBUILD_BIN_PATH=${KBUILD_BIN_PATH}"
fi
echo "${EVAL_EXPORT} KBUILD_HOST=${KBUILD_HOST}"
echo "${EVAL_EXPORT} KBUILD_HOST_ARCH=${KBUILD_HOST_ARCH}"
echo "${EVAL_EXPORT} KBUILD_HOST_CPU=${KBUILD_HOST_CPU}"
echo "${EVAL_EXPORT} KBUILD_TARGET=${KBUILD_TARGET}"
echo "${EVAL_EXPORT} KBUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
echo "${EVAL_EXPORT} KBUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
if test -n "${LEGACY_OPT}"; then
echo "${EVAL_EXPORT} PATH_KBUILD=${KBUILD_PATH}"
if test -n "${FULL_WITH_BIN_OPT}"; then
echo "${EVAL_EXPORT} PATH_KBUILD_BIN=${KBUILD_PATH_BIN}"
fi
echo "${EVAL_EXPORT} BUILD_TYPE=${KBUILD_TYPE}"
echo "${EVAL_EXPORT} BUILD_PLATFORM=${KBUILD_HOST}"
echo "${EVAL_EXPORT} BUILD_PLATFORM_ARCH=${KBUILD_HOST_ARCH}"
echo "${EVAL_EXPORT} BUILD_PLATFORM_CPU=${KBUILD_HOST_CPU}"
echo "${EVAL_EXPORT} BUILD_TARGET=${KBUILD_TARGET}"
echo "${EVAL_EXPORT} BUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
echo "${EVAL_EXPORT} BUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
fi
fi
else
# Export variables.
export PATH
test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && export KBUILD_TYPE
if test -n "${FULL_OPT}"; then
export KBUILD_PATH
if test -n "${FULL_WITH_BIN_OPT}"; then
export KBUILD_BIN_PATH
fi
export KBUILD_HOST
export KBUILD_HOST_ARCH
export KBUILD_HOST_CPU
export KBUILD_TARGET
export KBUILD_TARGET_ARCH
export KBUILD_TARGET_CPU
if test -n "${LEGACY_OPT}"; then
export PATH_KBUILD=$KBUILD_PATH
if test -n "${FULL_WITH_BIN_OPT}"; then
export PATH_KBUILD_BIN=$KBUILD_BIN_PATH
fi
export BUILD_TYPE=$KBUILD_TYPE
export BUILD_PLATFORM=$KBUILD_HOST
export BUILD_PLATFORM_ARCH=$KBUILD_HOST_ARCH
export BUILD_PLATFORM_CPU=$KBUILD_HOST_CPU
export BUILD_TARGET=$KBUILD_TARGET
export BUILD_TARGET_ARCH=$KBUILD_TARGET_ARCH
export BUILD_TARGET_CPU=$KBUILD_TARGET_CPU
fi
fi
# Execute command or spawn shell.
if test $# -eq 0; then
test -z "${QUIET_OPT}" && echo "$0: info: Spawning work shell..." 1>&${ERR_REDIR}
if test "$TERM" != 'dumb' -a -n "$BASH"; then
export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
fi
$SHELL -i
MY_RC=$?
else
test -z "${QUIET_OPT}" && echo "$0: info: Executing command: $*" 1>&${ERR_REDIR}
$*
MY_RC=$?
test -z "${QUIET_OPT}" -a "$MY_RC" -ne 0 && echo "$0: info: rc=$MY_RC: $*" 1>&${ERR_REDIR}
fi
fi
fi
test -n "$DBG_OPT" && echo "dbg: finished (rc=$MY_RC)" 1>&${DBG_REDIR}
exit $MY_RC
|