Chromium Code Reviews| 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 import hashlib | |
| 35 | |
| 34 generator_default_variables = { | 36 generator_default_variables = { |
| 35 'EXECUTABLE_PREFIX': '', | 37 'EXECUTABLE_PREFIX': '', |
| 36 'EXECUTABLE_SUFFIX': '', | 38 'EXECUTABLE_SUFFIX': '', |
| 37 'STATIC_LIB_PREFIX': 'lib', | 39 'STATIC_LIB_PREFIX': 'lib', |
| 38 'SHARED_LIB_PREFIX': 'lib', | 40 'SHARED_LIB_PREFIX': 'lib', |
| 39 'STATIC_LIB_SUFFIX': '.a', | 41 'STATIC_LIB_SUFFIX': '.a', |
| 40 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/$(TARGET)/geni', | 42 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/$(TARGET)/geni', |
| 41 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', | 43 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', |
| 42 'PRODUCT_DIR': '$(builddir)', | 44 'PRODUCT_DIR': '$(builddir)', |
| 43 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. | 45 '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)) | 1738 self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append)) |
| 1737 else: | 1739 else: |
| 1738 # Regular rule, more than one output: Multiple outputs are tricky in | 1740 # Regular rule, more than one output: Multiple outputs are tricky in |
| 1739 # make. We will write three rules: | 1741 # make. We will write three rules: |
| 1740 # - All outputs depend on an intermediate file. | 1742 # - All outputs depend on an intermediate file. |
| 1741 # - Make .INTERMEDIATE depend on the intermediate. | 1743 # - Make .INTERMEDIATE depend on the intermediate. |
| 1742 # - The intermediate file depends on the inputs and executes the | 1744 # - The intermediate file depends on the inputs and executes the |
| 1743 # actual command. | 1745 # actual command. |
| 1744 # - The intermediate recipe will 'touch' the intermediate file. | 1746 # - The intermediate recipe will 'touch' the intermediate file. |
| 1745 # - The multi-output rule will have an do-nothing recipe. | 1747 # - The multi-output rule will have an do-nothing recipe. |
| 1746 intermediate = "%s.intermediate" % (command if command else self.target) | 1748 |
| 1749 # Hash the target name to avoid generating overlong filenames. | |
| 1750 cmddigest = hashlib.sha1(command if command else self.target).hexdigest() | |
| 1751 intermediate = "%s.intermediate" % (cmddigest) | |
|
Nico
2016/10/13 13:25:11
(nit: no need for the parens here)
| |
| 1747 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) | 1752 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) |
| 1748 self.WriteLn('\t%s' % '@:'); | 1753 self.WriteLn('\t%s' % '@:'); |
| 1749 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) | 1754 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) |
| 1750 self.WriteLn('%s: %s%s' % | 1755 self.WriteLn('%s: %s%s' % |
| 1751 (intermediate, ' '.join(inputs), force_append)) | 1756 (intermediate, ' '.join(inputs), force_append)) |
| 1752 actions.insert(0, '$(call do_cmd,touch)') | 1757 actions.insert(0, '$(call do_cmd,touch)') |
| 1753 | 1758 |
| 1754 if actions: | 1759 if actions: |
| 1755 for action in actions: | 1760 for action in actions: |
| 1756 self.WriteLn('\t%s' % action) | 1761 self.WriteLn('\t%s' % action) |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2209 root_makefile.write("endif\n") | 2214 root_makefile.write("endif\n") |
| 2210 root_makefile.write('\n') | 2215 root_makefile.write('\n') |
| 2211 | 2216 |
| 2212 if (not generator_flags.get('standalone') | 2217 if (not generator_flags.get('standalone') |
| 2213 and generator_flags.get('auto_regeneration', True)): | 2218 and generator_flags.get('auto_regeneration', True)): |
| 2214 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2219 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
| 2215 | 2220 |
| 2216 root_makefile.write(SHARED_FOOTER) | 2221 root_makefile.write(SHARED_FOOTER) |
| 2217 | 2222 |
| 2218 root_makefile.close() | 2223 root_makefile.close() |
| OLD | NEW |