bld.bat 4.0 KB

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