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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 elif len(outputs) == 1: | 1734 elif len(outputs) == 1: |
1735 # Regular rule, one output: Just write a simple rule. | 1735 # Regular rule, one output: Just write a simple rule. |
1736 self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append)) | 1736 self.WriteLn('%s: %s%s' % (outputs[0], ' '.join(inputs), force_append)) |
1737 else: | 1737 else: |
1738 # Regular rule, more than one output: Multiple outputs are tricky in | 1738 # Regular rule, more than one output: Multiple outputs are tricky in |
1739 # make. We will write three rules: | 1739 # make. We will write three rules: |
1740 # - All outputs depend on an intermediate file. | 1740 # - All outputs depend on an intermediate file. |
1741 # - Make .INTERMEDIATE depend on the intermediate. | 1741 # - Make .INTERMEDIATE depend on the intermediate. |
1742 # - The intermediate file depends on the inputs and executes the | 1742 # - The intermediate file depends on the inputs and executes the |
1743 # actual command. | 1743 # actual command. |
1744 # | 1744 # - The intermediate recipe will 'touch' the intermediate file. |
1745 # For an explanation of the problem and several solutions that don't | 1745 # - The multi-output rule will have an do-nothing recipe. |
1746 # work, see this: | |
1747 # http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html | |
1748 intermediate = "%s.intermediate" % (command if command else self.target) | 1746 intermediate = "%s.intermediate" % (command if command else self.target) |
1749 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) | 1747 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) |
| 1748 self.WriteLn('\t%s' % '@:'); |
1750 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) | 1749 self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) |
1751 self.WriteLn('%s: %s%s' % | 1750 self.WriteLn('%s: %s%s' % |
1752 (intermediate, ' '.join(inputs), force_append)) | 1751 (intermediate, ' '.join(inputs), force_append)) |
| 1752 actions.insert(0, '$(call do_cmd,touch)') |
1753 | 1753 |
1754 if actions: | 1754 if actions: |
1755 for action in actions: | 1755 for action in actions: |
1756 self.WriteLn('\t%s' % action) | 1756 self.WriteLn('\t%s' % action) |
1757 self.WriteLn() | 1757 self.WriteLn() |
1758 | 1758 |
1759 | 1759 |
1760 def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): | 1760 def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): |
1761 """Write a set of LOCAL_XXX definitions for Android NDK. | 1761 """Write a set of LOCAL_XXX definitions for Android NDK. |
1762 | 1762 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 root_makefile.write("endif\n") | 2200 root_makefile.write("endif\n") |
2201 root_makefile.write('\n') | 2201 root_makefile.write('\n') |
2202 | 2202 |
2203 if (not generator_flags.get('standalone') | 2203 if (not generator_flags.get('standalone') |
2204 and generator_flags.get('auto_regeneration', True)): | 2204 and generator_flags.get('auto_regeneration', True)): |
2205 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2205 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
2206 | 2206 |
2207 root_makefile.write(SHARED_FOOTER) | 2207 root_makefile.write(SHARED_FOOTER) |
2208 | 2208 |
2209 root_makefile.close() | 2209 root_makefile.close() |
OLD | NEW |