mkkconfig.bat
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@Echo off
REM apps/tools/mkkconfig.bat
REM
REM Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
REM Author: Gregory Nutt <gnutt@nuttx.org>
REM
REM Redistribution and use in source and binary forms, with or without
REM modification, are permitted provided that the following conditions
REM are met:
REM
REM 1. Redistributions of source code must retain the above copyright
REM notice, this list of conditions and the following disclaimer.
REM 2. Redistributions in binary form must reproduce the above copyright
REM notice, this list of conditions and the following disclaimer in
REM the documentation and/or other materials provided with the
REM distribution.
REM 3. Neither the name NuttX nor the names of its contributors may be
REM used to endorse or promote products derived from this software
REM without specific prior written permission.
REM
REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
REM AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
REM POSSIBILITY OF SUCH DAMAGE.
REM
REM Parse command line arguments
SET menu=""
SET kconfig=Kconfig
:ArgLoop
IF "%1"=="" GOTO :EndOfLoop
IF "%1"=="-m" GOTO :SetMenu
IF "%1"=="-o" GOTO :SetKconfig
IF "%1"=="-h" GOTO :ShowUsage
Echo ERROR: Unrecognized option %1
GOTO :ShowUsage
:SetDebug
SET debug=-d
GOTO :NextArg
:SetMenu
SHIFT
SET menu=%1
GOTO :NextArg
:SetKconfig
SHIFT
SET kconfig=%1
:NextArg
SHIFT
GOTO :ArgLoop
REM Check input Parameters
:EndOfLoop
IF EXIST %kconfig% (
Del /f /q %kconfig%
REM IF %ERRORLEVEL% GTR 0 (
REM Echo ERROR: failed to remove %kconfig%
REM GOTO :End
REM )
)
REM Get the current directory
SET APPSDIR=%cd%
SET APPSDIR=%APPSDIR:\=/%
Echo # > %kconfig%
Echo # For a description of the syntax of this configuration file, >> %kconfig%
Echo # see the file kconfig-language.txt in the NuttX tools repository. >> %kconfig%
Echo # >> %kconfig%
Echo # This file is autogenerated, do not edit. >> %kconfig%
Echo # >> %kconfig%
Echo[ >> %kconfig%
IF %menu% NEQ "" (
Echo menu %menu% >> %kconfig%
)
DIR /B /A:D >_tmp_.dat
FOR /F "tokens=*" %%s IN (_tmp_.dat) do (
IF EXIST %%s\Kconfig (
Echo source "%APPSDIR%/%%s/Kconfig" >> %kconfig%
)
)
DEL _tmp_.dat
IF %menu% NEQ "" (
Echo endmenu # %menu% >> %kconfig%
)
GOTO :End
REM Exit showing usage
:ShowUsage
Echo USAGE: %0 [-d] [-m ^<menu^>] [-o ^<kconfig-file^>]
Echo %0 [-h]
Echo Where:
Echo ^<-d^>:
Echo Enables debug output
Echo -m ^<menu^>:
Echo Menu description
Echo -o ^<kconfig-file^>:
Echo Identifies the specific configuration for the selected ^<board-name^>.
Echo This must correspond to a sub-directory under the board directory at
Echo under nuttx/boards/^<arch^>/^<chip^>/^<board^>/.
Echo ^<-h^>:
Echo Prints this message and exits.
REM Exit
:End