aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimirv@dugeo.com>2013-02-26 17:34:22 -0500
committerVladimir Vukicevic <vladimirv@dugeo.com>2013-02-26 17:34:22 -0500
commitb2496c286d3ea0a5d5365f10bc1ebc67f66e5cc3 (patch)
treed3868f540f677dd5376541bb2dfde2d8e6c27d02 /emcc
parent2f5e6f993e1b1a446331520b4dc2d5b19d597371 (diff)
Add basic response file parsing to emcc
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc22
1 files changed, 22 insertions, 0 deletions
diff --git a/emcc b/emcc
index 2f4bad2b..15742d1a 100755
--- a/emcc
+++ b/emcc
@@ -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()