diff options
author | Vladimir Vukicevic <vladimirv@dugeo.com> | 2013-02-26 17:34:22 -0500 |
---|---|---|
committer | Vladimir Vukicevic <vladimirv@dugeo.com> | 2013-02-26 17:34:22 -0500 |
commit | b2496c286d3ea0a5d5365f10bc1ebc67f66e5cc3 (patch) | |
tree | d3868f540f677dd5376541bb2dfde2d8e6c27d02 /emcc | |
parent | 2f5e6f993e1b1a446331520b4dc2d5b19d597371 (diff) |
Add basic response file parsing to emcc
Diffstat (limited to 'emcc')
-rwxr-xr-x | emcc | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -1,4 +1,5 @@ #!/usr/bin/env python2 +# -*- Mode: python -*- ''' emcc - compiler helper script @@ -118,6 +119,27 @@ if len(sys.argv) == 1: print 'emcc: no input files' exit(1) +# read response files very early on +response_file = True +while response_file: + response_file = None + for index in range(1, len(sys.argv)): + if sys.argv[index][0] == '@': + # found one, loop again next time + response_file = sys.argv[index][1:] + if not os.path.exists(response_file): + print >>sys.stderr, 'emcc: error: Response file not found: %s' % response_file + exit(1) + + response_fd = open(response_file, 'r') + extra_args = shlex.split(response_fd.read()) + response_fd.close() + + # slice in extra_args in place of the response file arg + sys.argv[index:index+1] = extra_args + #if DEBUG: print >>sys.stderr, "Expanded response file: " + " | ".join(sys.argv) + break + if sys.argv[1] == '--version': revision = '(unknown revision)' here = os.getcwd() |