aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-14 18:12:22 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-14 18:12:22 -0800
commit193a0cc9d243ccee7498daec5bdb32842fe2f3e7 (patch)
tree3c631a4eead8da96677a2b2823303486c1d4ee41
parent67a5e29fa92d39bf97510f66f51c5be46a118d13 (diff)
more logging in emcc, and only generate js/html if specifically told to (so building things like .so.0.1.0.0) will work, as bitcode
-rwxr-xr-xemcc11
1 files changed, 10 insertions, 1 deletions
diff --git a/emcc b/emcc
index 5dcd7b8c..f0bfe51a 100755
--- a/emcc
+++ b/emcc
@@ -296,6 +296,8 @@ try:
## Compile source code to bitcode
+ if DEBUG: print >> sys.stderr, 'emcc: compiling to bitcode'
+
# First, generate LLVM bitcode. For each input file, we get base.o with bitcode
newargs = newargs + ['-emit-llvm', '-c']
@@ -309,11 +311,12 @@ try:
# Optimize, if asked to
if llvm_opt_level > 0:
+ if DEBUG: print >> sys.stderr, 'emcc: LLVM opts'
for input_file in input_files:
shared.Building.llvm_opt(in_temp(unsuffixed_basename(input_file) + '.o'), 2, safe=llvm_opt_level < 2)
# If we were just asked to generate bitcode, stop there
- if final_suffix in ['o', 'bc']:
+ if final_suffix not in ['js', 'html']:
if not specified_target:
for input_file in input_files:
shutil.move(in_temp(unsuffixed_basename(input_file) + '.o'), unsuffixed_basename(input_file) + '.' + final_suffix)
@@ -325,6 +328,8 @@ try:
## Continue on to create JavaScript
+ if DEBUG: print >> sys.stderr, 'emcc: generating JavaScript'
+
# First, combine the bitcode files if there are several
if len(input_files) > 1:
shared.Building.link(map(lambda input_file: in_temp(unsuffixed_basename(input_file) + '.o'), input_files), in_temp(target_basename + '.bc'))
@@ -341,6 +346,7 @@ try:
if opt_level >= 1:
# js optimizer
+ if DEBUG: print >> sys.stderr, 'emcc: running pre-closure post-opts'
final = shared.Building.js_optimizer(final, 'loopOptimizer')
# eliminator
@@ -348,14 +354,17 @@ try:
if opt_level >= 3:
# closure
+ if DEBUG: print >> sys.stderr, 'emcc: running closure'
final = shared.Building.closure_compiler(final)
if opt_level >= 1:
# js optimizer
+ if DEBUG: print >> sys.stderr, 'emcc: running post-closure post-opts'
final = shared.Building.js_optimizer(final, 'simplifyExpressions')
# If we were asked to also generate HTML, do that
if final_suffix == 'html':
+ if DEBUG: print >> sys.stderr, 'emcc: generating HTML'
shell = open(shared.path_from_root('src', 'shell.html')).read()
html = open(target_basename + '.html', 'w')
html.write(shell.replace('{{{ SCRIPT_CODE }}}', open(final).read()))