OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from optparse import OptionParser | 6 from optparse import OptionParser |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 def Generate(self, srcs): | 488 def Generate(self, srcs): |
489 """Generate final output file. | 489 """Generate final output file. |
490 | 490 |
491 Link or Archive the final output file, from the compiled sources. | 491 Link or Archive the final output file, from the compiled sources. |
492 """ | 492 """ |
493 if self.outtype in ['nexe', 'pexe', 'nso']: | 493 if self.outtype in ['nexe', 'pexe', 'nso']: |
494 out = self.Link(srcs) | 494 out = self.Link(srcs) |
495 if self.strip_all or self.strip_debug: | 495 if self.strip_all or self.strip_debug: |
496 self.Strip(out) | 496 self.Strip(out) |
497 elif self.outtype in ['nlib', 'plib']: | 497 elif self.outtype in ['nlib', 'plib']: |
498 self.Archive(srcs) | 498 out = self.Archive(srcs) |
| 499 if self.strip_debug: |
| 500 self.Strip(out) |
| 501 elif self.strip_all: |
| 502 ErrOut('FAILED: --strip-all on libs will result in unusable libs.') |
499 else: | 503 else: |
500 ErrOut('FAILED: Unknown outtype %s:\n' % (self.outtype)) | 504 ErrOut('FAILED: Unknown outtype %s:\n' % (self.outtype)) |
501 | 505 |
502 | 506 |
503 def Main(argv): | 507 def Main(argv): |
504 parser = OptionParser() | 508 parser = OptionParser() |
505 parser.add_option('--empty', dest='empty', default=False, | 509 parser.add_option('--empty', dest='empty', default=False, |
506 help='Do not pass sources to library.', action='store_true') | 510 help='Do not pass sources to library.', action='store_true') |
507 parser.add_option('--no-suffix', dest='suffix', default=True, | 511 parser.add_option('--no-suffix', dest='suffix', default=True, |
508 help='Do not append arch suffix.', action='store_false') | 512 help='Do not append arch suffix.', action='store_false') |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 out = build.Compile(filename) | 577 out = build.Compile(filename) |
574 if out: | 578 if out: |
575 objs.append(out) | 579 objs.append(out) |
576 # Do not link if building an object | 580 # Do not link if building an object |
577 if not options.compile_only: | 581 if not options.compile_only: |
578 build.Generate(objs) | 582 build.Generate(objs) |
579 return 0 | 583 return 0 |
580 | 584 |
581 if __name__ == '__main__': | 585 if __name__ == '__main__': |
582 sys.exit(Main(sys.argv)) | 586 sys.exit(Main(sys.argv)) |
OLD | NEW |