]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/GetVariables.bat
Fix CreateBootDisk.bat not using config variables
[mirror_edk2.git] / DuetPkg / GetVariables.bat
diff --git a/DuetPkg/GetVariables.bat b/DuetPkg/GetVariables.bat
new file mode 100644 (file)
index 0000000..c781228
--- /dev/null
@@ -0,0 +1,38 @@
+@REM ## @file\r
+@REM #\r
+@REM #  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+@REM #\r
+@REM #  This program and the accompanying materials\r
+@REM #  are licensed and made available under the terms and conditions of the BSD License\r
+@REM #  which accompanies this distribution. The full text of the license may be found at\r
+@REM #  http://opensource.org/licenses/bsd-license.php\r
+@REM #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+@REM #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+@REM #\r
+@REM #\r
+@REM ##\r
+\r
+\r
+@REM Read the variables from Conf/target.txt\r
+@REM Because we can't add '=' as a delimiter in 'for', each variable is read in 2 parts:\r
+@REM First we read the "= xyz" part of the variable assignation which we use, along with\r
+@REM the original equal sign for our first assignation. Then we trim any left whitespaces.\r
+@REM NB: default token delimiters for "for /f" are tab and space.\r
+\r
+@set CONFIG_FILE=%WORKSPACE%\Conf\target.txt\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TOOL_CHAIN_TAG" ^| find /V "#"') do @set TOOL_CHAIN_TAG%%j\r
+@for /f "tokens=*" %%i in ("%TOOL_CHAIN_TAG%") do @set TOOL_CHAIN_TAG=%%i\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET" ^| find /V "#" ^| find /V "TARGET_ARCH"') do @set TARGET%%j\r
+@for /f "tokens=*" %%i in ("%TARGET%") do @set TARGET=%%i\r
+\r
+@for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET_ARCH" ^|find /V "#"') do @set TARGET_ARCH%%j\r
+@for /f "tokens=*" %%i in ("%TARGET_ARCH%") do @set TARGET_ARCH=%%i\r
+\r
+\r
+@REM Set defaults if above variables are undefined in target.txt\r
+\r
+@if "%TOOL_CHAIN_TAG%%"=="" @set TOOL_CHAIN_TAG=MYTOOLS\r
+@if "%TARGET%"=="" @set TARGET=DEBUG\r
+@if "%TARGET_ARCH%"=="" @set TARGET_ARCH=IA32\r