aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-29 21:14:53 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-03-29 21:14:53 -0700
commitf3bffe4b06fc4afd5c02095ebb53a7e4cb39df9a (patch)
treee9afe668978b324cfdb5e342089ccc6239eb38ef
parent68c0053f8ae8a10c210a2a871473dd914db74a35 (diff)
basic support for -M and -MM
-rwxr-xr-xemcc5
-rwxr-xr-xtests/runner.py6
2 files changed, 11 insertions, 0 deletions
diff --git a/emcc b/emcc
index 41a640b9..a8b9816e 100755
--- a/emcc
+++ b/emcc
@@ -359,6 +359,11 @@ for i in range(1, len(sys.argv)):
if arg.endswith('.h') and sys.argv[i-1] != '-include':
header = True
+if '-M' in sys.argv or '-MM' in sys.argv:
+ cmd = [CC] + sys.argv[1:]
+ if DEBUG: print >> sys.stderr, 'emcc, just dependencies: ', ' '.join(cmd)
+ exit(subprocess.call(cmd))
+
# Check if a target is specified
target = None
for i in range(len(sys.argv)-1):
diff --git a/tests/runner.py b/tests/runner.py
index 796948b2..8a4ee811 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -6683,6 +6683,12 @@ f.close()
output = Popen([NODE_JS, JS_OPTIMIZER, input] + passes, stdin=PIPE, stdout=PIPE).communicate()[0]
self.assertIdentical(expected, output.replace('\n\n', '\n'))
+ def test_m_mm(self):
+ open(os.path.join(self.get_dir(), 'foo.c'), 'w').write('''/* */''')
+ for opt in ['M', 'MM']:
+ output = Popen(['python', EMCC, os.path.join(self.get_dir(), 'foo.c'), '-' + opt], stdout=PIPE).communicate()[0]
+ assert 'foo.o: ' in output, '-%s failed to produce the right output: %s' % (opt, output)
+
def test_llvm_nativizer(self):
# avoid impure_ptr problems etc.
shutil.copyfile(path_from_root('tests', 'files.cpp'), os.path.join(self.get_dir(), 'files.cpp'))