OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import optparse | 7 import optparse |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 '-x', 'c-header', # treat sources as C header files | 22 '-x', 'c-header', # treat sources as C header files |
23 '-P', # disable line markers, i.e. '#line 309' | 23 '-P', # disable line markers, i.e. '#line 309' |
24 '-I', options.include_path, | 24 '-I', options.include_path, |
25 '-o', options.output, | 25 '-o', options.output, |
26 options.template | 26 options.template |
27 ]) | 27 ]) |
28 | 28 |
29 build_utils.CheckOutput(gcc_cmd) | 29 build_utils.CheckOutput(gcc_cmd) |
30 | 30 |
31 | 31 |
32 def main(): | 32 def main(args): |
| 33 args = build_utils.ExpandFileArgs(args) |
| 34 |
33 parser = optparse.OptionParser() | 35 parser = optparse.OptionParser() |
34 build_utils.AddDepfileOption(parser) | 36 build_utils.AddDepfileOption(parser) |
35 | 37 |
36 parser.add_option('--include-path', help='Include path for gcc.') | 38 parser.add_option('--include-path', help='Include path for gcc.') |
37 parser.add_option('--template', help='Path to template.') | 39 parser.add_option('--template', help='Path to template.') |
38 parser.add_option('--output', help='Path for generated file.') | 40 parser.add_option('--output', help='Path for generated file.') |
39 parser.add_option('--stamp', help='Path to touch on success.') | 41 parser.add_option('--stamp', help='Path to touch on success.') |
40 parser.add_option('--defines', help='Pre-defines macros', action='append') | 42 parser.add_option('--defines', help='Pre-defines macros', action='append') |
41 | 43 |
42 options, _ = parser.parse_args() | 44 options, _ = parser.parse_args(args) |
43 | 45 |
44 DoGcc(options) | 46 DoGcc(options) |
45 | 47 |
46 if options.depfile: | 48 if options.depfile: |
47 build_utils.WriteDepfile( | 49 build_utils.WriteDepfile( |
48 options.depfile, | 50 options.depfile, |
49 build_utils.GetPythonDependencies()) | 51 build_utils.GetPythonDependencies()) |
50 | 52 |
51 if options.stamp: | 53 if options.stamp: |
52 build_utils.Touch(options.stamp) | 54 build_utils.Touch(options.stamp) |
53 | 55 |
54 | 56 |
55 if __name__ == '__main__': | 57 if __name__ == '__main__': |
56 sys.exit(main()) | 58 sys.exit(main(sys.argv[1:])) |
OLD | NEW |