Changeset 1530


Ignore:
Timestamp:
Apr 19, 2008, 11:56:31 PM (17 years ago)
Author:
bird
Message:

Added --release, --profile and --debug options for specifying KBUILD_TYPE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/env.sh

    r1517 r1530  
    3333DBG_REDIR=1
    3434EVAL_OPT=
     35EVAL_EXPORT="export "
    3536DBG_OPT=
    3637QUIET_OPT=
     
    3940VAR_OPT=
    4041VALUE_ONLY_OPT=
     42EXP_TYPE_OPT=
    4143while test $# -gt 0;
    4244do
    4345    case "$1" in
    44         "--debug")
     46        "--debug-script")
    4547            DBG_OPT="true"
    4648            ;;
    47         "--no-debug")
     49        "--no-debug-script")
    4850            DBG_OPT=
    4951            ;;
     
    6870        "--eval")
    6971            EVAL_OPT="true"
     72            ERR_REDIR=2
     73            DBG_REDIR=2
     74            ;;
     75        "--set")
     76            EVAL_OPT="true"
     77            EVAL_EXPORT=""
    7078            ERR_REDIR=2
    7179            DBG_REDIR=2
     
    8391            VALUE_ONLY_OPT=
    8492            ;;
     93        "--release")
     94            EXP_TYPE_OPT=1
     95            KBUILD_TYPE=release
     96            BUILD_TYPE=
     97            ;;
     98        "--debug")
     99            EXP_TYPE_OPT=1
     100            KBUILD_TYPE=debug
     101            BUILD_TYPE=
     102            ;;
     103        "--profile")
     104            EXP_TYPE_OPT=1
     105            KBUILD_TYPE=profile
     106            BUILD_TYPE=
     107            ;;
     108
    85109        "--help")
    86110            echo "kBuild Environment Setup Script, v0.1.3"
     
    99123            echo ""
    100124            echo "Options:"
    101             echo "  --debug, --no-debug"
    102             echo "      Controls debug output. Default: --no-debug"
     125            echo "  --debug, --release, --profile"
     126            echo "      Alternative way of specifying KBUILD_TYPE."
     127            echo "  --debug-script, --no-debug-script"
     128            echo "      Controls debug output. Default: --no-debug-script"
    103129            echo "  --quiet, --verbose"
    104130            echo "      Controls informational output. Default: --verbose"
     
    109135            echo "  --value-only, --name-and-value"
    110136            echo "      Controls what the result of a --var query. Default: --name-and-value"
     137            echo "  --set, --export"
     138            echo "      Whether --eval explicitly export the variables. --set is useful for"
     139            echo "      getting a list of environment vars for a commandline, while --eval"
     140            echo "      is useful for eval `env.sh`. Default: --export"
    111141            echo ""
    112142            exit 1
     
    473503
    474504        if test -n "$EVAL_OPT"; then
    475             echo "export $var=$val"
     505            echo "${EVAL_EXPORT} $var=$val"
    476506        else
    477507            if test -n "$VALUE_ONLY_OPT"; then
     
    486516        # Echo statements for the shell to evaluate.
    487517        test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR}
    488         echo "export PATH=${PATH}"
     518        echo "${EVAL_EXPORT} PATH=${PATH}"
     519        test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && echo "${EVAL_EXPORT} KBUILD_TYPE=${KBUILD_TYPE}"
    489520        if test -n "${FULL_OPT}"; then
    490             echo "export KBUILD_PATH=${KBUILD_PATH}"
    491             echo "export KBUILD_TYPE=${KBUILD_TYPE}"
    492             echo "export KBUILD_HOST=${KBUILD_HOST}"
    493             echo "export KBUILD_HOST_ARCH=${KBUILD_HOST_ARCH}"
    494             echo "export KBUILD_HOST_CPU=${KBUILD_HOST_CPU}"
    495             echo "export KBUILD_TARGET=${KBUILD_TARGET}"
    496             echo "export KBUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
    497             echo "export KBUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
     521            echo "${EVAL_EXPORT} KBUILD_PATH=${KBUILD_PATH}"
     522            echo "${EVAL_EXPORT} KBUILD_HOST=${KBUILD_HOST}"
     523            echo "${EVAL_EXPORT} KBUILD_HOST_ARCH=${KBUILD_HOST_ARCH}"
     524            echo "${EVAL_EXPORT} KBUILD_HOST_CPU=${KBUILD_HOST_CPU}"
     525            echo "${EVAL_EXPORT} KBUILD_TARGET=${KBUILD_TARGET}"
     526            echo "${EVAL_EXPORT} KBUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
     527            echo "${EVAL_EXPORT} KBUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
    498528
    499529            if test -n "${LEGACY_OPT}"; then
    500                 echo "export PATH_KBUILD=${KBUILD_PATH}"
    501                 echo "export BUILD_TYPE=${KBUILD_TYPE}"
    502                 echo "export BUILD_PLATFORM=${KBUILD_HOST}"
    503                 echo "export BUILD_PLATFORM_ARCH=${KBUILD_HOST_ARCH}"
    504                 echo "export BUILD_PLATFORM_CPU=${KBUILD_HOST_CPU}"
    505                 echo "export BUILD_TARGET=${KBUILD_TARGET}"
    506                 echo "export BUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
    507                 echo "export BUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
     530                echo "${EVAL_EXPORT} PATH_KBUILD=${KBUILD_PATH}"
     531                echo "${EVAL_EXPORT} BUILD_TYPE=${KBUILD_TYPE}"
     532                echo "${EVAL_EXPORT} BUILD_PLATFORM=${KBUILD_HOST}"
     533                echo "${EVAL_EXPORT} BUILD_PLATFORM_ARCH=${KBUILD_HOST_ARCH}"
     534                echo "${EVAL_EXPORT} BUILD_PLATFORM_CPU=${KBUILD_HOST_CPU}"
     535                echo "${EVAL_EXPORT} BUILD_TARGET=${KBUILD_TARGET}"
     536                echo "${EVAL_EXPORT} BUILD_TARGET_ARCH=${KBUILD_TARGET_ARCH}"
     537                echo "${EVAL_EXPORT} BUILD_TARGET_CPU=${KBUILD_TARGET_CPU}"
    508538            fi
    509539        fi
     
    511541        # Export variables.
    512542        export PATH
     543        test -n "${FULL_OPT}" -o "${EXP_TYPE_OPT}" && export KBUILD_TYPE
    513544        if test -n "${FULL_OPT}"; then
    514545            export KBUILD_PATH
    515             export KBUILD_TYPE
    516546            export KBUILD_HOST
    517547            export KBUILD_HOST_ARCH
Note: See TracChangeset for help on using the changeset viewer.