| 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 # |
| 11 # The code below generates a separate .mk file for each target, but | 11 # The code below generates a separate .mk file for each target, but |
| 12 # all are sourced by the top-level Makefile. This means that all | 12 # all are sourced by the top-level Makefile. This means that all |
| 13 # variables in .mk-files clobber one another. Be careful to use := | 13 # variables in .mk-files clobber one another. Be careful to use := |
| 14 # where appropriate for immediate evaluation, and similarly to watch | 14 # where appropriate for immediate evaluation, and similarly to watch |
| 15 # that you're not relying on a variable value to last beween different | 15 # that you're not relying on a variable value to last beween different |
| 16 # .mk files. | 16 # .mk files. |
| 17 # | 17 # |
| 18 # TODOs: | 18 # TODOs: |
| 19 # | 19 # |
| 20 # Global settings and utility functions are currently stuffed in the | 20 # Global settings and utility functions are currently stuffed in the |
| 21 # toplevel Makefile. It may make sense to generate some .mk files on | 21 # toplevel Makefile. It may make sense to generate some .mk files on |
| 22 # the side to keep the the files readable. | 22 # the side to keep the the files readable. |
| 23 | 23 |
| 24 from __future__ import print_function |
| 25 |
| 24 import os | 26 import os |
| 25 import re | 27 import re |
| 26 import sys | 28 import sys |
| 27 import subprocess | 29 import subprocess |
| 28 import gyp | 30 import gyp |
| 29 import gyp.common | 31 import gyp.common |
| 30 import gyp.xcode_emulation | 32 import gyp.xcode_emulation |
| 31 from gyp.common import GetEnvironFallback | 33 from gyp.common import GetEnvironFallback |
| 32 from gyp.common import GypError | 34 from gyp.common import GypError |
| 33 | 35 |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 for source in all_sources: | 640 for source in all_sources: |
| 639 name, ext = os.path.splitext(source) | 641 name, ext = os.path.splitext(source) |
| 640 is_compiled_file = ext in [ | 642 is_compiled_file = ext in [ |
| 641 '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] | 643 '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] |
| 642 if not is_compiled_file: | 644 if not is_compiled_file: |
| 643 continue | 645 continue |
| 644 basename = os.path.basename(name) # Don't include extension. | 646 basename = os.path.basename(name) # Don't include extension. |
| 645 basenames.setdefault(basename, []).append(source) | 647 basenames.setdefault(basename, []).append(source) |
| 646 | 648 |
| 647 error = '' | 649 error = '' |
| 648 for basename, files in basenames.iteritems(): | 650 for basename, files in basenames.items(): |
| 649 if len(files) > 1: | 651 if len(files) > 1: |
| 650 error += ' %s: %s\n' % (basename, ' '.join(files)) | 652 error += ' %s: %s\n' % (basename, ' '.join(files)) |
| 651 | 653 |
| 652 if error: | 654 if error: |
| 653 print('static library %s has several files with the same basename:\n' % | 655 print('static library %s has several files with the same basename:\n' % |
| 654 spec['target_name'] + error + 'libtool on OS X will generate' + | 656 spec['target_name'] + error + 'libtool on OS X will generate' + |
| 655 ' warnings for them.') | 657 ' warnings for them.') |
| 656 raise GypError('Duplicate basenames in sources section, see list above') | 658 raise GypError('Duplicate basenames in sources section, see list above') |
| 657 | 659 |
| 658 | 660 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 if self.flavor == 'mac': | 788 if self.flavor == 'mac': |
| 787 # libtool on OS X generates warnings for duplicate basenames in the same | 789 # libtool on OS X generates warnings for duplicate basenames in the same |
| 788 # target. | 790 # target. |
| 789 _ValidateSourcesForOSX(spec, all_sources) | 791 _ValidateSourcesForOSX(spec, all_sources) |
| 790 self.WriteSources( | 792 self.WriteSources( |
| 791 configs, deps, all_sources, extra_outputs, | 793 configs, deps, all_sources, extra_outputs, |
| 792 extra_link_deps, part_of_all, | 794 extra_link_deps, part_of_all, |
| 793 gyp.xcode_emulation.MacPrefixHeader( | 795 gyp.xcode_emulation.MacPrefixHeader( |
| 794 self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)), | 796 self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)), |
| 795 self.Pchify)) | 797 self.Pchify)) |
| 796 sources = filter(Compilable, all_sources) | 798 sources = [x for x in all_sources if Compilable(x)] |
| 797 if sources: | 799 if sources: |
| 798 self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) | 800 self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) |
| 799 extensions = set([os.path.splitext(s)[1] for s in sources]) | 801 extensions = set([os.path.splitext(s)[1] for s in sources]) |
| 800 for ext in extensions: | 802 for ext in extensions: |
| 801 if ext in self.suffix_rules_srcdir: | 803 if ext in self.suffix_rules_srcdir: |
| 802 self.WriteLn(self.suffix_rules_srcdir[ext]) | 804 self.WriteLn(self.suffix_rules_srcdir[ext]) |
| 803 self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2) | 805 self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2) |
| 804 for ext in extensions: | 806 for ext in extensions: |
| 805 if ext in self.suffix_rules_objdir1: | 807 if ext in self.suffix_rules_objdir1: |
| 806 self.WriteLn(self.suffix_rules_objdir1[ext]) | 808 self.WriteLn(self.suffix_rules_objdir1[ext]) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 # actions run on the host, so they should in theory only use host | 917 # actions run on the host, so they should in theory only use host |
| 916 # libraries, but until everything is made cross-compile safe, also use | 918 # libraries, but until everything is made cross-compile safe, also use |
| 917 # target libraries. | 919 # target libraries. |
| 918 # TODO(piman): when everything is cross-compile safe, remove lib.target | 920 # TODO(piman): when everything is cross-compile safe, remove lib.target |
| 919 self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:' | 921 self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:' |
| 920 '$(builddir)/lib.target:$$LD_LIBRARY_PATH; ' | 922 '$(builddir)/lib.target:$$LD_LIBRARY_PATH; ' |
| 921 'export LD_LIBRARY_PATH; ' | 923 'export LD_LIBRARY_PATH; ' |
| 922 '%s%s' | 924 '%s%s' |
| 923 % (name, cd_action, command)) | 925 % (name, cd_action, command)) |
| 924 self.WriteLn() | 926 self.WriteLn() |
| 925 outputs = map(self.Absolutify, outputs) | 927 outputs = [self.Absolutify(o) for o in outputs] |
| 926 # The makefile rules are all relative to the top dir, but the gyp actions | 928 # The makefile rules are all relative to the top dir, but the gyp actions |
| 927 # are defined relative to their containing dir. This replaces the obj | 929 # are defined relative to their containing dir. This replaces the obj |
| 928 # variable for the action rule with an absolute version so that the output | 930 # variable for the action rule with an absolute version so that the output |
| 929 # goes in the right place. | 931 # goes in the right place. |
| 930 # Only write the 'obj' and 'builddir' rules for the "primary" output (:1); | 932 # Only write the 'obj' and 'builddir' rules for the "primary" output (:1); |
| 931 # it's superfluous for the "extra outputs", and this avoids accidentally | 933 # it's superfluous for the "extra outputs", and this avoids accidentally |
| 932 # writing duplicate dummy rules for those outputs. | 934 # writing duplicate dummy rules for those outputs. |
| 933 # Same for environment. | 935 # Same for environment. |
| 934 self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) | 936 self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) |
| 935 self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) | 937 self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 # which is fine in hash-based dependency systems like scons | 1007 # which is fine in hash-based dependency systems like scons |
| 1006 # and forge, but not kosher in the make world. After some | 1008 # and forge, but not kosher in the make world. After some |
| 1007 # discussion, hacking around it here seems like the least | 1009 # discussion, hacking around it here seems like the least |
| 1008 # amount of pain. | 1010 # amount of pain. |
| 1009 actions += ['@touch --no-create $@'] | 1011 actions += ['@touch --no-create $@'] |
| 1010 | 1012 |
| 1011 # See the comment in WriteCopies about expanding env vars. | 1013 # See the comment in WriteCopies about expanding env vars. |
| 1012 outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] | 1014 outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] |
| 1013 inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] | 1015 inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] |
| 1014 | 1016 |
| 1015 outputs = map(self.Absolutify, outputs) | 1017 outputs = [self.Absolutify(o) for o in outputs] |
| 1016 all_outputs += outputs | 1018 all_outputs += outputs |
| 1017 # Only write the 'obj' and 'builddir' rules for the "primary" output | 1019 # Only write the 'obj' and 'builddir' rules for the "primary" output |
| 1018 # (:1); it's superfluous for the "extra outputs", and this avoids | 1020 # (:1); it's superfluous for the "extra outputs", and this avoids |
| 1019 # accidentally writing duplicate dummy rules for those outputs. | 1021 # accidentally writing duplicate dummy rules for those outputs. |
| 1020 self.WriteLn('%s: obj := $(abs_obj)' % outputs[0]) | 1022 self.WriteLn('%s: obj := $(abs_obj)' % outputs[0]) |
| 1021 self.WriteLn('%s: builddir := $(abs_builddir)' % outputs[0]) | 1023 self.WriteLn('%s: builddir := $(abs_builddir)' % outputs[0]) |
| 1022 self.WriteMakeRule(outputs, inputs, actions, | 1024 self.WriteMakeRule(outputs, inputs, actions, |
| 1023 command="%s_%d" % (name, count)) | 1025 command="%s_%d" % (name, count)) |
| 1024 # Spaces in rule filenames are not supported, but rule variables have | 1026 # Spaces in rule filenames are not supported, but rule variables have |
| 1025 # spaces in them (e.g. RULE_INPUT_PATH expands to '$(abspath $<)'). | 1027 # spaces in them (e.g. RULE_INPUT_PATH expands to '$(abspath $<)'). |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 self.WriteList(cflags_c, 'CFLAGS_C_%s' % configname) | 1205 self.WriteList(cflags_c, 'CFLAGS_C_%s' % configname) |
| 1204 self.WriteLn("# Flags passed to only C++ files."); | 1206 self.WriteLn("# Flags passed to only C++ files."); |
| 1205 self.WriteList(cflags_cc, 'CFLAGS_CC_%s' % configname) | 1207 self.WriteList(cflags_cc, 'CFLAGS_CC_%s' % configname) |
| 1206 if self.flavor == 'mac': | 1208 if self.flavor == 'mac': |
| 1207 self.WriteLn("# Flags passed to only ObjC files."); | 1209 self.WriteLn("# Flags passed to only ObjC files."); |
| 1208 self.WriteList(cflags_objc, 'CFLAGS_OBJC_%s' % configname) | 1210 self.WriteList(cflags_objc, 'CFLAGS_OBJC_%s' % configname) |
| 1209 self.WriteLn("# Flags passed to only ObjC++ files."); | 1211 self.WriteLn("# Flags passed to only ObjC++ files."); |
| 1210 self.WriteList(cflags_objcc, 'CFLAGS_OBJCC_%s' % configname) | 1212 self.WriteList(cflags_objcc, 'CFLAGS_OBJCC_%s' % configname) |
| 1211 includes = config.get('include_dirs') | 1213 includes = config.get('include_dirs') |
| 1212 if includes: | 1214 if includes: |
| 1213 includes = map(Sourceify, map(self.Absolutify, includes)) | 1215 includes = [Sourceify(self.Absolutify(include)) for include in includes] |
| 1214 self.WriteList(includes, 'INCS_%s' % configname, prefix='-I') | 1216 self.WriteList(includes, 'INCS_%s' % configname, prefix='-I') |
| 1215 | 1217 |
| 1216 compilable = filter(Compilable, sources) | 1218 compilable = filter(Compilable, sources) |
| 1217 objs = map(self.Objectify, map(self.Absolutify, map(Target, compilable))) | 1219 objs = [self.Objectify(self.Absolutify(Target(x))) for x in compilable] |
| 1218 self.WriteList(objs, 'OBJS') | 1220 self.WriteList(objs, 'OBJS') |
| 1219 | 1221 |
| 1220 for obj in objs: | 1222 for obj in objs: |
| 1221 assert ' ' not in obj, ( | 1223 assert ' ' not in obj, ( |
| 1222 "Spaces in object filenames not supported (%s)" % obj) | 1224 "Spaces in object filenames not supported (%s)" % obj) |
| 1223 self.WriteLn('# Add to the list of files we specially track ' | 1225 self.WriteLn('# Add to the list of files we specially track ' |
| 1224 'dependencies for.') | 1226 'dependencies for.') |
| 1225 self.WriteLn('all_deps += $(OBJS)') | 1227 self.WriteLn('all_deps += $(OBJS)') |
| 1226 self.WriteLn() | 1228 self.WriteLn() |
| 1227 | 1229 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 "$(INCS_$(BUILDTYPE)) " | 1281 "$(INCS_$(BUILDTYPE)) " |
| 1280 "%s " % precompiled_header.GetInclude('mm') + | 1282 "%s " % precompiled_header.GetInclude('mm') + |
| 1281 "$(CFLAGS_$(BUILDTYPE)) " | 1283 "$(CFLAGS_$(BUILDTYPE)) " |
| 1282 "$(CFLAGS_CC_$(BUILDTYPE)) " | 1284 "$(CFLAGS_CC_$(BUILDTYPE)) " |
| 1283 "$(CFLAGS_OBJCC_$(BUILDTYPE))") | 1285 "$(CFLAGS_OBJCC_$(BUILDTYPE))") |
| 1284 | 1286 |
| 1285 self.WritePchTargets(precompiled_header.GetPchBuildCommands()) | 1287 self.WritePchTargets(precompiled_header.GetPchBuildCommands()) |
| 1286 | 1288 |
| 1287 # If there are any object files in our input file list, link them into our | 1289 # If there are any object files in our input file list, link them into our |
| 1288 # output. | 1290 # output. |
| 1289 extra_link_deps += filter(Linkable, sources) | 1291 extra_link_deps += [source for source in sources if Linkable(source)] |
| 1290 | 1292 |
| 1291 self.WriteLn() | 1293 self.WriteLn() |
| 1292 | 1294 |
| 1293 def WritePchTargets(self, pch_commands): | 1295 def WritePchTargets(self, pch_commands): |
| 1294 """Writes make rules to compile prefix headers.""" | 1296 """Writes make rules to compile prefix headers.""" |
| 1295 if not pch_commands: | 1297 if not pch_commands: |
| 1296 return | 1298 return |
| 1297 | 1299 |
| 1298 for gch, lang_flag, lang, input in pch_commands: | 1300 for gch, lang_flag, lang, input in pch_commands: |
| 1299 extra_flags = { | 1301 extra_flags = { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 target_prefix = 'lib' | 1346 target_prefix = 'lib' |
| 1345 target_ext = '.a' | 1347 target_ext = '.a' |
| 1346 elif self.type in ('loadable_module', 'shared_library'): | 1348 elif self.type in ('loadable_module', 'shared_library'): |
| 1347 if target[:3] == 'lib': | 1349 if target[:3] == 'lib': |
| 1348 target = target[3:] | 1350 target = target[3:] |
| 1349 target_prefix = 'lib' | 1351 target_prefix = 'lib' |
| 1350 target_ext = '.so' | 1352 target_ext = '.so' |
| 1351 elif self.type == 'none': | 1353 elif self.type == 'none': |
| 1352 target = '%s.stamp' % target | 1354 target = '%s.stamp' % target |
| 1353 elif self.type != 'executable': | 1355 elif self.type != 'executable': |
| 1354 print ("ERROR: What output file should be generated?", | 1356 print(("ERROR: What output file should be generated?", |
| 1355 "type", self.type, "target", target) | 1357 "type", self.type, "target", target)) |
| 1356 | 1358 |
| 1357 target_prefix = spec.get('product_prefix', target_prefix) | 1359 target_prefix = spec.get('product_prefix', target_prefix) |
| 1358 target = spec.get('product_name', target) | 1360 target = spec.get('product_name', target) |
| 1359 product_ext = spec.get('product_extension') | 1361 product_ext = spec.get('product_extension') |
| 1360 if product_ext: | 1362 if product_ext: |
| 1361 target_ext = '.' + product_ext | 1363 target_ext = '.' + product_ext |
| 1362 | 1364 |
| 1363 return target_prefix + target + target_ext | 1365 return target_prefix + target + target_ext |
| 1364 | 1366 |
| 1365 | 1367 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 | 1511 |
| 1510 for configname in target_postbuilds: | 1512 for configname in target_postbuilds: |
| 1511 self.WriteLn('%s: TARGET_POSTBUILDS_%s := %s' % | 1513 self.WriteLn('%s: TARGET_POSTBUILDS_%s := %s' % |
| 1512 (QuoteSpaces(self.output), | 1514 (QuoteSpaces(self.output), |
| 1513 configname, | 1515 configname, |
| 1514 gyp.common.EncodePOSIXShellList(target_postbuilds[configname]))) | 1516 gyp.common.EncodePOSIXShellList(target_postbuilds[configname]))) |
| 1515 | 1517 |
| 1516 # Postbuilds expect to be run in the gyp file's directory, so insert an | 1518 # Postbuilds expect to be run in the gyp file's directory, so insert an |
| 1517 # implicit postbuild to cd to there. | 1519 # implicit postbuild to cd to there. |
| 1518 postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path])) | 1520 postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path])) |
| 1519 for i in xrange(len(postbuilds)): | 1521 for i, postbuild in enumerate(postbuilds): |
| 1520 if not postbuilds[i].startswith('$'): | 1522 if not postbuild.startswith('$'): |
| 1521 postbuilds[i] = EscapeShellArgument(postbuilds[i]) | 1523 postbuilds[i] = EscapeShellArgument(postbuild) |
| 1522 self.WriteLn('%s: builddir := $(abs_builddir)' % QuoteSpaces(self.output)) | 1524 self.WriteLn('%s: builddir := $(abs_builddir)' % QuoteSpaces(self.output)) |
| 1523 self.WriteLn('%s: POSTBUILDS := %s' % ( | 1525 self.WriteLn('%s: POSTBUILDS := %s' % ( |
| 1524 QuoteSpaces(self.output), ' '.join(postbuilds))) | 1526 QuoteSpaces(self.output), ' '.join(postbuilds))) |
| 1525 | 1527 |
| 1526 # A bundle directory depends on its dependencies such as bundle resources | 1528 # A bundle directory depends on its dependencies such as bundle resources |
| 1527 # and bundle binary. When all dependencies have been built, the bundle | 1529 # and bundle binary. When all dependencies have been built, the bundle |
| 1528 # needs to be packaged. | 1530 # needs to be packaged. |
| 1529 if self.is_mac_bundle: | 1531 if self.is_mac_bundle: |
| 1530 # If the framework doesn't contain a binary, then nothing depends | 1532 # If the framework doesn't contain a binary, then nothing depends |
| 1531 # on the actions -- make the framework depend on them directly too. | 1533 # on the actions -- make the framework depend on them directly too. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 part_of_all, postbuilds=postbuilds) | 1603 part_of_all, postbuilds=postbuilds) |
| 1602 else: | 1604 else: |
| 1603 self.WriteDoCmd( | 1605 self.WriteDoCmd( |
| 1604 [self.output_binary], link_deps, 'solink_module', part_of_all, | 1606 [self.output_binary], link_deps, 'solink_module', part_of_all, |
| 1605 postbuilds=postbuilds) | 1607 postbuilds=postbuilds) |
| 1606 elif self.type == 'none': | 1608 elif self.type == 'none': |
| 1607 # Write a stamp line. | 1609 # Write a stamp line. |
| 1608 self.WriteDoCmd([self.output_binary], deps, 'touch', part_of_all, | 1610 self.WriteDoCmd([self.output_binary], deps, 'touch', part_of_all, |
| 1609 postbuilds=postbuilds) | 1611 postbuilds=postbuilds) |
| 1610 else: | 1612 else: |
| 1611 print "WARNING: no output for", self.type, target | 1613 print("WARNING: no output for", self.type, target) |
| 1612 | 1614 |
| 1613 # Add an alias for each target (if there are any outputs). | 1615 # Add an alias for each target (if there are any outputs). |
| 1614 # Installable target aliases are created below. | 1616 # Installable target aliases are created below. |
| 1615 if ((self.output and self.output != self.target) and | 1617 if ((self.output and self.output != self.target) and |
| 1616 (self.type not in self._INSTALLABLE_TARGETS)): | 1618 (self.type not in self._INSTALLABLE_TARGETS)): |
| 1617 self.WriteMakeRule([self.target], [self.output], | 1619 self.WriteMakeRule([self.target], [self.output], |
| 1618 comment='Add target alias', phony = True) | 1620 comment='Add target alias', phony = True) |
| 1619 if part_of_all: | 1621 if part_of_all: |
| 1620 self.WriteMakeRule(['all'], [self.target], | 1622 self.WriteMakeRule(['all'], [self.target], |
| 1621 comment = 'Add target alias to "all" target.', | 1623 comment = 'Add target alias to "all" target.', |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 inputs: a list of inputs for the rule | 1710 inputs: a list of inputs for the rule |
| 1709 actions: a list of shell commands to run for the rule | 1711 actions: a list of shell commands to run for the rule |
| 1710 comment: a comment to put in the Makefile above the rule (also useful | 1712 comment: a comment to put in the Makefile above the rule (also useful |
| 1711 for making this Python script's code self-documenting) | 1713 for making this Python script's code self-documenting) |
| 1712 order_only: if true, makes the dependency order-only | 1714 order_only: if true, makes the dependency order-only |
| 1713 force: if true, include FORCE_DO_CMD as an order-only dep | 1715 force: if true, include FORCE_DO_CMD as an order-only dep |
| 1714 phony: if true, the rule does not actually generate the named output, the | 1716 phony: if true, the rule does not actually generate the named output, the |
| 1715 output is just a name to run the rule | 1717 output is just a name to run the rule |
| 1716 command: (optional) command name to generate unambiguous labels | 1718 command: (optional) command name to generate unambiguous labels |
| 1717 """ | 1719 """ |
| 1718 outputs = map(QuoteSpaces, outputs) | 1720 outputs = [QuoteSpaces(o) for o in outputs] |
| 1719 inputs = map(QuoteSpaces, inputs) | 1721 inputs = map(QuoteSpaces, inputs) |
| 1720 | 1722 |
| 1721 if comment: | 1723 if comment: |
| 1722 self.WriteLn('# ' + comment) | 1724 self.WriteLn('# ' + comment) |
| 1723 if phony: | 1725 if phony: |
| 1724 self.WriteLn('.PHONY: ' + ' '.join(outputs)) | 1726 self.WriteLn('.PHONY: ' + ' '.join(outputs)) |
| 1725 if actions: | 1727 if actions: |
| 1726 self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) | 1728 self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) |
| 1727 force_append = ' FORCE_DO_CMD' if force else '' | 1729 force_append = ' FORCE_DO_CMD' if force else '' |
| 1728 | 1730 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 build_files_args)}) | 1952 build_files_args)}) |
| 1951 | 1953 |
| 1952 | 1954 |
| 1953 def PerformBuild(data, configurations, params): | 1955 def PerformBuild(data, configurations, params): |
| 1954 options = params['options'] | 1956 options = params['options'] |
| 1955 for config in configurations: | 1957 for config in configurations: |
| 1956 arguments = ['make'] | 1958 arguments = ['make'] |
| 1957 if options.toplevel_dir and options.toplevel_dir != '.': | 1959 if options.toplevel_dir and options.toplevel_dir != '.': |
| 1958 arguments += '-C', options.toplevel_dir | 1960 arguments += '-C', options.toplevel_dir |
| 1959 arguments.append('BUILDTYPE=' + config) | 1961 arguments.append('BUILDTYPE=' + config) |
| 1960 print 'Building [%s]: %s' % (config, arguments) | 1962 print('Building [%s]: %s' % (config, arguments)) |
| 1961 subprocess.check_call(arguments) | 1963 subprocess.check_call(arguments) |
| 1962 | 1964 |
| 1963 | 1965 |
| 1964 def GenerateOutput(target_list, target_dicts, data, params): | 1966 def GenerateOutput(target_list, target_dicts, data, params): |
| 1965 options = params['options'] | 1967 options = params['options'] |
| 1966 flavor = gyp.common.GetFlavor(params) | 1968 flavor = gyp.common.GetFlavor(params) |
| 1967 generator_flags = params.get('generator_flags', {}) | 1969 generator_flags = params.get('generator_flags', {}) |
| 1968 builddir_name = generator_flags.get('output_dir', 'out') | 1970 builddir_name = generator_flags.get('output_dir', 'out') |
| 1969 android_ndk_version = generator_flags.get('android_ndk_version', None) | 1971 android_ndk_version = generator_flags.get('android_ndk_version', None) |
| 1970 default_target = generator_flags.get('default_target', 'all') | 1972 default_target = generator_flags.get('default_target', 'all') |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 root_makefile.write("endif\n") | 2211 root_makefile.write("endif\n") |
| 2210 root_makefile.write('\n') | 2212 root_makefile.write('\n') |
| 2211 | 2213 |
| 2212 if (not generator_flags.get('standalone') | 2214 if (not generator_flags.get('standalone') |
| 2213 and generator_flags.get('auto_regeneration', True)): | 2215 and generator_flags.get('auto_regeneration', True)): |
| 2214 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2216 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
| 2215 | 2217 |
| 2216 root_makefile.write(SHARED_FOOTER) | 2218 root_makefile.write(SHARED_FOOTER) |
| 2217 | 2219 |
| 2218 root_makefile.close() | 2220 root_makefile.close() |
| OLD | NEW |