| 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 # 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 output_filename: output .mk file name to write | 687 output_filename: output .mk file name to write |
| 688 spec, configs: gyp info | 688 spec, configs: gyp info |
| 689 part_of_all: flag indicating this target is part of 'all' | 689 part_of_all: flag indicating this target is part of 'all' |
| 690 """ | 690 """ |
| 691 ensure_directory_exists(output_filename) | 691 ensure_directory_exists(output_filename) |
| 692 | 692 |
| 693 self.fp = open(output_filename, 'w') | 693 self.fp = open(output_filename, 'w') |
| 694 | 694 |
| 695 self.fp.write(header) | 695 self.fp.write(header) |
| 696 | 696 |
| 697 self.qualified_target = qualified_target |
| 697 self.path = base_path | 698 self.path = base_path |
| 698 self.target = spec['target_name'] | 699 self.target = spec['target_name'] |
| 699 self.type = spec['type'] | 700 self.type = spec['type'] |
| 700 self.toolset = spec['toolset'] | 701 self.toolset = spec['toolset'] |
| 701 | 702 |
| 702 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) | 703 self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) |
| 703 if self.flavor == 'mac': | 704 if self.flavor == 'mac': |
| 704 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) | 705 self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) |
| 705 else: | 706 else: |
| 706 self.xcode_settings = None | 707 self.xcode_settings = None |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 """Write Makefile code for any 'actions' from the gyp input. | 834 """Write Makefile code for any 'actions' from the gyp input. |
| 834 | 835 |
| 835 extra_sources: a list that will be filled in with newly generated source | 836 extra_sources: a list that will be filled in with newly generated source |
| 836 files, if any | 837 files, if any |
| 837 extra_outputs: a list that will be filled in with any outputs of these | 838 extra_outputs: a list that will be filled in with any outputs of these |
| 838 actions (used to make other pieces dependent on these | 839 actions (used to make other pieces dependent on these |
| 839 actions) | 840 actions) |
| 840 part_of_all: flag indicating this target is part of 'all' | 841 part_of_all: flag indicating this target is part of 'all' |
| 841 """ | 842 """ |
| 842 for action in actions: | 843 for action in actions: |
| 843 name = self.target + '_' + StringToMakefileVariable(action['action_name']) | 844 name = StringToMakefileVariable('%s_%s' % (self.qualified_target, |
| 845 action['action_name'])) |
| 844 self.WriteLn('### Rules for action "%s":' % action['action_name']) | 846 self.WriteLn('### Rules for action "%s":' % action['action_name']) |
| 845 inputs = action['inputs'] | 847 inputs = action['inputs'] |
| 846 outputs = action['outputs'] | 848 outputs = action['outputs'] |
| 847 | 849 |
| 848 # Build up a list of outputs. | 850 # Build up a list of outputs. |
| 849 # Collect the output dirs we'll need. | 851 # Collect the output dirs we'll need. |
| 850 dirs = set() | 852 dirs = set() |
| 851 for out in outputs: | 853 for out in outputs: |
| 852 dir = os.path.split(out)[0] | 854 dir = os.path.split(out)[0] |
| 853 if dir: | 855 if dir: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 extra_mac_bundle_resources, part_of_all): | 929 extra_mac_bundle_resources, part_of_all): |
| 928 """Write Makefile code for any 'rules' from the gyp input. | 930 """Write Makefile code for any 'rules' from the gyp input. |
| 929 | 931 |
| 930 extra_sources: a list that will be filled in with newly generated source | 932 extra_sources: a list that will be filled in with newly generated source |
| 931 files, if any | 933 files, if any |
| 932 extra_outputs: a list that will be filled in with any outputs of these | 934 extra_outputs: a list that will be filled in with any outputs of these |
| 933 rules (used to make other pieces dependent on these rules) | 935 rules (used to make other pieces dependent on these rules) |
| 934 part_of_all: flag indicating this target is part of 'all' | 936 part_of_all: flag indicating this target is part of 'all' |
| 935 """ | 937 """ |
| 936 for rule in rules: | 938 for rule in rules: |
| 937 name = self.target + '_' + StringToMakefileVariable(rule['rule_name']) | 939 name = StringToMakefileVariable('%s_%s' % (self.qualified_target, |
| 940 rule['rule_name'])) |
| 938 count = 0 | 941 count = 0 |
| 939 self.WriteLn('### Generated for rule %s:' % name) | 942 self.WriteLn('### Generated for rule %s:' % name) |
| 940 | 943 |
| 941 all_outputs = [] | 944 all_outputs = [] |
| 942 | 945 |
| 943 for rule_source in rule.get('rule_sources', []): | 946 for rule_source in rule.get('rule_sources', []): |
| 944 dirs = set() | 947 dirs = set() |
| 945 (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) | 948 (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) |
| 946 (rule_source_root, rule_source_ext) = \ | 949 (rule_source_root, rule_source_ext) = \ |
| 947 os.path.splitext(rule_source_basename) | 950 os.path.splitext(rule_source_basename) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 | 1040 |
| 1038 def WriteCopies(self, copies, extra_outputs, part_of_all): | 1041 def WriteCopies(self, copies, extra_outputs, part_of_all): |
| 1039 """Write Makefile code for any 'copies' from the gyp input. | 1042 """Write Makefile code for any 'copies' from the gyp input. |
| 1040 | 1043 |
| 1041 extra_outputs: a list that will be filled in with any outputs of this action | 1044 extra_outputs: a list that will be filled in with any outputs of this action |
| 1042 (used to make other pieces dependent on this action) | 1045 (used to make other pieces dependent on this action) |
| 1043 part_of_all: flag indicating this target is part of 'all' | 1046 part_of_all: flag indicating this target is part of 'all' |
| 1044 """ | 1047 """ |
| 1045 self.WriteLn('### Generated for copy rule.') | 1048 self.WriteLn('### Generated for copy rule.') |
| 1046 | 1049 |
| 1047 variable = self.target + '_copies' | 1050 variable = StringToMakefileVariable(self.qualified_target + '_copies') |
| 1048 outputs = [] | 1051 outputs = [] |
| 1049 for copy in copies: | 1052 for copy in copies: |
| 1050 for path in copy['files']: | 1053 for path in copy['files']: |
| 1051 # Absolutify() calls normpath, stripping trailing slashes. | 1054 # Absolutify() calls normpath, stripping trailing slashes. |
| 1052 path = Sourceify(self.Absolutify(path)) | 1055 path = Sourceify(self.Absolutify(path)) |
| 1053 filename = os.path.split(path)[1] | 1056 filename = os.path.split(path)[1] |
| 1054 output = Sourceify(self.Absolutify(os.path.join(copy['destination'], | 1057 output = Sourceify(self.Absolutify(os.path.join(copy['destination'], |
| 1055 filename))) | 1058 filename))) |
| 1056 | 1059 |
| 1057 # If the output path has variables in it, which happens in practice for | 1060 # If the output path has variables in it, which happens in practice for |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 root_makefile.write(" include " + include_file + "\n") | 2124 root_makefile.write(" include " + include_file + "\n") |
| 2122 root_makefile.write("endif\n") | 2125 root_makefile.write("endif\n") |
| 2123 root_makefile.write('\n') | 2126 root_makefile.write('\n') |
| 2124 | 2127 |
| 2125 if generator_flags.get('auto_regeneration', True): | 2128 if generator_flags.get('auto_regeneration', True): |
| 2126 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2129 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
| 2127 | 2130 |
| 2128 root_makefile.write(SHARED_FOOTER) | 2131 root_makefile.write(SHARED_FOOTER) |
| 2129 | 2132 |
| 2130 root_makefile.close() | 2133 root_makefile.close() |
| OLD | NEW |