| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 # file for | 118 # file for |
| 119 # Chromium\ Framework.framework/foo | 119 # Chromium\ Framework.framework/foo |
| 120 # is for example | 120 # is for example |
| 121 # out/Release/.deps/out/Release/Chromium?Framework.framework/foo | 121 # out/Release/.deps/out/Release/Chromium?Framework.framework/foo |
| 122 # This is the replacement character. | 122 # This is the replacement character. |
| 123 SPACE_REPLACEMENT = '?' | 123 SPACE_REPLACEMENT = '?' |
| 124 | 124 |
| 125 | 125 |
| 126 LINK_COMMANDS_LINUX = """\ | 126 LINK_COMMANDS_LINUX = """\ |
| 127 quiet_cmd_alink = AR($(TOOLSET)) $@ | 127 quiet_cmd_alink = AR($(TOOLSET)) $@ |
| 128 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) | 128 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) |
| 129 |
| 130 quiet_cmd_alink_thin = AR($(TOOLSET)) $@ |
| 131 cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) |
| 129 | 132 |
| 130 # Due to circular dependencies between libraries :(, we wrap the | 133 # Due to circular dependencies between libraries :(, we wrap the |
| 131 # special "figure out circular dependencies" flags around the entire | 134 # special "figure out circular dependencies" flags around the entire |
| 132 # input list during linking. | 135 # input list during linking. |
| 133 quiet_cmd_link = LINK($(TOOLSET)) $@ | 136 quiet_cmd_link = LINK($(TOOLSET)) $@ |
| 134 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s
tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) | 137 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s
tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) |
| 135 | 138 |
| 136 # We support two kinds of shared objects (.so): | 139 # We support two kinds of shared objects (.so): |
| 137 # 1) shared_library, which is just bundling together many dependent libraries | 140 # 1) shared_library, which is just bundling together many dependent libraries |
| 138 # into a link line. | 141 # into a link line. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 169 cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o
"$@" $(LD_INPUTS) $(LIBS) | 172 cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o
"$@" $(LD_INPUTS) $(LIBS) |
| 170 | 173 |
| 171 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass | 174 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass |
| 172 # -bundle -single_module here (for osmesa.so). | 175 # -bundle -single_module here (for osmesa.so). |
| 173 quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ | 176 quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ |
| 174 cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSE
T)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) | 177 cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSE
T)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) |
| 175 """ | 178 """ |
| 176 | 179 |
| 177 LINK_COMMANDS_ANDROID = """\ | 180 LINK_COMMANDS_ANDROID = """\ |
| 178 quiet_cmd_alink = AR($(TOOLSET)) $@ | 181 quiet_cmd_alink = AR($(TOOLSET)) $@ |
| 179 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) | 182 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) |
| 183 |
| 184 quiet_cmd_alink_thin = AR($(TOOLSET)) $@ |
| 185 cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) |
| 180 | 186 |
| 181 # Due to circular dependencies between libraries :(, we wrap the | 187 # Due to circular dependencies between libraries :(, we wrap the |
| 182 # special "figure out circular dependencies" flags around the entire | 188 # special "figure out circular dependencies" flags around the entire |
| 183 # input list during linking. | 189 # input list during linking. |
| 184 quiet_cmd_link = LINK($(TOOLSET)) $@ | 190 quiet_cmd_link = LINK($(TOOLSET)) $@ |
| 185 quiet_cmd_link_host = LINK($(TOOLSET)) $@ | 191 quiet_cmd_link_host = LINK($(TOOLSET)) $@ |
| 186 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s
tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) | 192 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s
tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) |
| 187 cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(
LD_INPUTS) $(LIBS) | 193 cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(
LD_INPUTS) $(LIBS) |
| 188 | 194 |
| 189 # Other shared-object link notes: | 195 # Other shared-object link notes: |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 extra_link_deps = [] | 716 extra_link_deps = [] |
| 711 extra_mac_bundle_resources = [] | 717 extra_mac_bundle_resources = [] |
| 712 mac_bundle_deps = [] | 718 mac_bundle_deps = [] |
| 713 | 719 |
| 714 if self.is_mac_bundle: | 720 if self.is_mac_bundle: |
| 715 self.output = self.ComputeMacBundleOutput(spec) | 721 self.output = self.ComputeMacBundleOutput(spec) |
| 716 self.output_binary = self.ComputeMacBundleBinaryOutput(spec) | 722 self.output_binary = self.ComputeMacBundleBinaryOutput(spec) |
| 717 else: | 723 else: |
| 718 self.output = self.output_binary = self.ComputeOutput(spec) | 724 self.output = self.output_binary = self.ComputeOutput(spec) |
| 719 | 725 |
| 726 self.is_standalone_static_library = bool( |
| 727 spec.get('standalone_static_library', 0)) |
| 720 self._INSTALLABLE_TARGETS = ('executable', 'loadable_module', | 728 self._INSTALLABLE_TARGETS = ('executable', 'loadable_module', |
| 721 'shared_library') | 729 'shared_library') |
| 722 if self.type in self._INSTALLABLE_TARGETS: | 730 if (self.is_standalone_static_library or |
| 731 self.type in self._INSTALLABLE_TARGETS): |
| 723 self.alias = os.path.basename(self.output) | 732 self.alias = os.path.basename(self.output) |
| 724 install_path = self._InstallableTargetInstallPath() | 733 install_path = self._InstallableTargetInstallPath() |
| 725 else: | 734 else: |
| 726 self.alias = self.output | 735 self.alias = self.output |
| 727 install_path = self.output | 736 install_path = self.output |
| 728 | 737 |
| 729 self.WriteLn("TOOLSET := " + self.toolset) | 738 self.WriteLn("TOOLSET := " + self.toolset) |
| 730 self.WriteLn("TARGET := " + self.target) | 739 self.WriteLn("TARGET := " + self.target) |
| 731 | 740 |
| 732 # Actions must come first, since they can generate more OBJs for use below. | 741 # Actions must come first, since they can generate more OBJs for use below. |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 self.WriteDoCmd([self.output_binary], link_deps, 'link_host', | 1534 self.WriteDoCmd([self.output_binary], link_deps, 'link_host', |
| 1526 part_of_all, postbuilds=postbuilds) | 1535 part_of_all, postbuilds=postbuilds) |
| 1527 else: | 1536 else: |
| 1528 self.WriteDoCmd([self.output_binary], link_deps, 'link', part_of_all, | 1537 self.WriteDoCmd([self.output_binary], link_deps, 'link', part_of_all, |
| 1529 postbuilds=postbuilds) | 1538 postbuilds=postbuilds) |
| 1530 | 1539 |
| 1531 elif self.type == 'static_library': | 1540 elif self.type == 'static_library': |
| 1532 for link_dep in link_deps: | 1541 for link_dep in link_deps: |
| 1533 assert ' ' not in link_dep, ( | 1542 assert ' ' not in link_dep, ( |
| 1534 "Spaces in alink input filenames not supported (%s)" % link_dep) | 1543 "Spaces in alink input filenames not supported (%s)" % link_dep) |
| 1535 self.WriteDoCmd([self.output_binary], link_deps, 'alink', part_of_all, | 1544 if (self.flavor not in ('mac', 'win') and not |
| 1536 postbuilds=postbuilds) | 1545 self.is_standalone_static_library): |
| 1546 self.WriteDoCmd([self.output_binary], link_deps, 'alink_thin', |
| 1547 part_of_all, postbuilds=postbuilds) |
| 1548 else: |
| 1549 self.WriteDoCmd([self.output_binary], link_deps, 'alink', part_of_all, |
| 1550 postbuilds=postbuilds) |
| 1537 elif self.type == 'shared_library': | 1551 elif self.type == 'shared_library': |
| 1538 self.WriteLn('%s: LD_INPUTS := %s' % ( | 1552 self.WriteLn('%s: LD_INPUTS := %s' % ( |
| 1539 QuoteSpaces(self.output_binary), | 1553 QuoteSpaces(self.output_binary), |
| 1540 ' '.join(map(QuoteSpaces, link_deps)))) | 1554 ' '.join(map(QuoteSpaces, link_deps)))) |
| 1541 self.WriteDoCmd([self.output_binary], link_deps, 'solink', part_of_all, | 1555 self.WriteDoCmd([self.output_binary], link_deps, 'solink', part_of_all, |
| 1542 postbuilds=postbuilds) | 1556 postbuilds=postbuilds) |
| 1543 elif self.type == 'loadable_module': | 1557 elif self.type == 'loadable_module': |
| 1544 for link_dep in link_deps: | 1558 for link_dep in link_deps: |
| 1545 assert ' ' not in link_dep, ( | 1559 assert ' ' not in link_dep, ( |
| 1546 "Spaces in module input filenames not supported (%s)" % link_dep) | 1560 "Spaces in module input filenames not supported (%s)" % link_dep) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1566 comment='Add target alias', phony = True) | 1580 comment='Add target alias', phony = True) |
| 1567 if part_of_all: | 1581 if part_of_all: |
| 1568 self.WriteMakeRule(['all'], [self.target], | 1582 self.WriteMakeRule(['all'], [self.target], |
| 1569 comment = 'Add target alias to "all" target.', | 1583 comment = 'Add target alias to "all" target.', |
| 1570 phony = True) | 1584 phony = True) |
| 1571 | 1585 |
| 1572 # Add special-case rules for our installable targets. | 1586 # Add special-case rules for our installable targets. |
| 1573 # 1) They need to install to the build dir or "product" dir. | 1587 # 1) They need to install to the build dir or "product" dir. |
| 1574 # 2) They get shortcuts for building (e.g. "make chrome"). | 1588 # 2) They get shortcuts for building (e.g. "make chrome"). |
| 1575 # 3) They are part of "make all". | 1589 # 3) They are part of "make all". |
| 1576 if self.type in self._INSTALLABLE_TARGETS: | 1590 if (self.type in self._INSTALLABLE_TARGETS or |
| 1591 self.is_standalone_static_library): |
| 1577 if self.type == 'shared_library': | 1592 if self.type == 'shared_library': |
| 1578 file_desc = 'shared library' | 1593 file_desc = 'shared library' |
| 1594 elif self.type == 'static_library': |
| 1595 file_desc = 'static library' |
| 1579 else: | 1596 else: |
| 1580 file_desc = 'executable' | 1597 file_desc = 'executable' |
| 1581 install_path = self._InstallableTargetInstallPath() | 1598 install_path = self._InstallableTargetInstallPath() |
| 1582 installable_deps = [self.output] | 1599 installable_deps = [self.output] |
| 1583 if (self.flavor == 'mac' and not 'product_dir' in spec and | 1600 if (self.flavor == 'mac' and not 'product_dir' in spec and |
| 1584 self.toolset == 'target'): | 1601 self.toolset == 'target'): |
| 1585 # On mac, products are created in install_path immediately. | 1602 # On mac, products are created in install_path immediately. |
| 1586 assert install_path == self.output, '%s != %s' % ( | 1603 assert install_path == self.output, '%s != %s' % ( |
| 1587 install_path, self.output) | 1604 install_path, self.output) |
| 1588 | 1605 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 root_makefile.write("endif\n") | 2144 root_makefile.write("endif\n") |
| 2128 root_makefile.write('\n') | 2145 root_makefile.write('\n') |
| 2129 | 2146 |
| 2130 if (not generator_flags.get('standalone') | 2147 if (not generator_flags.get('standalone') |
| 2131 and generator_flags.get('auto_regeneration', True)): | 2148 and generator_flags.get('auto_regeneration', True)): |
| 2132 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) | 2149 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) |
| 2133 | 2150 |
| 2134 root_makefile.write(SHARED_FOOTER) | 2151 root_makefile.write(SHARED_FOOTER) |
| 2135 | 2152 |
| 2136 root_makefile.close() | 2153 root_makefile.close() |
| OLD | NEW |