| 1 | @echo off
|
|---|
| 2 | REM $Id: $
|
|---|
| 3 | REM REM @file
|
|---|
| 4 | REM Environment setup script.
|
|---|
| 5 | REM
|
|---|
| 6 |
|
|---|
| 7 | REM
|
|---|
| 8 | REM Copyright (c) 2005-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
|---|
| 9 | REM
|
|---|
| 10 | REM This file is part of kBuild.
|
|---|
| 11 | REM
|
|---|
| 12 | REM kBuild is free software; you can redistribute it and/or modify
|
|---|
| 13 | REM it under the terms of the GNU General Public License as published by
|
|---|
| 14 | REM the Free Software Foundation; either version 2 of the License, or
|
|---|
| 15 | REM (at your option) any later version.
|
|---|
| 16 | REM
|
|---|
| 17 | REM kBuild is distributed in the hope that it will be useful,
|
|---|
| 18 | REM but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 19 | REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 20 | REM GNU General Public License for more details.
|
|---|
| 21 | REM
|
|---|
| 22 | REM You should have received a copy of the GNU General Public License
|
|---|
| 23 | REM along with kBuild; if not, write to the Free Software
|
|---|
| 24 | REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 25 | REM
|
|---|
| 26 |
|
|---|
| 27 | REM
|
|---|
| 28 | REM Globals
|
|---|
| 29 | REM
|
|---|
| 30 | set _KBUILD_CURDIR=%CD%
|
|---|
| 31 | for /f "tokens=*" %%d in ('cd') do set _KBUILD_CURDIR=%%d
|
|---|
| 32 |
|
|---|
| 33 | set _KBUILD_PATH=%KBUILD_PATH%
|
|---|
| 34 | set _KBUILD_BIN_PATH=%KBUILD_BIN_PATH%
|
|---|
| 35 | set _KBUILD_TYPE=%KBUILD_TYPE%
|
|---|
| 36 | set _KBUILD_TARGET=%KBUILD_TARGET%
|
|---|
| 37 | set _KBUILD_TARGET_ARCH=%KBUILD_TARGET_ARCH%
|
|---|
| 38 | set _KBUILD_TARGET_CPU=%KBUILD_TARGET_CPU%
|
|---|
| 39 | set _KBUILD_HOST=%KBUILD_HOST%
|
|---|
| 40 | set _KBUILD_HOST_ARCH=%KBUILD_HOST_ARCH%
|
|---|
| 41 | set _KBUILD_HOST_CPU=%KBUILD_HOST_CPU%
|
|---|
| 42 |
|
|---|
| 43 | set _KBUILD_OVERRIDE_TYPE=0
|
|---|
| 44 | set _KBUILD_OVERRIDE_TARGET=0
|
|---|
| 45 | set _KBUILD_OVERRIDE_TARGET_ARCH=0
|
|---|
| 46 |
|
|---|
| 47 | REM
|
|---|
| 48 | REM Parse the arguments.
|
|---|
| 49 | REM
|
|---|
| 50 | REM Note: The 0 argument must be safed as it is also shifted.
|
|---|
| 51 | REM
|
|---|
| 52 | set _KBUILD_SELF=%0
|
|---|
| 53 | set _KBUILD_OPT_FULL=0
|
|---|
| 54 | set _KBUILD_OPT_LEGACY=0
|
|---|
| 55 | set _KBUILD_OPT_VAR=
|
|---|
| 56 | set _KBUILD_OPT_VALUE_ONLY=0
|
|---|
| 57 | set _KBUILD_SHOW_VAR_PREFIX=
|
|---|
| 58 | set _KBUILD_OPT_DBG=1
|
|---|
| 59 | set _KBUILD_OPT_OVERRIDE_ALL=0
|
|---|
| 60 |
|
|---|
| 61 | :argument_loop
|
|---|
| 62 | if ".%1" == ".-h" goto do_help
|
|---|
| 63 | if ".%1" == "./h" goto do_help
|
|---|
| 64 | if ".%1" == "./H" goto do_help
|
|---|
| 65 | if ".%1" == ".-h" goto do_help
|
|---|
| 66 | if ".%1" == ".-help" goto do_help
|
|---|
| 67 | if ".%1" == ".--help" goto do_help
|
|---|
| 68 |
|
|---|
| 69 | if ".%1" == ".--win" goto want_win
|
|---|
| 70 | if ".%1" == ".-win" goto want_win
|
|---|
| 71 | if ".%1" == ".--win32" goto want_win32_bit
|
|---|
| 72 | if ".%1" == ".-win32" goto want_win32_bit
|
|---|
| 73 | if ".%1" == ".-win64" goto want_win64_bit
|
|---|
| 74 | if ".%1" == ".--win64" goto want_win64_bit
|
|---|
| 75 | if ".%1" == ".--nt" goto want_nt
|
|---|
| 76 | if ".%1" == ".-nt" goto want_nt
|
|---|
| 77 | if ".%1" == ".--nt32" goto want_nt32_bit
|
|---|
| 78 | if ".%1" == ".-nt32" goto want_nt32_bit
|
|---|
| 79 | if ".%1" == ".--nt64" goto want_nt64_bit
|
|---|
| 80 | if ".%1" == ".-nt64" goto want_nt64_bit
|
|---|
| 81 |
|
|---|
| 82 | if ".%1" == ".--release" goto want_release
|
|---|
| 83 | if ".%1" == ".--profile" goto want_profile
|
|---|
| 84 | if ".%1" == ".--debug" goto want_debug
|
|---|
| 85 |
|
|---|
| 86 | if ".%1" == ".--full" goto opt_full
|
|---|
| 87 | if ".%1" == ".--normal" goto opt_normal
|
|---|
| 88 | if ".%1" == ".--legacy" goto opt_legacy
|
|---|
| 89 | if ".%1" == ".--no-legacy" goto opt_no_legacy
|
|---|
| 90 | if ".%1" == ".--debug-script" goto opt_debug_script
|
|---|
| 91 | if ".%1" == ".--no-debug-script" goto opt_no_debug_script
|
|---|
| 92 | if ".%1" == ".--var" goto opt_var
|
|---|
| 93 | if ".%1" == ".--value-only" goto opt_value_only
|
|---|
| 94 | if ".%1" == ".--name-and-value" goto opt_name_and_value
|
|---|
| 95 | if ".%1" == ".--set" goto opt_set
|
|---|
| 96 | if ".%1" == ".--no-set" goto opt_no_set
|
|---|
| 97 |
|
|---|
| 98 | goto done_arguments
|
|---|
| 99 |
|
|---|
| 100 | :want_win
|
|---|
| 101 | shift
|
|---|
| 102 | set _KBUILD_TARGET=win
|
|---|
| 103 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 104 | goto argument_loop
|
|---|
| 105 |
|
|---|
| 106 | :want_win32_bit
|
|---|
| 107 | shift
|
|---|
| 108 | set _KBUILD_TARGET=win
|
|---|
| 109 | set _KBUILD_TARGET_ARCH=x86
|
|---|
| 110 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 111 | set _KBUILD_OVERRIDE_TARGET_ARCH=1
|
|---|
| 112 | goto argument_loop
|
|---|
| 113 |
|
|---|
| 114 | :want_win64_bit
|
|---|
| 115 | shift
|
|---|
| 116 | set _KBUILD_TARGET=win
|
|---|
| 117 | set _KBUILD_TARGET_ARCH=amd64
|
|---|
| 118 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 119 | set _KBUILD_OVERRIDE_TARGET_ARCH=1
|
|---|
| 120 | goto argument_loop
|
|---|
| 121 |
|
|---|
| 122 | :want_nt
|
|---|
| 123 | shift
|
|---|
| 124 | set _KBUILD_TARGET=nt
|
|---|
| 125 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 126 | goto argument_loop
|
|---|
| 127 |
|
|---|
| 128 | :want_nt32_bit
|
|---|
| 129 | shift
|
|---|
| 130 | set _KBUILD_TARGET=nt
|
|---|
| 131 | set _KBUILD_TARGET_ARCH=x86
|
|---|
| 132 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 133 | set _KBUILD_OVERRIDE_TARGET_ARCH=1
|
|---|
| 134 | goto argument_loop
|
|---|
| 135 |
|
|---|
| 136 | :want_nt64_bit
|
|---|
| 137 | shift
|
|---|
| 138 | set _KBUILD_TARGET=nt
|
|---|
| 139 | set _KBUILD_TARGET_ARCH=amd64
|
|---|
| 140 | set _KBUILD_OVERRIDE_TARGET=1
|
|---|
| 141 | set _KBUILD_OVERRIDE_TARGET_ARCH=1
|
|---|
| 142 | goto argument_loop
|
|---|
| 143 |
|
|---|
| 144 | :want_release
|
|---|
| 145 | shift
|
|---|
| 146 | set _KBUILD_TYPE=release
|
|---|
| 147 | set _KBUILD_OVERRIDE_TYPE=1
|
|---|
| 148 | goto argument_loop
|
|---|
| 149 |
|
|---|
| 150 | :want_profile
|
|---|
| 151 | shift
|
|---|
| 152 | set _KBUILD_TYPE=profile
|
|---|
| 153 | set _KBUILD_OVERRIDE_TYPE=1
|
|---|
| 154 | goto argument_loop
|
|---|
| 155 |
|
|---|
| 156 | :want_debug
|
|---|
| 157 | shift
|
|---|
| 158 | set _KBUILD_TYPE=debug
|
|---|
| 159 | set _KBUILD_OVERRIDE_TYPE=1
|
|---|
| 160 | goto argument_loop
|
|---|
| 161 |
|
|---|
| 162 | :opt_full
|
|---|
| 163 | shift
|
|---|
| 164 | set _KBUILD_OPT_FULL=1
|
|---|
| 165 | goto argument_loop
|
|---|
| 166 |
|
|---|
| 167 | :opt_normal
|
|---|
| 168 | shift
|
|---|
| 169 | set _KBUILD_OPT_FULL=0
|
|---|
| 170 | goto argument_loop
|
|---|
| 171 |
|
|---|
| 172 | :opt_legacy
|
|---|
| 173 | shift
|
|---|
| 174 | set _KBUILD_OPT_LEGACY=1
|
|---|
| 175 | goto argument_loop
|
|---|
| 176 |
|
|---|
| 177 | :opt_no_legacy
|
|---|
| 178 | shift
|
|---|
| 179 | set _KBUILD_OPT_LEGACY=0
|
|---|
| 180 | goto argument_loop
|
|---|
| 181 |
|
|---|
| 182 | :opt_debug_script
|
|---|
| 183 | shift
|
|---|
| 184 | set _KBUILD_OPT_DBG=1
|
|---|
| 185 | goto argument_loop
|
|---|
| 186 |
|
|---|
| 187 | :opt_no_debug_script
|
|---|
| 188 | shift
|
|---|
| 189 | set _KBUILD_OPT_DBG=0
|
|---|
| 190 | goto argument_loop
|
|---|
| 191 |
|
|---|
| 192 | :opt_var
|
|---|
| 193 | shift
|
|---|
| 194 | if ".%1" == "." echo syntax error: --var is missing it's variable name.
|
|---|
| 195 | if ".%1" == "." goto failure
|
|---|
| 196 | set _KBUILD_OPT_VAR=%_KBUILD_OPT_VAR% %1
|
|---|
| 197 | shift
|
|---|
| 198 | goto argument_loop
|
|---|
| 199 |
|
|---|
| 200 | :opt_value_only
|
|---|
| 201 | shift
|
|---|
| 202 | set _KBUILD_OPT_VALUE_ONLY=1
|
|---|
| 203 | goto argument_loop
|
|---|
| 204 |
|
|---|
| 205 | :opt_name_and_value
|
|---|
| 206 | shift
|
|---|
| 207 | set _KBUILD_OPT_VALUE_ONLY=0
|
|---|
| 208 | goto argument_loop
|
|---|
| 209 |
|
|---|
| 210 | :opt_set
|
|---|
| 211 | shift
|
|---|
| 212 | set _KBUILD_SHOW_VAR_PREFIX=SET %_KBUILD_NON_EXISTING_VAR%
|
|---|
| 213 | goto argument_loop
|
|---|
| 214 |
|
|---|
| 215 | :opt_no_set
|
|---|
| 216 | shift
|
|---|
| 217 | set _KBUILD_SHOW_VAR_PREFIX=
|
|---|
| 218 | goto argument_loop
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 | REM #
|
|---|
| 222 | REM # Syntax
|
|---|
| 223 | REM #
|
|---|
| 224 | :do_help
|
|---|
| 225 | echo kBuild environment setup script for Windows NT.
|
|---|
| 226 | echo Syntax: envwin.cmd [options] [command to be executed]
|
|---|
| 227 | echo or: envwin.cmd [options] --var varname
|
|---|
| 228 | echo .
|
|---|
| 229 | echo Options:
|
|---|
| 230 | echo --win
|
|---|
| 231 | echo Force windows target and host platform.
|
|---|
| 232 | echo --win32
|
|---|
| 233 | echo Force x86 32-bit windows target platform.
|
|---|
| 234 | echo --win64
|
|---|
| 235 | echo Force AMD64 64-bit windows target platform.
|
|---|
| 236 | echo --nt
|
|---|
| 237 | echo Force NT target and host platform.
|
|---|
| 238 | echo --nt32
|
|---|
| 239 | echo Force x86 32-bit NT target platform.
|
|---|
| 240 | echo --nt64
|
|---|
| 241 | echo Force AMD64 64-bit NT target platform.
|
|---|
| 242 | echo --debug, --release, --profile
|
|---|
| 243 | echo Alternative way of specifying KBUILD_TYPE.
|
|---|
| 244 | echo --full, --normal
|
|---|
| 245 | echo Controls the variable set. Default: --normal
|
|---|
| 246 | echo --legacy, --no-legacy
|
|---|
| 247 | echo Include legacy variables in result. Default: --legacy
|
|---|
| 248 | echo --value-only, --name-and-value
|
|---|
| 249 | echo Controls what the result of a --var query. Default: --name-and-value
|
|---|
| 250 | echo --set, --no-set
|
|---|
| 251 | echo Whether to prefix the variable output with 'SET' or not.
|
|---|
| 252 | echo Default: --no-set
|
|---|
| 253 |
|
|---|
| 254 | goto end
|
|---|
| 255 |
|
|---|
| 256 | :done_arguments
|
|---|
| 257 |
|
|---|
| 258 | REM
|
|---|
| 259 | REM Convert legacy variable names.
|
|---|
| 260 | REM
|
|---|
| 261 | if ".%_KBUILD_OPT_OVERRIDE_ALL%" == ".1" goto legacy_convertion_done
|
|---|
| 262 |
|
|---|
| 263 | set _KBUILD_VARS=KBUILD_HOST (%_KBUILD_HOST%) and BUILD_PLATFORM (%BUILD_PLATFORM%)
|
|---|
| 264 | if not ".%BUILD_PLATFORM%" == "." if not ".%_KBUILD_HOST%" == "." if ".%_KBUILD_HOST%" == ".%BUILD_PLATFORM%" goto legacy_mismatch
|
|---|
| 265 | if not ".%BUILD_PLATFORM%" == "." set _KBUILD_HOST=%BUILD_PLATFORM%
|
|---|
| 266 |
|
|---|
| 267 | set _KBUILD_VARS=KBUILD_HOST_ARCH (%_KBUILD_HOST_ARCH%) and BUILD_PLATFORM_ARCH (%BUILD_PLATFORM_ARCH%)
|
|---|
| 268 | if not ".%BUILD_PLATFORM_ARCH%" == "." if not ".%_KBUILD_HOST_ARCH%" == "." if ".%_KBUILD_HOST_ARCH%" == ".%BUILD_PLATFORM_ARCH%" goto legacy_mismatch
|
|---|
| 269 | if not ".%BUILD_PLATFORM_ARCH%" == "." set _KBUILD_HOST_ARCH=%BUILD_PLATFORM_ARCH%
|
|---|
| 270 |
|
|---|
| 271 | set _KBUILD_VARS=KBUILD_HOST_CPU (%_KBUILD_HOST_CPU%) and BUILD_PLATFORM_CPU (%BUILD_PLATFORM_CPU%)
|
|---|
| 272 | if not ".%BUILD_PLATFORM_CPU%" == "." if not ".%_KBUILD_HOST_CPU%" == "." if ".%_KBUILD_HOST_CPU%" == ".%BUILD_PLATFORM_CPU%" goto legacy_mismatch
|
|---|
| 273 | if not ".%BUILD_PLATFORM_CPU%" == "." set _KBUILD_HOST_CPU=%BUILD_PLATFORM_CPU%
|
|---|
| 274 |
|
|---|
| 275 | if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target
|
|---|
| 276 | set _KBUILD_VARS=KBUILD_TARGET (%_KBUILD_TARGET%) and BUILD_TARGET (%BUILD_TARGET%)
|
|---|
| 277 | if not ".%BUILD_TARGET%" == "." if not ".%_KBUILD_TARGET%" == "." if ".%_KBUILD_TARGET%" == ".%BUILD_TARGET%" goto legacy_mismatch
|
|---|
| 278 | if not ".%BUILD_TARGET%" == "." set _KBUILD_TARGET=%BUILD_TARGET%
|
|---|
| 279 | :legacy_skip_target
|
|---|
| 280 |
|
|---|
| 281 | if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target_arch
|
|---|
| 282 | set _KBUILD_VARS=KBUILD_TARGET_ARCH (%_KBUILD_TARGET_ARCH%) and BUILD_TARGET_ARCH (%BUILD_TARGET_ARCH%)
|
|---|
| 283 | if not ".%BUILD_TARGET_ARCH%" == "." if not ".%_KBUILD_TARGET_ARCH%" == "." if ".%_KBUILD_TARGET_ARCH%" == ".%BUILD_TARGET_ARCH%" goto legacy_mismatch
|
|---|
| 284 | if not ".%BUILD_TARGET_ARCH%" == "." set _KBUILD_TARGET_ARCH=%BUILD_TARGET_ARCH%
|
|---|
| 285 | :legacy_skip_target_arch
|
|---|
| 286 |
|
|---|
| 287 | if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_target_cpu
|
|---|
| 288 | set _KBUILD_VARS=KBUILD_TARGET_CPU (%_KBUILD_TARGET_CPU%) and BUILD_TARGET_CPU (%BUILD_TARGET_CPU%)
|
|---|
| 289 | if not ".%BUILD_TARGET_CPU%" == "." if not ".%_KBUILD_TARGET_CPU%" == "." if ".%_KBUILD_TARGET_CPU%" == ".%BUILD_TARGET_CPU%" goto legacy_mismatch
|
|---|
| 290 | if not ".%BUILD_TARGET_CPU%" == "." set _KBUILD_TARGET_CPU=%BUILD_TARGET_CPU%
|
|---|
| 291 | :legacy_skip_target_cpu
|
|---|
| 292 |
|
|---|
| 293 | if ".%_KBUILD_OVERRIDE_TARGET%" == ".1" goto legacy_skip_type
|
|---|
| 294 | set _KBUILD_VARS=KBUILD_TYPE (%_KBUILD_TYPE%) and BUILD_TYPE (%BUILD_TYPE%)
|
|---|
| 295 | if not ".%BUILD_TYPE%" == "." if not ".%_KBUILD_TYPE%" == "." if ".%_KBUILD_TYPE%" == ".%BUILD_TYPE%" goto legacy_mismatch
|
|---|
| 296 | if not ".%BUILD_TYPE%" == "." set _KBUILD_TYPE=%BUILD_TYPE%
|
|---|
| 297 | :legacy_skip_type
|
|---|
| 298 |
|
|---|
| 299 | set _KBUILD_VARS=KBUILD_PATH (%_KBUILD_PATH%) and PATH_KBUILD (%PATH_KBUILD%)
|
|---|
| 300 | if not ".%PATH_KBUILD%" == "." if not ".%_KBUILD_PATH%" == "." if ".%_KBUILD_PATH%" == ".%PATH_KBUILD%" goto legacy_mismatch
|
|---|
| 301 | if not ".%PATH_KBUILD%" == "." set _KBUILD_PATH=%PATH_KBUILD%
|
|---|
| 302 | goto legacy_convertion_done
|
|---|
| 303 |
|
|---|
| 304 | :legacy_mismatch
|
|---|
| 305 | echo error: %_KBUILD_VARS% disagree.
|
|---|
| 306 | goto failed
|
|---|
| 307 |
|
|---|
| 308 | :legacy_convertion_done
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 | REM
|
|---|
| 312 | REM Check for illegal target/platforms.
|
|---|
| 313 | REM
|
|---|
| 314 | :target_and_platform
|
|---|
| 315 | if "%_KBUILD_TARGET" == "win32" goto illegal_target
|
|---|
| 316 | if "%_KBUILD_TARGET" == "win64" goto illegal_target
|
|---|
| 317 | if "%_KBUILD_HOST" == "win32" goto illegal_host
|
|---|
| 318 | if "%_KBUILD_HOST" == "win64" goto illegal_host
|
|---|
| 319 | goto target_and_platform_ok
|
|---|
| 320 |
|
|---|
| 321 | :illegal_target
|
|---|
| 322 | echo error: KBUILD_TARGET=%KBUILD_TARGET% is no longer valid.
|
|---|
| 323 | echo Only 'win' and 'nt' are permitted for targeting microsoft windows.
|
|---|
| 324 | goto failed
|
|---|
| 325 |
|
|---|
| 326 | :illegal_host
|
|---|
| 327 | echo error: KBUILD_HOST=%KBUILD_HOST is no longer valid.
|
|---|
| 328 | echo Only 'win' and 'nt' are permitted for building on microsoft windows.
|
|---|
| 329 | goto failed
|
|---|
| 330 |
|
|---|
| 331 | :target_and_platform_ok
|
|---|
| 332 |
|
|---|
| 333 | REM
|
|---|
| 334 | REM Find kBuild.
|
|---|
| 335 | REM
|
|---|
| 336 | REM We'll try determin the location of this script first and use that
|
|---|
| 337 | REM as a starting point for guessing the kBuild directory.
|
|---|
| 338 | REM
|
|---|
| 339 |
|
|---|
| 340 | REM Check if set via KBUILD_PATH.
|
|---|
| 341 | if not ".%_KBUILD_PATH%" == "." if exist %_KBUILD_PATH%\footer.kmk goto found_kbuild
|
|---|
| 342 |
|
|---|
| 343 | REM Determin a correct self - by %0
|
|---|
| 344 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 345 | set _KBUILD_SELF=%_KBUILD_SELF%.cmd
|
|---|
| 346 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 347 |
|
|---|
| 348 | REM Determin a correct self - by the PATH
|
|---|
| 349 | REM This is very verbose because nested for loops didn't work out.
|
|---|
| 350 | for /f "tokens=1 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 351 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 352 | for /f "tokens=2 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 353 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 354 | for /f "tokens=3 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 355 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 356 | for /f "tokens=4 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 357 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 358 | for /f "tokens=5 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 359 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 360 | for /f "tokens=6 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 361 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 362 | for /f "tokens=7 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 363 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 364 | for /f "tokens=8 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 365 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 366 | for /f "tokens=9 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 367 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 368 | for /f "tokens=10 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 369 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 370 | for /f "tokens=11 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 371 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 372 | for /f "tokens=12 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 373 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 374 | for /f "tokens=13 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 375 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 376 | for /f "tokens=14 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 377 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 378 | for /f "tokens=15 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 379 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 380 | for /f "tokens=16 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 381 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 382 | for /f "tokens=17 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 383 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 384 | for /f "tokens=18 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 385 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 386 | for /f "tokens=19 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 387 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 388 | for /f "tokens=20 delims=;" %%d in ("%PATH%") do set _KBUILD_SELF=%%d\envwin.cmd
|
|---|
| 389 | if exist "%_KBUILD_SELF%" goto found_self
|
|---|
| 390 | goto try_by_pwd
|
|---|
| 391 |
|
|---|
| 392 | :found_self
|
|---|
| 393 | cd "%_KBUILD_SELF%\.."
|
|---|
| 394 | for /f "tokens=*" %%d in ('cd') do set _KBUILD_PATH=%%d
|
|---|
| 395 | cd "%_KBUILD_CURDIR%"
|
|---|
| 396 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 397 |
|
|---|
| 398 | REM Try relative to the current directory.
|
|---|
| 399 | :try_by_pwd
|
|---|
| 400 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 401 | set _KBUILD_PATH=%_KBUILD_CURDIR%
|
|---|
| 402 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 403 | set _KBUILD_PATH=%_KBUILD_CURDIR%\kBuild
|
|---|
| 404 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 405 | set _KBUILD_PATH=%_KBUILD_CURDIR%\..\kBuild
|
|---|
| 406 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 407 | set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\kBuild
|
|---|
| 408 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 409 | set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\..\kBuild
|
|---|
| 410 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 411 | set _KBUILD_PATH=%_KBUILD_CURDIR%\..\..\..\..\kBuild
|
|---|
| 412 | if exist "%_KBUILD_PATH%\footer.kmk" goto found_kbuild
|
|---|
| 413 | echo kBuild: Can't find the kBuild directory!
|
|---|
| 414 | set CURDIR=
|
|---|
| 415 | goto failed
|
|---|
| 416 |
|
|---|
| 417 | :found_kbuild
|
|---|
| 418 | cd "%_KBUILD_PATH%"
|
|---|
| 419 | for /f "tokens=*" %%d in ('cd') do set _KBUILD_PATH=%%d
|
|---|
| 420 | cd "%_KBUILD_CURDIR%"
|
|---|
| 421 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_PATH=%_KBUILD_PATH%
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 | REM
|
|---|
| 425 | REM Type - release is the default.
|
|---|
| 426 | REM
|
|---|
| 427 | if not ".%_KBUILD_TYPE%" == "." goto have_type
|
|---|
| 428 | set _KBUILD_TYPE=release
|
|---|
| 429 | :have_type
|
|---|
| 430 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TYPE=%_KBUILD_TYPE%
|
|---|
| 431 |
|
|---|
| 432 |
|
|---|
| 433 | REM
|
|---|
| 434 | REM Host platform - windows
|
|---|
| 435 | REM
|
|---|
| 436 | if not ".%_KBUILD_HOST%" == "." goto have_host
|
|---|
| 437 | set _KBUILD_HOST=win
|
|---|
| 438 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST=%_KBUILD_HOST%
|
|---|
| 439 | :have_host
|
|---|
| 440 |
|
|---|
| 441 | if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
|
|---|
| 442 | REM try guess from _KBUILD_HOST_CPU
|
|---|
| 443 | if ".%KBUILD_HOST_CPU%" == ".i386" set _KBUILD_HOST_ARCH=x86
|
|---|
| 444 | if ".%KBUILD_HOST_CPU%" == ".i486" set _KBUILD_HOST_ARCH=x86
|
|---|
| 445 | if ".%KBUILD_HOST_CPU%" == ".i586" set _KBUILD_HOST_ARCH=x86
|
|---|
| 446 | if ".%KBUILD_HOST_CPU%" == ".i686" set _KBUILD_HOST_ARCH=x86
|
|---|
| 447 | if ".%KBUILD_HOST_CPU%" == ".i786" set _KBUILD_HOST_ARCH=x86
|
|---|
| 448 | if ".%KBUILD_HOST_CPU%" == ".i886" set _KBUILD_HOST_ARCH=x86
|
|---|
| 449 | if ".%KBUILD_HOST_CPU%" == ".i986" set _KBUILD_HOST_ARCH=x86
|
|---|
| 450 | if ".%KBUILD_HOST_CPU%" == ".k8" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 451 | if ".%KBUILD_HOST_CPU%" == ".k9" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 452 | if ".%KBUILD_HOST_CPU%" == ".k10" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 453 | if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
|
|---|
| 454 | REM try guess from PROCESSOR_ARCHITEW6432 and PROCESSOR_ARCHITECTURE
|
|---|
| 455 | set _KBUILD_TMP=%PROCESSOR_ARCHITECTURE%
|
|---|
| 456 | if not ".%PROCESSOR_ARCHITEW6432%" == "." set _KBUILD_TMP=%PROCESSOR_ARCHITEW6432%
|
|---|
| 457 | if "%_KBUILD_TMP%" == "x86" set _KBUILD_HOST_ARCH=x86
|
|---|
| 458 | if "%_KBUILD_TMP%" == "X86" set _KBUILD_HOST_ARCH=x86
|
|---|
| 459 | if "%_KBUILD_TMP%" == "amd64" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 460 | if "%_KBUILD_TMP%" == "Amd64" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 461 | if "%_KBUILD_TMP%" == "AMD64" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 462 | if "%_KBUILD_TMP%" == "x64" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 463 | if "%_KBUILD_TMP%" == "X64" set _KBUILD_HOST_ARCH=amd64
|
|---|
| 464 | if not ".%_KBUILD_HOST_ARCH%" == "." goto have_host_arch
|
|---|
| 465 | echo error: Cannot figure KBUILD_HOST_ARCH!
|
|---|
| 466 | goto failed
|
|---|
| 467 | :have_host_arch
|
|---|
| 468 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
|
|---|
| 469 |
|
|---|
| 470 | if not ".%_KBUILD_HOST_CPU%" == "." goto have_host_cpu
|
|---|
| 471 | set _KBUILD_HOST_CPU=blend
|
|---|
| 472 | :have_host_cpu
|
|---|
| 473 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 474 |
|
|---|
| 475 | REM
|
|---|
| 476 | REM The target platform.
|
|---|
| 477 | REM Defaults to the host when not specified.
|
|---|
| 478 | REM
|
|---|
| 479 | if not ".%_KBUILD_TARGET%" == "." goto have_target
|
|---|
| 480 | set _KBUILD_TARGET=%_KBUILD_HOST%
|
|---|
| 481 | :have_target
|
|---|
| 482 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET=%_KBUILD_TARGET%
|
|---|
| 483 |
|
|---|
| 484 | if not ".%_KBUILD_TARGET_ARCH%" == "." goto have_target_arch
|
|---|
| 485 | set _KBUILD_TARGET_ARCH=%_KBUILD_HOST_ARCH%
|
|---|
| 486 | :have_target_arch
|
|---|
| 487 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
|
|---|
| 488 |
|
|---|
| 489 | if not ".%_KBUILD_TARGET_CPU%" == "." goto have_target_cpu
|
|---|
| 490 | if ".%_KBUILD_TARGET_ARCH%" == ".%_KBUILD_HOST_ARCH%" set _KBUILD_TARGET_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 491 | if not ".%_KBUILD_TARGET_CPU%" == "." goto have_target_cpu
|
|---|
| 492 | set _KBUILD_TARGET_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 493 | :have_target_cpu
|
|---|
| 494 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
|
|---|
| 495 |
|
|---|
| 496 | REM
|
|---|
| 497 | REM Calc KBUILD_BIN_PATH and the new PATH value.
|
|---|
| 498 | REM
|
|---|
| 499 | if not ".%_KBUILD_BIN_PATH%" == "." goto have_kbuild_bin_path
|
|---|
| 500 | set _KBUILD_BIN_PATH=%_KBUILD_PATH%\bin\win.%_KBUILD_HOST_ARCH%
|
|---|
| 501 | :have_kbuild_bin_path
|
|---|
| 502 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
|
|---|
| 503 |
|
|---|
| 504 | set _KBUILD_NEW_PATH=%_KBUILD_BIN_PATH%;%PATH%
|
|---|
| 505 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: _KBUILD_NEW_PATH=%_KBUILD_NEW_PATH%
|
|---|
| 506 |
|
|---|
| 507 | REM
|
|---|
| 508 | REM Sanity check.
|
|---|
| 509 | REM
|
|---|
| 510 | if not exist "%_KBUILD_BIN_PATH%" goto missing_bin_path
|
|---|
| 511 | if not exist "%_KBUILD_BIN_PATH%" goto done_chekcing_for_tools
|
|---|
| 512 | set _KBUILD_TMP=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
|
|---|
| 513 | for %%i in ( %_KBUILD_TMP% ) do if not exist "%_KBUILD_BIN_PATH%\%%i.exe" echo warning: The %%i program doesn't exist for this platform. (%_KBUILD_BIN_PATH%\%%i.exe)"
|
|---|
| 514 | goto done_chekcing_for_tools
|
|---|
| 515 |
|
|---|
| 516 | :missing_bin_path
|
|---|
| 517 | echo warning: The bin directory for this platform doesn't exist. (%_KBUILD_BIN_PATH%)
|
|---|
| 518 | :done_chekcing_for_tools
|
|---|
| 519 |
|
|---|
| 520 | REM
|
|---|
| 521 | REM The environment is in place, now take the requested action.
|
|---|
| 522 | REM
|
|---|
| 523 | if ".%_KBUILD_OPT_VAR%" == "." goto exec_or_setup_env
|
|---|
| 524 | goto show_variable
|
|---|
| 525 |
|
|---|
| 526 | REM
|
|---|
| 527 | REM Show a set of variables.
|
|---|
| 528 | REM
|
|---|
| 529 | REM Note: 4nt doesn't grok the setlocal delayed expansion option.
|
|---|
| 530 | REM So, we'll have to identify which shell we're running.
|
|---|
| 531 | REM
|
|---|
| 532 | :show_variable
|
|---|
| 533 | for %%i in ( %_KBUILD_OPT_VAR% ) do if "%%i" == "all" goto show_all_variables
|
|---|
| 534 |
|
|---|
| 535 | if not ".%_4VER%" == "." goto 4nt
|
|---|
| 536 | setlocal ENABLEDELAYEDEXPANSION
|
|---|
| 537 | if errorlevel 1 goto no_delay_expansion
|
|---|
| 538 |
|
|---|
| 539 | for %%i in ( %_KBUILD_OPT_VAR% ) do (
|
|---|
| 540 | set _KBUILD_VAR=%%i
|
|---|
| 541 | set _KBUILD_TMP=
|
|---|
| 542 | if "%%i" == "KBUILD_PATH" set _KBUILD_TMP=%_KBUILD_PATH%
|
|---|
| 543 | if "%%i" == "KBUILD_BIN_PATH" set _KBUILD_TMP=%_KBUILD_BIN_PATH%
|
|---|
| 544 | if "%%i" == "KBUILD_TYPE" set _KBUILD_TMP=%_KBUILD_TYPE%
|
|---|
| 545 | if "%%i" == "KBUILD_HOST" set _KBUILD_TMP=%_KBUILD_HOST%
|
|---|
| 546 | if "%%i" == "KBUILD_HOST_ARCH" set _KBUILD_TMP=%_KBUILD_HOST_ARCH%
|
|---|
| 547 | if "%%i" == "KBUILD_HOST_CPU" set _KBUILD_TMP=%_KBUILD_HOST_CPU%
|
|---|
| 548 | if "%%i" == "KBUILD_TARGET" set _KBUILD_TMP=%_KBUILD_TARGET%
|
|---|
| 549 | if "%%i" == "KBUILD_TARGET_ARCH" set _KBUILD_TMP=%_KBUILD_TARGET_ARCH%
|
|---|
| 550 | if "%%i" == "KBUILD_TARGET_CPU" set _KBUILD_TMP=%_KBUILD_TARGET_CPU%
|
|---|
| 551 | if ".!_KBUILD_TMP!" == "." goto varible_not_found
|
|---|
| 552 | if not ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_SHOW_VAR_PREFIX%%%i=!_KBUILD_TMP!
|
|---|
| 553 | if ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo !_KBUILD_TMP!
|
|---|
| 554 | )
|
|---|
| 555 |
|
|---|
| 556 | endlocal
|
|---|
| 557 | goto end
|
|---|
| 558 |
|
|---|
| 559 | :no_delay_expansion
|
|---|
| 560 | echo error: Unable to enable delayed expansion in the shell.
|
|---|
| 561 |
|
|---|
| 562 | :4nt
|
|---|
| 563 | for %%i in ( %_KBUILD_OPT_VAR% ) do (
|
|---|
| 564 | set _KBUILD_VAR=%%i
|
|---|
| 565 | set _KBUILD_TMP=
|
|---|
| 566 | if "%%i" == "KBUILD_PATH" set _KBUILD_TMP=%_KBUILD_PATH%
|
|---|
| 567 | if "%%i" == "KBUILD_BIN_PATH" set _KBUILD_TMP=%_KBUILD_BIN_PATH%
|
|---|
| 568 | if "%%i" == "KBUILD_TYPE" set _KBUILD_TMP=%_KBUILD_TYPE%
|
|---|
| 569 | if "%%i" == "KBUILD_HOST" set _KBUILD_TMP=%_KBUILD_HOST%
|
|---|
| 570 | if "%%i" == "KBUILD_HOST_ARCH" set _KBUILD_TMP=%_KBUILD_HOST_ARCH%
|
|---|
| 571 | if "%%i" == "KBUILD_HOST_CPU" set _KBUILD_TMP=%_KBUILD_HOST_CPU%
|
|---|
| 572 | if "%%i" == "KBUILD_TARGET" set _KBUILD_TMP=%_KBUILD_TARGET%
|
|---|
| 573 | if "%%i" == "KBUILD_TARGET_ARCH" set _KBUILD_TMP=%_KBUILD_TARGET_ARCH%
|
|---|
| 574 | if "%%i" == "KBUILD_TARGET_CPU" set _KBUILD_TMP=%_KBUILD_TARGET_CPU%
|
|---|
| 575 | if ".%_KBUILD_TMP%" == "." goto varible_not_found
|
|---|
| 576 | if not ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_SHOW_VAR_PREFIX%%i=%_KBUILD_TMP%
|
|---|
| 577 | if ".%_KBUILD_OPT_VALUE_ONLY%" == ".1" echo %_KBUILD_TMP%
|
|---|
| 578 | )
|
|---|
| 579 | goto end
|
|---|
| 580 |
|
|---|
| 581 | :varible_not_found
|
|---|
| 582 | echo error: Unknown variable %_KBUILD_VAR% specified in --var request.
|
|---|
| 583 | goto failed
|
|---|
| 584 |
|
|---|
| 585 | :show_all_variables
|
|---|
| 586 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_PATH=%_KBUILD_PATH%
|
|---|
| 587 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
|
|---|
| 588 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TYPE=%_KBUILD_TYPE%
|
|---|
| 589 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST=%_KBUILD_HOST%
|
|---|
| 590 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
|
|---|
| 591 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 592 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET=%_KBUILD_TARGET%
|
|---|
| 593 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
|
|---|
| 594 | echo %_KBUILD_SHOW_VAR_PREFIX%KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
|
|---|
| 595 | goto end
|
|---|
| 596 |
|
|---|
| 597 | REM
|
|---|
| 598 | REM Setup environment for the current shell or execute a command.
|
|---|
| 599 | REM
|
|---|
| 600 | REM Note: We use setlocal if we're going to execute a command as we
|
|---|
| 601 | REM don't want the environment of the invoking shell to be changed.
|
|---|
| 602 | REM
|
|---|
| 603 | :exec_or_setup_env
|
|---|
| 604 | if not ".%1" == "." setlocal
|
|---|
| 605 |
|
|---|
| 606 | REM The PATH is always set.
|
|---|
| 607 | set PATH=%_KBUILD_NEW_PATH%
|
|---|
| 608 |
|
|---|
| 609 | REM Clear up anything that should be overridden.
|
|---|
| 610 | if not "%_KBUILD_OPT_OVERRIDE_ALL%" == "1" goto skip_override_all
|
|---|
| 611 | set KBUILD_TYPE=
|
|---|
| 612 | set KBUILD_HOST=
|
|---|
| 613 | set KBUILD_HOST_ARCH=
|
|---|
| 614 | set KBUILD_HOST_CPU=
|
|---|
| 615 | set KBUILD_TARGET=
|
|---|
| 616 | set KBUILD_TARGET_ARCH=
|
|---|
| 617 | set KBUILD_TARGET_CPU=
|
|---|
| 618 | set KBUILD_PATH=
|
|---|
| 619 | set KBUILD_BIN_PATH=
|
|---|
| 620 | if not "%_KBUILD_OPT_LEGACY%" == "1" goto skip_override_all
|
|---|
| 621 | set BUILD_TYPE=
|
|---|
| 622 | set BUILD_PLATFORM=
|
|---|
| 623 | set BUILD_PLATFORM_ARCH=
|
|---|
| 624 | set BUILD_PLATFORM_CPU=
|
|---|
| 625 | set BUILD_TARGET=
|
|---|
| 626 | set BUILD_TARGET_ARCH=
|
|---|
| 627 | set BUILD_TARGET_CPU=
|
|---|
| 628 | set PATH_KBUILD=
|
|---|
| 629 | set PATH_KBUILD_BIN=
|
|---|
| 630 | :skip_override_all
|
|---|
| 631 |
|
|---|
| 632 | REM Specific overrides, these implicitly deletes the legacy variable.
|
|---|
| 633 | if "%_KBUILD_OVERRIDE_TARGET%" == "1" set KBUILD_TARGET=%_KBUILD_TARGET%
|
|---|
| 634 | if "%_KBUILD_OVERRIDE_TARGET%" == "1" set BUILD_TARGET=
|
|---|
| 635 | if "%_KBUILD_OVERRIDE_TARGET_ARCH%" == "1" set KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
|
|---|
| 636 | if "%_KBUILD_OVERRIDE_TARGET_ARCH%" == "1" set BUILD_TARGET_ARCH=
|
|---|
| 637 | if "%_KBUILD_OVERRIDE_TYPE%" == "1" set KBUILD_TYPE=%_KBUILD_TYPE%
|
|---|
| 638 | if "%_KBUILD_OVERRIDE_TYPE%" == "1" set BUILD_TYPE=
|
|---|
| 639 |
|
|---|
| 640 | if not "%_KBUILD_OPT_FULL%" == "1" goto env_setup_done
|
|---|
| 641 | set KBUILD_PATH=%_KBUILD_PATH%
|
|---|
| 642 | set KBUILD_BIN_PATH=%_KBUILD_BIN_PATH%
|
|---|
| 643 | set KBUILD_TYPE=%_KBUILD_TYPE%
|
|---|
| 644 | set KBUILD_HOST=%_KBUILD_HOST%
|
|---|
| 645 | set KBUILD_HOST_ARCH=%_KBUILD_HOST_ARCH%
|
|---|
| 646 | set KBUILD_HOST_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 647 | set KBUILD_TARGET=%_KBUILD_TARGET%
|
|---|
| 648 | set KBUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
|
|---|
| 649 | set KBUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
|
|---|
| 650 |
|
|---|
| 651 | if not "%_KBUILD_OPT_LEGACY%" == "1" goto env_setup_done
|
|---|
| 652 | set PATH_KBUILD=%_KBUILD_PATH%
|
|---|
| 653 | set PATH_KBUILD_BIN=%_KBUILD_BIN_PATH%
|
|---|
| 654 | set BUILD_TYPE=%_KBUILD_TYPE%
|
|---|
| 655 | set BUILD_PLATFORM=%_KBUILD_HOST%
|
|---|
| 656 | set BUILD_PLATFORM_ARCH=%_KBUILD_HOST_ARCH%
|
|---|
| 657 | set BUILD_PLATFORM_CPU=%_KBUILD_HOST_CPU%
|
|---|
| 658 | set BUILD_TARGET=%_KBUILD_TARGET%
|
|---|
| 659 | set BUILD_TARGET_ARCH=%_KBUILD_TARGET_ARCH%
|
|---|
| 660 | set BUILD_TARGET_CPU=%_KBUILD_TARGET_CPU%
|
|---|
| 661 |
|
|---|
| 662 | :env_setup_done
|
|---|
| 663 | if ".%1" == "." goto end
|
|---|
| 664 |
|
|---|
| 665 | REM Execute the specified command
|
|---|
| 666 | if ".%_KBUILD_OPT_DBG%" == ".1" echo dbg: Executing: %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|---|
| 667 | set _KBUILD_CLEAN_GOTO=exec_command & goto cleanup
|
|---|
| 668 | :exec_command
|
|---|
| 669 | SET _KBUILD_CLEAN_GOTO=
|
|---|
| 670 | %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|---|
| 671 | endlocal
|
|---|
| 672 | goto end_no_exit
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 | REM
|
|---|
| 677 | REM All exit paths leads to 'end' or 'failed' depending on
|
|---|
| 678 | REM which exit code is desire. This is required as we're manually
|
|---|
| 679 | REM performing environment cleanup (setlocal/endlocal is crap).
|
|---|
| 680 | REM
|
|---|
| 681 | :cleanup
|
|---|
| 682 | set _KBUILD_CURDIR=
|
|---|
| 683 | set _KBUILD_PATH=
|
|---|
| 684 | set _KBUILD_BIN_PATH=
|
|---|
| 685 | set _KBUILD_NEW_PATH=
|
|---|
| 686 | set _KBUILD_TYPE=
|
|---|
| 687 | set _KBUILD_TARGET=
|
|---|
| 688 | set _KBUILD_TARGET_ARCH=
|
|---|
| 689 | set _KBUILD_TARGET_CPU=
|
|---|
| 690 | set _KBUILD_HOST=
|
|---|
| 691 | set _KBUILD_HOST_ARCH=
|
|---|
| 692 | set _KBUILD_HOST_CPU=
|
|---|
| 693 | set _KBUILD_OPT_OVERRIDE_ALL=
|
|---|
| 694 | set _KBUILD_OVERRIDE_TYPE=
|
|---|
| 695 | set _KBUILD_OVERRIDE_TARGET=
|
|---|
| 696 | set _KBUILD_OVERRIDE_TARGET_ARCH=
|
|---|
| 697 |
|
|---|
| 698 | set _KBUILD_SELF=
|
|---|
| 699 | set _KBUILD_OPT_FULL=
|
|---|
| 700 | set _KBUILD_OPT_LEGACY=
|
|---|
| 701 | set _KBUILD_OPT_VAR=
|
|---|
| 702 | set _KBUILD_OPT_VALUE_ONLY=
|
|---|
| 703 | set _KBUILD_SHOW_VAR_PREFIX=
|
|---|
| 704 | set _KBUILD_OPT_DBG=
|
|---|
| 705 | set _KBUILD_OPT_OVERRIDE_ALL=
|
|---|
| 706 |
|
|---|
| 707 | set _KBUILD_TMP=
|
|---|
| 708 | set _KBUILD_VAR=
|
|---|
| 709 | set _KBUILD_VARS=
|
|---|
| 710 | goto %_KBUILD_CLEAN_GOTO%
|
|---|
| 711 |
|
|---|
| 712 | :failed
|
|---|
| 713 | set _KBUILD_CLEAN_GOTO=failed_done & goto cleanup
|
|---|
| 714 | :failed_done
|
|---|
| 715 | set _KBUILD_CLEAN_GOTO=
|
|---|
| 716 | exit /b 1
|
|---|
| 717 |
|
|---|
| 718 | :end
|
|---|
| 719 | set _KBUILD_CLEAN_GOTO=end_done & goto cleanup
|
|---|
| 720 | :end_done
|
|---|
| 721 | set _KBUILD_CLEAN_GOTO=
|
|---|
| 722 | exit /b 0
|
|---|
| 723 |
|
|---|
| 724 | :end_no_exit
|
|---|
| 725 |
|
|---|