bld.bat 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. @REM @file
  2. @REM
  3. @REM Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
  4. @REM SPDX-License-Identifier: BSD-2-Clause-Patent
  5. @REM
  6. @echo off
  7. REM Run setlocal to take a snapshot of the environment variables. endlocal is called to restore the environment.
  8. setlocal
  9. set SCRIPT_ERROR=0
  10. REM ---- Do NOT use :: for comments Inside of code blocks() ----
  11. ::**********************************************************************
  12. :: Initial Setup
  13. ::**********************************************************************
  14. :parseCmdLine
  15. if "%1"=="" goto :argumentCheck
  16. if /I "%1"=="debug" set TARGET=DEBUG
  17. if /I "%1"=="release" set TARGET=RELEASE
  18. if /I "%1"=="clean" (
  19. set BUILD_TYPE=cleantree
  20. call :cleantree
  21. goto :EOF
  22. )
  23. shift
  24. GOTO :parseCmdLine
  25. :argumentCheck:
  26. if /I "%TARGET%" == "" (
  27. echo Info: debug/release argument is empty, use DEBUG as default
  28. set TARGET=DEBUG
  29. )
  30. REM Art to notify which board you're working on
  31. echo.
  32. type logo.txt
  33. echo.
  34. ::
  35. :: Build configuration
  36. ::
  37. set BUILD_REPORT_FLAGS=
  38. set BUILD_CMD_LINE=
  39. set BUILD_LOG=%WORKSPACE%\Build\build.log
  40. set BUILD_REPORT=%WORKSPACE%\Build\BuildReport.txt
  41. del %BUILD_LOG% *.efi *.log 2>NUL
  42. echo --------------------------------------------------------------------------------------------
  43. echo.
  44. echo Purley Build Start
  45. echo.
  46. echo --------------------------------------------------------------------------------------------
  47. :doPreBuild
  48. echo.
  49. echo --------------------------------------------------------------------
  50. echo.
  51. echo Prebuild Start
  52. echo.
  53. echo --------------------------------------------------------------------
  54. call prebuild.bat
  55. if %SCRIPT_ERROR% NEQ 0 EXIT /b %ERRORLEVEL%
  56. echo --------------------------------------------------------------------
  57. echo.
  58. echo Prebuild End
  59. echo.
  60. echo --------------------------------------------------------------------
  61. if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
  62. timeout 1
  63. :buildBios
  64. set BUILD_CMD_LINE=%BUILD_CMD_LINE% -D MAX_SOCKET=%MAX_SOCKET% -y %BUILD_REPORT%
  65. echo --------------------------------------------------------------------
  66. echo.
  67. echo Build Start
  68. echo.
  69. echo --------------------------------------------------------------------
  70. echo.
  71. echo build %BUILD_CMD_LINE% --log=%BUILD_LOG% %BUILD_REPORT_FLAGS%
  72. call build %BUILD_CMD_LINE% --log=%BUILD_LOG% %BUILD_REPORT_FLAGS%
  73. echo --------------------------------------------------------------------
  74. echo.
  75. echo Build End
  76. echo.
  77. echo --------------------------------------------------------------------
  78. if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
  79. timeout 1
  80. :postBuild
  81. echo --------------------------------------------------------------------
  82. echo.
  83. echo PostBuild Start
  84. echo.
  85. echo --------------------------------------------------------------------
  86. echo.
  87. call postbuild.bat
  88. if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL%
  89. timeout 1
  90. echo --------------------------------------------------------------------
  91. echo.
  92. echo PostBuild End
  93. echo.
  94. echo --------------------------------------------------------------------
  95. echo %date% %time%
  96. echo.
  97. echo --------------------------------------------------------------------------------------------
  98. echo.
  99. echo Purley Build End
  100. echo.
  101. echo --------------------------------------------------------------------------------------------
  102. :done
  103. endlocal & EXIT /b %SCRIPT_ERROR%
  104. ::--------------------------------------------------------
  105. ::-- Function section starts below here
  106. ::--------------------------------------------------------
  107. :cleantree
  108. choice /t 3 /d y /m "Confirm: clean tree of intermediate files created in tree during build"
  109. if %ERRORLEVEL% EQU 2 goto :EOF
  110. goto :EOF
  111. :ErrorHandler:
  112. echo Error handler