Changeset 1513 in kBuild
- Timestamp:
- Apr 9, 2008 1:52:03 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/env.sh
r1512 r1513 36 36 QUIET_OPT= 37 37 FULL_OPT= 38 VAR_OPT= 38 39 while test $# -gt 0; 39 40 do … … 53 54 DBG_REDIR=2 54 55 ;; 56 "--var") 57 shift 58 VAR_OPT="${VAR_OPT} $1" 59 ;; 55 60 "--help") 56 echo "syntax: $0 [--debug] [--quiet] [--full] [--eval] [command [args]]" 61 echo "syntax: $0 [--debug] [--quiet] [--full] [--eval] [--var name] [command [args]]" 62 ## FIXME: long --help screen. 57 63 exit 1 58 64 ;; … … 293 299 unset _PATH_SEP 294 300 295 if test -n "$EVAL_OPT"; then 296 test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR} 297 echo "export PATH=${PATH}" 298 if test -n "${FULL_OPT}"; then 299 echo "export BUILD_PLATFORM=${BUILD_PLATFORM}" 300 echo "export BUILD_PLATFORM_ARCH=${BUILD_PLATFORM_ARCH}" 301 echo "export BUILD_PLATFORM_CPU=${BUILD_PLATFORM_CPU}" 302 echo "export BUILD_TARGET=${BUILD_TARGET}" 303 echo "export BUILD_TARGET_ARCH=${BUILD_TARGET_ARCH}" 304 echo "export BUILD_TARGET_CPU=${BUILD_TARGET_CPU}" 305 echo "export BUILD_TYPE=${BUILD_TYPE}" 306 echo "export PATH_KBUILD=${PATH_KBUILD}" 301 if test -n "${VAR_OPT}"; then 302 # Echo variable values or variable export statements. 303 for var in ${VAR_OPT}; 304 do 305 val= 306 case "$var" in 307 PATH) 308 val=$PATH 309 ;; 310 KBUILD_PATH|PATH_KBUILD) 311 val=$PATH_KBUILD 312 ;; 313 KBUILD_BIN_PATH|PATH_KBUILD_BIN) 314 val=$PATH_KBUILD_BIN 315 ;; 316 KBUILD_HOST|BUILD_PLATFORM) 317 val=$BUILD_PLATFORM 318 ;; 319 KBUILD_HOST_ARCH|BUILD_PLATFORM_ARCH) 320 val=$BUILD_PLATFORM_ARCH 321 ;; 322 KBUILD_HOST_CPU|BUILD_PLATFORM_CPU) 323 val=$BUILD_PLATFORM_CPU 324 ;; 325 KBUILD_TARGET|BUILD_TARGET) 326 val=$BUILD_TARGET 327 ;; 328 KBUILD_TARGET_ARCH|BUILD_TARGET_ARCH) 329 val=$BUILD_TARGET_ARCH 330 ;; 331 KBUILD_TARGET_CPU|BUILD_TARGET_CPU) 332 val=$BUILD_TARGET_CPU 333 ;; 334 KBUILD_TYPE|BUILD_TYPE) 335 val=$BUILD_TARGET_CPU 336 ;; 337 *) 338 echo "$0: error: Unknown variable $var specified in --var request." 1>&${ERR_REDIR} 339 sleep 1 340 exit 1 341 ;; 342 esac 343 344 if test -n "$EVAL_OPT"; then 345 echo "export $var=$val" 346 else 347 echo "$var=$val" 348 fi 349 done 350 else 351 if test -n "$EVAL_OPT"; then 352 # Echo statements for the shell to evaluate. 353 test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR} 354 echo "export PATH=${PATH}" 355 if test -n "${FULL_OPT}"; then 356 echo "export BUILD_PLATFORM=${BUILD_PLATFORM}" 357 echo "export BUILD_PLATFORM_ARCH=${BUILD_PLATFORM_ARCH}" 358 echo "export BUILD_PLATFORM_CPU=${BUILD_PLATFORM_CPU}" 359 echo "export BUILD_TARGET=${BUILD_TARGET}" 360 echo "export BUILD_TARGET_ARCH=${BUILD_TARGET_ARCH}" 361 echo "export BUILD_TARGET_CPU=${BUILD_TARGET_CPU}" 362 echo "export BUILD_TYPE=${BUILD_TYPE}" 363 echo "export PATH_KBUILD=${PATH_KBUILD}" 364 fi 365 else 366 # Export variables. 367 export PATH 368 if test -n "${FULL_OPT}"; then 369 export PATH_KBUILD 370 export BUILD_TYPE 371 export BUILD_PLATFORM 372 export BUILD_PLATFORM_ARCH 373 export BUILD_PLATFORM_CPU 374 export BUILD_TARGET 375 export BUILD_TARGET_ARCH 376 export BUILD_TARGET_CPU 377 fi 378 379 # Execute command or spawn shell. 380 if test $# -eq 0; then 381 test -z "${QUIET_OPT}" && echo "$0: info: Spawning work shell..." 1>&${ERR_REDIR} 382 if test "$TERM" != 'dumb' -a -n "$BASH"; then 383 export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 384 fi 385 $SHELL -i 386 else 387 test -z "${QUIET_OPT}" && echo "$0: info: Executing command: $*" 1>&${ERR_REDIR} 388 $* 389 fi 307 390 fi 308 test -n "$DBG_OPT" && echo "dbg: finished" 1>&${DBG_REDIR} 309 else 310 export PATH 311 if test -n "${FULL_OPT}"; then 312 export PATH_KBUILD 313 export BUILD_TYPE 314 export BUILD_PLATFORM 315 export BUILD_PLATFORM_ARCH 316 export BUILD_PLATFORM_CPU 317 export BUILD_TARGET 318 export BUILD_TARGET_ARCH 319 export BUILD_TARGET_CPU 320 fi 321 322 # Execute command or spawn shell. 323 if test $# -eq 0; then 324 test -z "${QUIET_OPT}" && echo "$0: info: Spawning work shell..." 1>&${ERR_REDIR} 325 if test "$TERM" != 'dumb' -a -n "$BASH"; then 326 export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 327 fi 328 $SHELL -i 329 else 330 test -z "${QUIET_OPT}" && echo "$0: info: Executing command: $*" 1>&${ERR_REDIR} 331 $* 332 fi 333 fi 334 391 fi 392 test -n "$DBG_OPT" && echo "dbg: finished" 1>&${DBG_REDIR} 393
Note:
See TracChangeset
for help on using the changeset viewer.