OLD | NEW |
---|---|
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 # Notes: | 5 # Notes: |
6 # | 6 # |
7 # This is all roughly based on the Makefile system used by the Linux | 7 # This is all roughly based on the Makefile system used by the Linux |
8 # kernel, but is a non-recursive make -- we put the entire dependency | 8 # kernel, but is a non-recursive make -- we put the entire dependency |
9 # graph in front of make and let it figure it out. | 9 # graph in front of make and let it figure it out. |
10 # | 10 # |
(...skipping 13 matching lines...) Expand all Loading... | |
24 import os | 24 import os |
25 import re | 25 import re |
26 import sys | 26 import sys |
27 import subprocess | 27 import subprocess |
28 import gyp | 28 import gyp |
29 import gyp.common | 29 import gyp.common |
30 import gyp.xcode_emulation | 30 import gyp.xcode_emulation |
31 from gyp.common import GetEnvironFallback | 31 from gyp.common import GetEnvironFallback |
32 from gyp.common import GypError | 32 from gyp.common import GypError |
33 | 33 |
34 # hashlib is supplied as of Python 2.5 as the replacement interface for sha | |
35 # and other secure hashes. In 2.6, sha is deprecated. Import hashlib if | |
thefourtheye
2016/06/29 19:31:40
Nit: `sha` is deprecated since 2.5, as per the doc
Anna Henningsen
2016/06/29 23:54:03
This comment is taken verbatim from `xcodeproj_fil
| |
36 # available, avoiding a deprecation warning under 2.6. Import sha otherwise, | |
37 # preserving 2.4 compatibility. | |
Nico
2016/10/10 14:59:51
I don't think we care about 2.4 compat. I think se
| |
38 try: | |
39 import hashlib | |
40 _new_sha1 = hashlib.sha1 | |
41 except ImportError: | |
42 import sha | |
43 _new_sha1 = sha.new | |
44 | |
34 generator_default_variables = { | 45 generator_default_variables = { |
35 'EXECUTABLE_PREFIX': '', | 46 'EXECUTABLE_PREFIX': '', |
36 'EXECUTABLE_SUFFIX': '', | 47 'EXECUTABLE_SUFFIX': '', |
37 'STATIC_LIB_PREFIX': 'lib', | 48 'STATIC_LIB_PREFIX': 'lib', |
38 'SHARED_LIB_PREFIX': 'lib', | 49 'SHARED_LIB_PREFIX': 'lib', |
39 'STATIC_LIB_SUFFIX': '.a', | 50 'STATIC_LIB_SUFFIX': '.a', |
40 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/$(TARGET)/geni', | 51 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/$(TARGET)/geni', |
41 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', | 52 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', |
42 'PRODUCT_DIR': '$(builddir)', | 53 'PRODUCT_DIR': '$(builddir)', |
43 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. | 54 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1736 self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append)) | 1747 self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append)) |
1737 else: | 1748 else: |
1738 # Regular rule, more than one output: Multiple outputs are tricky in | 1749 # Regular rule, more than one output: Multiple outputs are tricky in |
1739 # make. We will write three rules: | 1750 # make. We will write three rules: |
1740 # - All outputs depend on an intermediate file. | 1751 # - All outputs depend on an intermediate file. |
1741 # - Make .INTERMEDIATE depend on the intermediate. | 1752 # - Make .INTERMEDIATE depend on the intermediate. |
1742 # - The intermediate file depends on the inputs and executes the | 1753 # - The intermediate file depends on the inputs and executes the |
1743 # actual command. | 1754 # actual command. |
1744 # - The intermediate recipe will 'touch' the intermediate file. | 1755 # - The intermediate recipe will 'touch' the intermediate file. |
1745 # - The multi-output rule will have an do-nothing recipe. | 1756 # - The multi-output rule will have an do-nothing recipe. |
1746 intermediate = "%s.intermediate" % (command if command else self.target) | 1757 |
1758 # Hash the target name to avoid generating overlong filenames. | |
1759 cmddigest = _new_sha1(command if command else self.target).hexdigest() | |
1760 intermediate = "%s.intermediate" % (cmddigest) | |
1747 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) | 1761 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) |
1748 self.WriteLn('\t%s' % '@:'); | 1762 self.WriteLn('\t%s' % '@:'); |
1749 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) | 1763 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) |
1750 self.WriteLn('%s: %s%s' % | 1764 self.WriteLn('%s: %s%s' % |
1751 (intermediate, ' '.join(inputs), force_append)) | 1765 (intermediate, ' '.join(inputs), force_append)) |
1752 actions.insert(0, '$(call do_cmd,touch)') | 1766 actions.insert(0, '$(call do_cmd,touch)') |
1753 | 1767 |
1754 if actions: | 1768 if actions: |
1755 for action in actions: | 1769 for action in actions: |
1756 self.WriteLn('\t%s' % action) | 1770 self.WriteLn('\t%s' % action) |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2209 root_makefile.write("endif\n") | 2223 root_makefile.write("endif\n") |
2210 root_makefile.write('\n') | 2224 root_makefile.write('\n') |
2211 | 2225 |
2212 if (not generator_flags.get('standalone') | 2226 if (not generator_flags.get('standalone') |
2213 and generator_flags.get('auto_regeneration', True)): | 2227 and generator_flags.get('auto_regeneration', True)): |
2214 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2228 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2215 | 2229 |
2216 root_makefile.write(SHARED_FOOTER) | 2230 root_makefile.write(SHARED_FOOTER) |
2217 | 2231 |
2218 root_makefile.close() | 2232 root_makefile.close() |
OLD | NEW |