#!/usr/bin/env python import sys import subprocess libs = [ ] objects = [ ] output = None i = 1 while i < len(sys.argv): opt = sys.argv[i] i += 1 if opt == "-o": output = sys.argv[i] i += 1 continue if opt.startswith("-l") or opt.startswith("-L"): libs.append(opt) continue if opt == "-r": continue if opt in ("--sysroot", "-isysroot", "-framework", "-undefined", "-macosx_version_min"): i += 1 continue if opt.startswith("-I"): continue if opt.startswith("-m"): continue if opt.startswith("-f"): continue if opt.startswith("-O"): continue if opt.startswith("-g"): continue if opt.startswith("-D"): continue if opt.startswith("-"): print sys.argv print "Unknown option: ", opt sys.exit(1) print 'append', opt, 'to output' objects.append(opt) f = file(output, "w") f.close() f = file(output + ".libs", "w") f.write(" ".join(libs)) f.close() print 'objects are', objects subprocess.call([ "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2", "-r", "-o", output + ".o" ] + objects)