configure.bat 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. @echo off
  2. rem tools/configure.bat
  3. rem
  4. rem Licensed to the Apache Software Foundation (ASF) under one or more
  5. rem contributor license agreements. See the NOTICE file distributed with
  6. rem this work for additional information regarding copyright ownership. The
  7. rem ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. rem "License"); you may not use this file except in compliance with the
  9. rem License. You may obtain a copy of the License at
  10. rem
  11. rem http://www.apache.org/licenses/LICENSE-2.0
  12. rem
  13. rem Unless required by applicable law or agreed to in writing, software
  14. rem distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. rem WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. rem License for the specific language governing permissions and limitations
  17. rem under the License.
  18. rem
  19. if exist tools goto :GoToolDir
  20. if exist ..\tools goto :SetToolDir
  21. echo Cannot find tools\ directory
  22. goto End
  23. :GoToolDir
  24. cd tools
  25. :SetTooldir
  26. set tooldir=%CD%
  27. rem Parse command line arguments
  28. set debug=
  29. set fmt=-b
  30. set posix=
  31. set help=
  32. set appdir=
  33. set config=
  34. set hostopt=
  35. :ArgLoop
  36. if "%1"=="" goto :NoConfig
  37. if "%1"=="-h" goto :ShowUsage
  38. if "%1"=="-d" goto :SetDebug
  39. if "%1"=="-f" goto :SetFormat
  40. if "%1"=="-b" goto :SetFormat
  41. if "%1"=="-l" goto :SetHostOption
  42. if "%1"=="-c" goto :SetHostOption
  43. if "%1"=="-n" goto :SetHostOption
  44. if "%1"=="-L" goto :SetList
  45. if "%1"=="-a" goto :SetAppDir
  46. set config=%1
  47. goto EndOfLoop
  48. :SetDebug
  49. set debug=%1
  50. goto :NextArg
  51. :SetFormat
  52. set fmt=%1
  53. goto :NextArg
  54. :SetHostOption
  55. set hostopt=%1
  56. goto :NextArg
  57. :SetList
  58. set list=%1
  59. goto :EndOfLoop
  60. :SetAppDir
  61. shift
  62. set appdir=-a %1
  63. :NextArg
  64. shift
  65. goto :ArgLoop
  66. :EndOfLoop
  67. rem Check if we have to build configure.exe
  68. if exist configure.exe goto :HaveConfigureExe
  69. set cc=mingw32-gcc.exe
  70. set cflags=-Wall -Wstrict-prototypes -Wshadow -g -pipe -I. -DCONFIG_WINDOWS_NATIVE=y
  71. echo %cc% %cflags% -o configure.exe configure.c cfgparser.c
  72. %cc% %cflags% -o configure.exe configure.c cfgparser.c
  73. if errorlevel 1 (
  74. echo ERROR: %cc% failed
  75. echo Is ming32-gcc.exe installed? Is it in the PATH variable?
  76. goto End
  77. )
  78. :HaveConfigureExe
  79. cd ..
  80. tools\configure.exe %debug% %fmt% %hostopt% %appdir% %config% %list%
  81. if errorlevel 1 echo configure.exe failed
  82. goto End
  83. :NoConfig
  84. echo Missing ^<board-name^>:^<config-name^> argument
  85. :ShowUsage
  86. echo USAGE: %0 [-d] [-b|f] [-a ^<app-dir^>] ^<board-name^>:^<config-name^>
  87. echo %0 [-h]
  88. echo\nWhere:
  89. echo -d:
  90. echo Enables debug output
  91. echo -b:
  92. echo Informs the tool that it should use Windows style paths like C:\\Program Files
  93. echo instead of POSIX style paths are used like /usr/local/bin. Windows
  94. echo style paths are used by default.
  95. echo -f:
  96. echo Informs the tool that it should use POSIX style paths like /usr/local/bin.
  97. echo By default, Windows style paths like C:\\Program Files are used.
  98. echo -l selects the Linux (l) host environment. The [-c^|n] options
  99. echo select one of the Windows environments. Default: Use host setup
  100. echo in the defconfig file
  101. echo [-c^|n] selects the Windows host and a Windows environment:
  102. echo Cygwin (c), or Windows native (n). Default Cygwin
  103. echo -L:
  104. echo List all available configurations.
  105. echo -a ^<app-dir^>:
  106. echo Informs the configuration tool where the application build
  107. echo directory. This is a relative path from the top-level NuttX
  108. echo build directory. But default, this tool will look in the usual
  109. echo places to try to locate the application directory: ../apps or
  110. echo ../apps-xx.yy where xx.yy is the NuttX version number.
  111. echo ^<board-name^>:
  112. echo Identifies the board. This must correspond to a board directory
  113. echo under nuttx/boards/.
  114. echo ^<config-name^>:
  115. echo Identifies the specific configuration for the selected ^<board-name^>.
  116. echo This must correspond to a sub-directory under the board directory at
  117. echo under nuttx/boards/^<board-name^>/configs/.
  118. echo -h:
  119. echo Prints this message and exits.
  120. :End