1#!/usr/bin/python
2
3import os, sys, subprocess
4from android_common import *
5
6
7here = os.path.abspath(os.path.dirname(sys.argv[0]))
8android_run = os.path.join(here, 'android_run.py')
9
10output = None
11output_type = 'executable'
12
13args = sys.argv[1:]
14while args:
15    arg = args.pop(0)
16    if arg == '-shared':
17        output_type = 'shared'
18    elif arg == '-c':
19        output_type = 'object'
20    elif arg == '-o':
21        output = args.pop(0)
22
23if output == None:
24    print "No output file name!"
25    sys.exit(1)
26
27ret = subprocess.call(sys.argv[1:])
28if ret != 0:
29    sys.exit(ret)
30
31if output_type in ['executable', 'shared']:
32    push_to_device(output)
33
34if output_type == 'executable':
35    os.rename(output, output + '.real')
36    os.symlink(android_run, output)
37