You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
8.2 KiB

  1. @setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
  2. @echo OFF
  3. set BAT_VERSION=v1.0
  4. set REPORT_NAME=Win_Check_Output.txt
  5. :: -----------------------------------------------------------------------------
  6. cls
  7. echo QMK Windows Check Output %BAT_VERSION%
  8. echo QMK Windows Check Output %BAT_VERSION%.>%REPORT_NAME%
  9. :: -----------------------------------------------------------------------------
  10. set MINGW_BASE_DIR=C:\MinGW
  11. set KEYMAP=atomic-pvc
  12. set KEYMAP_CLEAN=atomic-pvc-clean
  13. :: -----------------------------------------------------------------------------
  14. if /I "%1" EQU VERBOSE (goto :Verbose_Make) else (goto :Normal_Make)
  15. :Normal_Make
  16. set MAKE_CMD_LEVEL_0=make -r -f Makefile COLOR=FALSE
  17. set MAKE_CMD_LEVEL_1=make -r -f ../Makefile COLOR=FALSE
  18. set MAKE_CMD_LEVEL_2=make -r -f ../../Makefile COLOR=FALSE
  19. goto :Start_Report
  20. :Verbose_Make
  21. echo Verbose Mode
  22. set MAKE_CMD_LEVEL_0=make -r -d -f Makefile COLOR=FALSE VERBOSE=TRUE
  23. set MAKE_CMD_LEVEL_1=make -r -d -f ../Makefile COLOR=FALSE VERBOSE=TRUE
  24. set MAKE_CMD_LEVEL_2=make -r -d -f ../../Makefile COLOR=FALSE VERBOSE=TRUE
  25. goto :Start_Report
  26. :Start_Report
  27. :: -----------------------------------------------------------------------------
  28. set HEADER=CURRENT DIRECTORY & call :ReportHeader
  29. echo %CD%>>%REPORT_NAME% 2>&1
  30. echo.>>%REPORT_NAME% 2>&1
  31. :: -----------------------------------------------------------------------------
  32. set HEADER=CURRENT PATHS & call :ReportHeader
  33. for %%A in ("%path:;=";"%") do (echo %%~A>>%REPORT_NAME% 2>&1)
  34. echo.>>%REPORT_NAME% 2>&1
  35. :: -----------------------------------------------------------------------------
  36. rem set HEADER=CURRENT ENVIRONMENTAL SETTINGS & call :ReportHeader
  37. rem set>>%REPORT_NAME% 2>&1
  38. rem echo.>>%REPORT_NAME% 2>&1
  39. :: -----------------------------------------------------------------------------
  40. set HEADER=KEY EXECUTABLE LOCATIONS - GENERAL & call :ReportHeader
  41. set FILENAME=make.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU Make" & call :ReportVersion
  42. set FILENAME=git.exe & set VERSION_CMD=--version & set VERSION_FIND="git" & call :ReportVersion
  43. set FILENAME=cmp.exe & set VERSION_CMD=--version & set VERSION_FIND="cmp" & call :ReportVersion
  44. :: -----------------------------------------------------------------------------
  45. set HEADER=EXECUTABLE LOCATIONS - AVR MCU COMPILERS & call :ReportHeader
  46. set FILENAME=avr-gcc.exe & set VERSION_CMD=--version & set VERSION_FIND="avr" & call :ReportVersion
  47. set FILENAME=avr-objcopy.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objcopy" & call :ReportVersion
  48. set FILENAME=avr-objdump.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objdump" & call :ReportVersion
  49. set FILENAME=avr-size.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU size" & call :ReportVersion
  50. set FILENAME=avr-ar.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU ar" & call :ReportVersion
  51. set FILENAME=avr-nm.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU nm" & call :ReportVersion
  52. :: -----------------------------------------------------------------------------
  53. set HEADER=EXECUTABLE LOCATIONS - ARM MCU COMPILERS & call :ReportHeader
  54. set FILENAME=arm-none-eabi-gcc.exe & set VERSION_CMD=--version & set VERSION_FIND="arm-none-eabi-gcc" & call :ReportVersion
  55. set FILENAME=arm-none-eabi-objcopy.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objcopy" & call :ReportVersion
  56. set FILENAME=arm-none-eabi-objdump.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objdump" & call :ReportVersion
  57. set FILENAME=arm-none-eabi-size.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU size" & call :ReportVersion
  58. set FILENAME=arm-none-eabi-ar.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU ar" & call :ReportVersion
  59. set FILENAME=arm-none-eabi-nm.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU nm" & call :ReportVersion
  60. :: -----------------------------------------------------------------------------
  61. set HEADER=EXECUTABLE LOCATIONS - NATIVE COMPILERS & call :ReportHeader
  62. set FILENAME=gcc.exe & set VERSION_CMD=--version & set VERSION_FIND="gcc" & call :ReportVersion
  63. set FILENAME=objcopy.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objcopy" & call :ReportVersion
  64. set FILENAME=objdump.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU objdump" & call :ReportVersion
  65. set FILENAME=size.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU size" & call :ReportVersion
  66. set FILENAME=ar.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU ar" & call :ReportVersion
  67. set FILENAME=nm.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU nm" & call :ReportVersion
  68. :: -----------------------------------------------------------------------------
  69. set HEADER=EXECUTABLE LOCATIONS - PROGRAMMERS & call :ReportHeader
  70. set FILENAME=dfu-programmer.exe & set VERSION_CMD=--version & set VERSION_FIND="dfu" & call :ReportVersion
  71. set FILENAME=batchisp.exe & set VERSION_CMD=-version & set VERSION_FIND="batchisp" & call :ReportVersion
  72. set FILENAME=dfu-util.exe & call :Report
  73. set FILENAME=teensy_loader_cli.exe & call :Report
  74. set FILENAME=hid_bootloader_cli.exe & call :Report
  75. set FILENAME=avrdude.exe & call :Report
  76. :: -----------------------------------------------------------------------------
  77. set HEADER=EXECUTABLE LOCATIONS - OPTIONAL & call :ReportHeader
  78. set FILENAME=cppcheck.exe & call :Report
  79. set FILENAME=doxygen.exe & call :Report
  80. set FILENAME=gdb-config.exe & call :Report
  81. set FILENAME=wget.exe & call :Report
  82. set FILENAME=unzip.exe & call :Report
  83. :: -----------------------------------------------------------------------------
  84. set HEADER=MINGW CHECK - OPTIONAL & call :ReportHeader
  85. if exist %MINGW_BASE_DIR% (echo Expected MinGW Base Dir = %MINGW_BASE_DIR%>>%REPORT_NAME% 2>&1) else (echo Expected MinGW Base Dir = %MINGW_BASE_DIR% - Not Found>>%REPORT_NAME% 2>&1)
  86. echo.>>%REPORT_NAME% 2>&1
  87. set FILENAME=mingw32-make.exe & set VERSION_CMD=--version & set VERSION_FIND="GNU Make" & call :ReportVersion
  88. if exist %MINGW_BASE_DIR%\bin\make.exe (ECHO It is not recommended to have make.exe in mingw/bin.>>%REPORT_NAME% 2>&1 & echo.>>%REPORT_NAME% 2>&1)
  89. :: -----------------------------------------------------------------------------
  90. set HEADER=MAKE CHECK & call :ReportHeader
  91. if exist Makefile (set MAKE_CMD=%MAKE_CMD_LEVEL_0% & goto MakeFound)
  92. if exist ..\Makefile (set MAKE_CMD=%MAKE_CMD_LEVEL_1% & goto MakeFound)
  93. if exist ..\..\Makefile (set MAKE_CMD=%MAKE_CMD_LEVEL_2% & goto MakeFound)
  94. echo No Makfile Found.>>%REPORT_NAME% 2>&1
  95. echo.>>%REPORT_NAME% 2>&1
  96. echo ------------------------------------------------------------------------->>%REPORT_NAME% 2>&1
  97. goto :ContinueAfterMake
  98. :MakeFound
  99. call :RunMake
  100. :ContinueAfterMake
  101. goto :ExitBatch
  102. :ExitBatch
  103. echo Done!
  104. echo.
  105. rem type %REPORT_NAME%
  106. echo.
  107. echo See %REPORT_NAME% for the report.
  108. endlocal
  109. exit /b
  110. :: -----------------------------------------------------------------------------
  111. :RunMake
  112. echo Makfile Found.>>%REPORT_NAME% 2>&1
  113. echo.>>%REPORT_NAME% 2>&1
  114. set HEADER=MAKE CLEAN & call :ReportHeader
  115. echo Make Command = %MAKE_CMD% %KEYMAP_CLEAN%>>%REPORT_NAME% 2>&1
  116. echo.>>%REPORT_NAME% 2>&1
  117. %MAKE_CMD% %KEYMAP_CLEAN%>>%REPORT_NAME% 2>&1
  118. set HEADER=MAKE & call :ReportHeader
  119. echo Make Command = %MAKE_CMD% %KEYMAP%>>%REPORT_NAME% 2>&1
  120. echo.>>%REPORT_NAME% 2>&1
  121. %MAKE_CMD% %KEYMAP%>>%REPORT_NAME% 2>&1
  122. echo ------------------------------------------------------------------------->>%REPORT_NAME% 2>&1
  123. echo.>>%REPORT_NAME% 2>&1
  124. exit /b
  125. :ReportHeader
  126. echo ------------------------------------------------------------------------->>%REPORT_NAME% 2>&1
  127. echo.>>%REPORT_NAME% 2>&1
  128. echo %HEADER%>>%REPORT_NAME% 2>&1
  129. echo.>>%REPORT_NAME% 2>&1
  130. exit /b
  131. :Report
  132. echo Filename = %FILENAME% >>%REPORT_NAME% 2>&1
  133. <nul set /p output="Location = " >>%REPORT_NAME% 2>&1
  134. where %FILENAME% >>%REPORT_NAME% 2> NUL
  135. if ERRORLEVEL 1 (echo Not Found >>%REPORT_NAME% 2>&1 & goto :EndReport)
  136. :EndReport
  137. echo.>>%REPORT_NAME% 2>&1
  138. <nul set /p output="."
  139. exit /b
  140. :ReportVersion
  141. echo Filename = %FILENAME% >>%REPORT_NAME% 2>&1
  142. <nul set /p output="Location = " >>%REPORT_NAME% 2>&1
  143. where %FILENAME% >>%REPORT_NAME% 2> NUL
  144. if ERRORLEVEL 1 (echo Not Found >>%REPORT_NAME% 2>&1 & goto :EndReportVersion)
  145. <nul set /p output ="Version = " >>%REPORT_NAME% 2>&1
  146. (%FILENAME% %VERSION_CMD% | find %VERSION_FIND%) >>%REPORT_NAME% 2>&1
  147. :EndReportVersion
  148. echo.>>%REPORT_NAME% 2>&1
  149. <nul set /p output="."
  150. exit /b