| OLD | NEW |
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import copy | 5 import copy |
| 6 import hashlib | 6 import hashlib |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os.path | 8 import os.path |
| 9 import re | 9 import re |
| 10 import signal | 10 import signal |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 self.WriteVariableList('cflags_objcc', map(self.ExpandSpecial, | 775 self.WriteVariableList('cflags_objcc', map(self.ExpandSpecial, |
| 776 cflags_objcc)) | 776 cflags_objcc)) |
| 777 self.ninja.newline() | 777 self.ninja.newline() |
| 778 outputs = [] | 778 outputs = [] |
| 779 for source in sources: | 779 for source in sources: |
| 780 filename, ext = os.path.splitext(source) | 780 filename, ext = os.path.splitext(source) |
| 781 ext = ext[1:] | 781 ext = ext[1:] |
| 782 obj_ext = self.obj_ext | 782 obj_ext = self.obj_ext |
| 783 if ext in ('cc', 'cpp', 'cxx'): | 783 if ext in ('cc', 'cpp', 'cxx'): |
| 784 command = 'cxx' | 784 command = 'cxx' |
| 785 elif ext == 'c' or (ext in ('s', 'S') and self.flavor != 'win'): | 785 elif ext == 'c' or (ext == 'S' and self.flavor != 'win'): |
| 786 command = 'cc' | 786 command = 'cc' |
| 787 elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files. |
| 788 command = 'cc_s' |
| 787 elif (self.flavor == 'win' and ext == 'asm' and | 789 elif (self.flavor == 'win' and ext == 'asm' and |
| 788 self.msvs_settings.GetTargetPlatform(config_name) == 'Win32'): | 790 self.msvs_settings.GetTargetPlatform(config_name) == 'Win32'): |
| 789 # Asm files only get auto assembled for x86 (not x64). | 791 # Asm files only get auto assembled for x86 (not x64). |
| 790 command = 'asm' | 792 command = 'asm' |
| 791 # Add the _asm suffix as msvs is capable of handling .cc and | 793 # Add the _asm suffix as msvs is capable of handling .cc and |
| 792 # .asm files of the same name without collision. | 794 # .asm files of the same name without collision. |
| 793 obj_ext = '_asm.obj' | 795 obj_ext = '_asm.obj' |
| 794 elif self.flavor == 'mac' and ext == 'm': | 796 elif self.flavor == 'mac' and ext == 'm': |
| 795 command = 'objc' | 797 command = 'objc' |
| 796 elif self.flavor == 'mac' and ext == 'mm': | 798 elif self.flavor == 'mac' and ext == 'mm': |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 master_ninja.newline() | 1426 master_ninja.newline() |
| 1425 | 1427 |
| 1426 if flavor != 'win': | 1428 if flavor != 'win': |
| 1427 master_ninja.rule( | 1429 master_ninja.rule( |
| 1428 'cc', | 1430 'cc', |
| 1429 description='CC $out', | 1431 description='CC $out', |
| 1430 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' | 1432 command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' |
| 1431 '$cflags_pch_c -c $in -o $out'), | 1433 '$cflags_pch_c -c $in -o $out'), |
| 1432 depfile='$out.d') | 1434 depfile='$out.d') |
| 1433 master_ninja.rule( | 1435 master_ninja.rule( |
| 1436 'cc_s', |
| 1437 description='CC $out', |
| 1438 command=('$cc $defines $includes $cflags $cflags_c ' |
| 1439 '$cflags_pch_c -c $in -o $out')) |
| 1440 master_ninja.rule( |
| 1434 'cxx', | 1441 'cxx', |
| 1435 description='CXX $out', | 1442 description='CXX $out', |
| 1436 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' | 1443 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' |
| 1437 '$cflags_pch_cc -c $in -o $out'), | 1444 '$cflags_pch_cc -c $in -o $out'), |
| 1438 depfile='$out.d') | 1445 depfile='$out.d') |
| 1439 else: | 1446 else: |
| 1440 # Template for compile commands mostly shared between compiling files | 1447 # Template for compile commands mostly shared between compiling files |
| 1441 # and generating PCH. In the case of PCH, the "output" is specified by /Fp | 1448 # and generating PCH. In the case of PCH, the "output" is specified by /Fp |
| 1442 # rather than /Fo (for object files), but we still need to specify an /Fo | 1449 # rather than /Fo (for object files), but we still need to specify an /Fo |
| 1443 # when compiling PCH. | 1450 # when compiling PCH. |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 arglists.append( | 1780 arglists.append( |
| 1774 (target_list, target_dicts, data, params, config_name)) | 1781 (target_list, target_dicts, data, params, config_name)) |
| 1775 pool.map(CallGenerateOutputForConfig, arglists) | 1782 pool.map(CallGenerateOutputForConfig, arglists) |
| 1776 except KeyboardInterrupt, e: | 1783 except KeyboardInterrupt, e: |
| 1777 pool.terminate() | 1784 pool.terminate() |
| 1778 raise e | 1785 raise e |
| 1779 else: | 1786 else: |
| 1780 for config_name in config_names: | 1787 for config_name in config_names: |
| 1781 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1788 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 1782 config_name) | 1789 config_name) |
| OLD | NEW |