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
5 # found in the LICENSE file.
11 from util
import build_utils
14 build_utils
.MakeDirectory(os
.path
.dirname(options
.output
))
16 gcc_cmd
= [ 'gcc' ] # invoke host gcc.
18 gcc_cmd
.extend(sum(map(lambda w
: ['-D', w
], options
.defines
), []))
20 '-E', # stop after preprocessing.
21 '-D', 'ANDROID', # Specify ANDROID define for pre-processor.
22 '-x', 'c-header', # treat sources as C header files
23 '-P', # disable line markers, i.e. '#line 309'
24 '-I', options
.include_path
,
29 build_utils
.CheckOutput(gcc_cmd
)
33 args
= build_utils
.ExpandFileArgs(args
)
35 parser
= optparse
.OptionParser()
36 build_utils
.AddDepfileOption(parser
)
38 parser
.add_option('--include-path', help='Include path for gcc.')
39 parser
.add_option('--template', help='Path to template.')
40 parser
.add_option('--output', help='Path for generated file.')
41 parser
.add_option('--stamp', help='Path to touch on success.')
42 parser
.add_option('--defines', help='Pre-defines macros', action
='append')
44 options
, _
= parser
.parse_args(args
)
49 build_utils
.WriteDepfile(
51 build_utils
.GetPythonDependencies())
54 build_utils
.Touch(options
.stamp
)
57 if __name__
== '__main__':
58 sys
.exit(main(sys
.argv
[1:]))