Add basic response file parsing to emcc

This commit is contained in:
Vladimir Vukicevic 2013-02-26 17:34:22 -05:00
Родитель 2f5e6f993e
Коммит b2496c286d
1 изменённых файлов: 22 добавлений и 0 удалений

22
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()