32 miniCommandOption = "--co" # update this if another "co" option is added |
32 miniCommandOption = "--co" # update this if another "co" option is added |
33 |
33 |
34 # raptor_cli module attributes |
34 # raptor_cli module attributes |
35 |
35 |
36 parser = OptionParser(prog = raptor.name, |
36 parser = OptionParser(prog = raptor.name, |
37 usage = """%prog [--help] [options] [variable=value] [target] ... |
37 usage = """%prog [--help] [options] [target] ... |
38 |
38 |
39 Targets: |
39 Targets: |
40 |
40 |
41 BITMAP Create bitmap files |
41 BITMAP Create bitmap files |
42 CLEAN Remove built files and intermediates, but not exported files |
42 CLEAN Remove built files and intermediates, but not exported files |
45 FINAL Allow extension makefiles to execute final commands |
45 FINAL Allow extension makefiles to execute final commands |
46 FREEZE Freeze exported functions in a .DEF file |
46 FREEZE Freeze exported functions in a .DEF file |
47 LIBRARY Create import libraries from frozen .DEF files |
47 LIBRARY Create import libraries from frozen .DEF files |
48 LISTING Create assembler listing files for source files |
48 LISTING Create assembler listing files for source files |
49 REALLYCLEAN Same as CLEAN but also remove exported files |
49 REALLYCLEAN Same as CLEAN but also remove exported files |
50 RESOURCE Create resource files and AIFs |
50 RESOURCE Create resource files |
51 ROMFILE Create an IBY file to be included in a ROM |
51 ROMFILE Create an IBY file to be included in a ROM |
52 TARGET Create main executables |
52 TARGET Create main executables |
53 WHAT List all releaseable targets |
53 WHAT List all releaseable targets |
54 |
54 |
55 Examples: |
55 Examples: |
85 help="Name of the make engine which runs the build.") |
85 help="Name of the make engine which runs the build.") |
86 |
86 |
87 parser.add_option("--export-only",action="store_true",dest="doExportOnly", |
87 parser.add_option("--export-only",action="store_true",dest="doExportOnly", |
88 help="Generate exports only and do not create any make files.") |
88 help="Generate exports only and do not create any make files.") |
89 |
89 |
|
90 parser.add_option("--noexport",action="store_true",dest="doExport", |
|
91 help="Don't export any files - useful in some builds when you know exports have already been done.") |
|
92 |
90 parser.add_option("-f","--logfile",action="store",dest="logfile", |
93 parser.add_option("-f","--logfile",action="store",dest="logfile", |
91 help="Name of the log file, or '-' for stdout.") |
94 help="Name of the log file, or '-' for stdout.") |
92 |
95 |
93 parser.add_option("--filters",action="store",dest="filter_list", |
96 parser.add_option("--filters",action="store",dest="filter_list", |
94 help="Comma-separated list of names of the filters to use (case sensitive).") |
97 help="Comma-separated list of names of the filters to use (case sensitive).") |
114 parser.add_option("-n","--nobuild",action="store_true",dest="nobuild", |
117 parser.add_option("-n","--nobuild",action="store_true",dest="nobuild", |
115 help="Just create makefiles, do not build anything.") |
118 help="Just create makefiles, do not build anything.") |
116 |
119 |
117 parser.add_option("--no-depend-include",action="store_true",dest="noDependInclude", |
120 parser.add_option("--no-depend-include",action="store_true",dest="noDependInclude", |
118 help="Do not include generated dependency files. This is only useful for extremely large non-incremental builds.") |
121 help="Do not include generated dependency files. This is only useful for extremely large non-incremental builds.") |
|
122 |
|
123 parser.add_option("--no-depend-generate",action="store_true",dest="noDependGenerate", |
|
124 help="Do not generate dependency files. This is only useful for extremely large non-incremental builds. Implies --no-depend-include.") |
119 |
125 |
120 parser.add_option("-o","--orderlayers",action="store_true",dest="sys_def_order_layers", |
126 parser.add_option("-o","--orderlayers",action="store_true",dest="sys_def_order_layers", |
121 help="Build layers in the System Definition XML file in the order listed or, if given, in the order of -l options.") |
127 help="Build layers in the System Definition XML file in the order listed or, if given, in the order of -l options.") |
122 |
128 |
123 parser.add_option("-p","--project",action="append",dest="project_name", |
129 parser.add_option("-p","--project",action="append",dest="project_name", |
142 |
148 |
143 "off" - Do not check tool versions whatsoever. |
149 "off" - Do not check tool versions whatsoever. |
144 |
150 |
145 "forced" - Check all tool versions. Don't use cached results. |
151 "forced" - Check all tool versions. Don't use cached results. |
146 """) |
152 """) |
|
153 |
|
154 parser.add_option("--timing",action="store_true",dest="timing", |
|
155 help="Show extra timing information for various processes in the build.") |
|
156 |
147 parser.add_option("--pp",action="store",dest="parallel_parsing", |
157 parser.add_option("--pp",action="store",dest="parallel_parsing", |
148 help="""Controls how metadata (e.g. bld.infs) are parsed in Parallel. |
158 help="""Controls how metadata (e.g. bld.infs) are parsed in Parallel. |
149 Possible values are: |
159 Possible values are: |
150 "on" - Parse bld.infs in parallel (should be faster on clusters/multicore machines) |
160 "on" - Parse bld.infs in parallel (should be faster on clusters/multicore machines) |
|
161 "slave" - used internally by Raptor |
151 "off" - Parse bld.infs serially |
162 "off" - Parse bld.infs serially |
152 """) |
163 """) |
153 |
164 |
154 parser.add_option("-v","--version",action="store_true",dest="version", |
165 parser.add_option("-v","--version",action="store_true",dest="version", |
155 help="Print the version number and exit.") |
166 help="Print the version number and exit.") |
234 # parse the full set of arguments |
245 # parse the full set of arguments |
235 (options, leftover_args) = parser.parse_args(expanded_args) |
246 (options, leftover_args) = parser.parse_args(expanded_args) |
236 |
247 |
237 # the leftover_args are either variable assignments of the form a=b |
248 # the leftover_args are either variable assignments of the form a=b |
238 # or target names. |
249 # or target names. |
239 regex = re.compile("^(.+)=(.*)$") |
|
240 for leftover in leftover_args: |
250 for leftover in leftover_args: |
241 assignment = regex.findall(leftover) |
251 Raptor.AddTarget(leftover) |
242 if len(assignment) > 0: |
|
243 Raptor.SetEnv(assignment[0][0],assignment[0][1]) |
|
244 else: |
|
245 Raptor.AddTarget(leftover) |
|
246 |
252 |
247 # Define the dictionary of functions to be used. |
253 # Define the dictionary of functions to be used. |
248 # Attributes and function names can be added easily. |
254 # Attributes and function names can be added easily. |
249 # The calling attribute should be the same |
255 # The calling attribute should be the same |
250 # as specified when creating the add_option |
256 # as specified when creating the add_option |
258 'logfile' : Raptor.SetLogFileName, |
264 'logfile' : Raptor.SetLogFileName, |
259 'makefile' : Raptor.SetTopMakefile, |
265 'makefile' : Raptor.SetTopMakefile, |
260 'quiet' : Raptor.RunQuietly, |
266 'quiet' : Raptor.RunQuietly, |
261 'debugoutput' : Raptor.SetDebugOutput, |
267 'debugoutput' : Raptor.SetDebugOutput, |
262 'doExportOnly' : Raptor.SetExportOnly, |
268 'doExportOnly' : Raptor.SetExportOnly, |
|
269 'doExport' : Raptor.SetNoExport, |
263 'keepgoing': Raptor.SetKeepGoing, |
270 'keepgoing': Raptor.SetKeepGoing, |
264 'nobuild' : Raptor.SetNoBuild, |
271 'nobuild' : Raptor.SetNoBuild, |
265 'make_engine': Raptor.SetMakeEngine, |
272 'make_engine': Raptor.SetMakeEngine, |
266 'make_option': Raptor.AddMakeOption, |
273 'make_option': Raptor.AddMakeOption, |
267 'noDependInclude': Raptor.SetNoDependInclude, |
274 'noDependInclude': Raptor.SetNoDependInclude, |
|
275 'noDependGenerate': Raptor.SetNoDependGenerate, |
268 'number_of_jobs': Raptor.SetJobs, |
276 'number_of_jobs': Raptor.SetJobs, |
269 'project_name' : Raptor.AddProject, |
277 'project_name' : Raptor.AddProject, |
270 'filter_list' : Raptor.FilterList, |
278 'filter_list' : Raptor.FilterList, |
271 'ignore_os_detection': Raptor.IgnoreOsDetection, |
279 'ignore_os_detection': Raptor.IgnoreOsDetection, |
272 'check' : Raptor.SetCheck, |
280 'check' : Raptor.SetCheck, |
273 'what' : Raptor.SetWhat, |
281 'what' : Raptor.SetWhat, |
274 'tries' : Raptor.SetTries, |
282 'tries' : Raptor.SetTries, |
275 'toolcheck' : Raptor.SetToolCheck, |
283 'toolcheck' : Raptor.SetToolCheck, |
|
284 'timing' : Raptor.SetTiming, |
276 'source_target' : Raptor.AddSourceTarget, |
285 'source_target' : Raptor.AddSourceTarget, |
277 'command_file' : CommandFile, |
286 'command_file' : CommandFile, |
278 'parallel_parsing' : Raptor.SetParallelParsing, |
287 'parallel_parsing' : Raptor.SetParallelParsing, |
279 'version' : Raptor.PrintVersion |
288 'version' : Raptor.PrintVersion |
280 } |
289 } |
281 |
290 |
282 # Check if Quiet mode has been specified (otherwise we will make noise) |
291 # Check if Quiet mode has been specified (otherwise we will make noise) |
283 if parser.values.quiet: |
292 if parser.values.quiet: |
284 Raptor.RunQuietly(True) |
293 Raptor.RunQuietly(True) |