kconfig.bat 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. @echo off
  2. rem tools/kconfig.bat
  3. rem
  4. rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
  5. rem Author: Gregory Nutt <gnutt@nuttx.org>
  6. rem
  7. rem Redistribution and use in source and binary forms, with or without
  8. rem modification, are permitted provided that the following conditions
  9. rem are met:
  10. rem
  11. rem 1. Redistributions of source code must retain the above copyright
  12. rem notice, this list of conditions and the following disclaimer.
  13. rem 2. Redistributions in binary form must reproduce the above copyright
  14. rem notice, this list of conditions and the following disclaimer in
  15. rem the documentation and/or other materials provided with the
  16. rem distribution.
  17. rem 3. Neither the name NuttX nor the names of its contributors may be
  18. rem used to endorse or promote products derived from this software
  19. rem without specific prior written permission.
  20. rem
  21. rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. rem POSSIBILITY OF SUCH DAMAGE.
  33. rem
  34. rem Remember the state of the PATH variable on entry
  35. set oldpath=%PATH%
  36. rem Handle command line options
  37. set action=%1
  38. shift
  39. if "%action%"=="" goto :MissingArgument
  40. set appsdir=..\apps
  41. set cygwindir=C:\Cygwin
  42. :ArgLoop
  43. if "%1"=="" goto :CheckArguments
  44. if "%1"=="-a" (
  45. shift
  46. set appsdir=%1
  47. goto :NextArg
  48. )
  49. if "%1"=="-c" (
  50. shift
  51. set cygwindir=%1
  52. goto :NextArg
  53. )
  54. echo ERROR: Unrecognized option: %1
  55. goto :ShowUsage
  56. :NextArg
  57. shift
  58. goto :ArgLoop
  59. rem Verify that all of the paths are valid
  60. :CheckArguments
  61. if exist "%appsdir%" goto :CheckCygwinDir
  62. echo ERROR: %appsdir% does not exist
  63. goto :ShowUsage
  64. :CheckCygwinDir
  65. if exist "%cygwindir%" goto :SetPath
  66. echo ERROR: %cygwindir% does not exist
  67. goto :ShowUsage
  68. rem Setup some required environment variables and PATH settings
  69. :SetPath
  70. set PATH=%cygwindir%\usr\local\bin;%cygwindir%\usr\bin;%cygwindir%\bin;%PATH%
  71. set APPSDIR=%appsdir%
  72. rem Execute the requested action
  73. if "%action%"=="config" goto :DoConfig
  74. if "%action%"=="oldconfig" goto :DoOldConfig
  75. if "%action%"=="menuconfig" goto :DoMenuConfig
  76. echo ERROR: Unrecognized action: %action%
  77. goto :ShowUsage
  78. :DoConfig
  79. kconfig-conf Kconfig
  80. goto End
  81. :DoOldConfig
  82. kconfig-conf --oldconfig Kconfig
  83. goto End
  84. :DoMenuConfig
  85. kconfig-mconf Kconfig
  86. goto End
  87. :MissingArgument
  88. echo ERROR: Missing required argument
  89. :ShowUsage
  90. echo USAGE: %0 ^<action^> [-a ^<appsdir^>] [-c ^<cygwindir^>]
  91. echo Where:
  92. echo ^<action^> is one of config, oldconf, or menuconfig
  93. echo ^<appsdir^> is the relative path to the apps\ directory.
  94. echo This defaults to ..\apps
  95. echo ^<cygwindir^> is the relative path to the Cygwin installation
  96. echo directory. This defaults to C:\Cygwin
  97. rem Restore the original PATH settings
  98. :End
  99. set PATH=%oldpath%