Index: pylib/gyp/generator/ninja.py |
=================================================================== |
--- pylib/gyp/generator/ninja.py (revision 1801) |
+++ pylib/gyp/generator/ninja.py (working copy) |
@@ -1581,18 +1581,24 @@ |
def _AddWinLinkRules(master_ninja, embed_manifest, link_incremental): |
"""Adds link rules for Windows platform to |master_ninja|.""" |
def FullLinkCommand(ldcmd, out, binary_type): |
- cmd = ('cmd /c %(ldcmd)s' |
- ' && %(python)s gyp-win-tool manifest-wrapper $arch' |
- ' cmd /c if exist %(out)s.manifest del %(out)s.manifest' |
- ' && %(python)s gyp-win-tool manifest-wrapper $arch' |
- ' $mt -nologo -manifest $manifests') |
+ """Returns a one-liner written for cmd.exe to handle multiphase linker |
+ operations including manifest file generation. The command will be |
+ structured as follows: |
+ cmd /c (linkcmd1 a b) && (linkcmd2 x y) && ... && |
+ if not "$manifests"=="" ((manifestcmd1 a b) && (manifestcmd2 x y) && ... ) |
+ Note that $manifests becomes empty when no manifest file is generated.""" |
+ link_commands = ['%(ldcmd)s', |
+ 'if exist %(out)s.manifest del %(out)s.manifest'] |
+ mt_cmd = ('%(python)s gyp-win-tool manifest-wrapper' |
+ ' $arch $mt -nologo -manifest $manifests') |
if embed_manifest and not link_incremental: |
# Embed manifest into a binary. If incremental linking is enabled, |
# embedding is postponed to the re-linking stage (see below). |
- cmd += ' -outputresource:%(out)s;%(resname)s' |
+ mt_cmd += ' -outputresource:%(out)s;%(resname)s' |
else: |
# Save manifest as an external file. |
- cmd += ' -out:%(out)s.manifest' |
+ mt_cmd += ' -out:%(out)s.manifest' |
+ manifest_commands = [mt_cmd] |
if link_incremental: |
# There is no point in generating separate rule for the case when |
# incremental linking is enabled, but manifest embedding is disabled. |
@@ -1600,11 +1606,14 @@ |
# See also implementation of _GetWinLinkRuleNameSuffix(). |
assert embed_manifest |
# Make .rc file out of manifest, compile it to .res file and re-link. |
- cmd += (' && %(python)s gyp-win-tool manifest-to-rc $arch' |
- ' %(out)s.manifest %(out)s.manifest.rc %(resname)s' |
- ' && %(python)s gyp-win-tool rc-wrapper $arch $rc' |
- ' %(out)s.manifest.rc' |
- ' && %(ldcmd)s %(out)s.manifest.res') |
+ manifest_commands += [ |
+ ('%(python)s gyp-win-tool manifest-to-rc $arch %(out)s.manifest' |
+ ' %(out)s.manifest.rc %(resname)s'), |
+ '%(python)s gyp-win-tool rc-wrapper $arch $rc %(out)s.manifest.rc', |
+ '%(ldcmd)s %(out)s.manifest.res'] |
+ cmd = 'cmd /c %s && if not "$manifests"=="" (%s)' % ( |
+ ' && '.join(['(%s)' % c for c in link_commands]), |
+ ' && '.join(['(%s)' % c for c in manifest_commands])) |
resource_name = { |
'exe': '1', |
'dll': '2', |