| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import os, sys, subprocess |
| 4 |
from android_common import * |
| 5 |
|
| 6 |
|
| 7 |
here = os.path.abspath(os.path.dirname(sys.argv[0])) |
| 8 |
android_run = os.path.join(here, "android_run.py") |
| 9 |
|
| 10 |
output = None |
| 11 |
output_type = "executable" |
| 12 |
|
| 13 |
args = sys.argv[1:] |
| 14 |
while 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 |
|
| 23 |
if output is None: |
| 24 |
print("No output file name!") |
| 25 |
sys.exit(1) |
| 26 |
|
| 27 |
ret = subprocess.call(sys.argv[1:]) |
| 28 |
if ret != 0: |
| 29 |
sys.exit(ret) |
| 30 |
|
| 31 |
if output_type in ["executable", "shared"]: |
| 32 |
push_to_device(output) |
| 33 |
|
| 34 |
if output_type == "executable": |
| 35 |
os.rename(output, output + ".real") |
| 36 |
os.symlink(android_run, output) |