diff --git a/em++ b/em++ index 1663dd06e..5dd860f24 100755 --- a/em++ +++ b/em++ @@ -5,13 +5,8 @@ See emcc.py. This script forwards to there, noting that we want C++ and not C by ''' import os, sys +from tools import shared -__rootpath__ = os.path.abspath(os.path.dirname(__file__)) -def path_from_root(*pathelems): - return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) - -emmaken = path_from_root('tools', 'emmaken.py') os.environ['EMMAKEN_CXX'] = '1' -exit(os.execvp('python', ['python', emmaken] + sys.argv[1:])) +exit(os.execvp(shared.EMCC, [shared.EMCC] + sys.argv[1:])) diff --git a/emcc b/emcc index 33a6311c2..1494f2bbb 100755 --- a/emcc +++ b/emcc @@ -95,25 +95,28 @@ emcc can be influenced by a few environment variables: import sys import os import subprocess +from tools import shared DEBUG = 0 ################### XXX -print >> sys.stderr, '***This is a WORK IN PROGRESS***' +print >> sys.stderr, '\n***This is a WORK IN PROGRESS***' +print >> sys.stderr, '***[%s]***\n' % str(sys.argv) ################### XXX if DEBUG: print >> sys.stderr, 'emcc.py: ', ' '.join(sys.argv) -__rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) -def path_from_root(*pathelems): - return os.path.join(__rootpath__, *pathelems) -exec(open(path_from_root('tools', 'shared.py'), 'r').read()) - # Handle some global flags + +if len(sys.argv) == 1: + print 'emcc: no input files' + exit(0) + if sys.argv[1] == '--version': - print '''emcc 2.X -This is drop-in compiler replacement for Emscripten -http://emscripten.org + print '''emcc (Emscripten GCC-like replacement) 2.0 +Copyright (C) 2011 the Emscripten authors. +This is free and open source software under the MIT license. +There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ''' exit(0) elif sys.argv[1] == '--help': diff --git a/tests/runner.py b/tests/runner.py index cdb2309b9..34f76e705 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -4868,7 +4868,15 @@ TT = %s class other(RunnerCore): def test_emcc(self): - pass + for compiler in [EMCC, EMXX]: + # --version + output = Popen([compiler, '--version'], stdout=PIPE, stderr=PIPE).communicate(input)[0] + self.assertContained('''emcc (Emscripten GCC-like replacement) 2.0 +Copyright (C) 2011 the Emscripten authors. +This is free and open source software under the MIT license. +There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +''', output) + # TODO: make sure all of these match gcc # TODO: when this is done, more test runner to test these (i.e., test all -Ox thoroughly) # -- options: check these, warn about errors. valid gcc ones are help, version. Ours should be -- too, not -. diff --git a/tools/shared.py b/tools/shared.py index 0aead08a8..5c5da098a 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -26,6 +26,8 @@ COFFEESCRIPT = path_from_root('tools', 'eliminator', 'node_modules', 'coffee-scr EMSCRIPTEN = path_from_root('emscripten.py') DEMANGLER = path_from_root('third_party', 'demangler.py') NAMESPACER = path_from_root('tools', 'namespacer.py') +EMCC = path_from_root('emcc') +EMXX = path_from_root('em++') EMMAKEN = path_from_root('tools', 'emmaken.py') AUTODEBUGGER = path_from_root('tools', 'autodebugger.py') DFE = path_from_root('tools', 'dead_function_eliminator.py')