Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / build / android / gyp / gcc_preprocess.py
blob93efdb3a741dfc0edc035a494c80e811c0edbdd8
1 #!/usr/bin/env python
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.
7 import optparse
8 import os
9 import subprocess
10 import sys
12 from util import build_utils
14 def DoGcc(options):
15 build_utils.MakeDirectory(os.path.dirname(options.output))
17 gcc_cmd = [
18 'gcc', # invoke host gcc.
19 '-E', # stop after preprocessing.
20 '-D', 'ANDROID', # Specify ANDROID define for pre-processor.
21 '-x', 'c-header', # treat sources as C header files
22 '-P', # disable line markers, i.e. '#line 309'
23 '-I', options.include_path,
24 '-o', options.output,
25 options.template
28 build_utils.CheckCallDie(gcc_cmd)
31 def main(argv):
32 parser = optparse.OptionParser()
33 parser.add_option('--include-path', help='Include path for gcc.')
34 parser.add_option('--template', help='Path to template.')
35 parser.add_option('--output', help='Path for generated file.')
36 parser.add_option('--stamp', help='Path to touch on success.')
38 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
39 parser.add_option('--ignore', help='Ignored.')
41 options, _ = parser.parse_args()
43 DoGcc(options)
45 if options.stamp:
46 build_utils.Touch(options.stamp)
49 if __name__ == '__main__':
50 sys.exit(main(sys.argv))