ninja/mac: Don't write emtpy postbuild variable for non-bundle links.

Refactor the "only write a postbuild if needed" bit into a new function.

No functionality change, except for minusculely smaller generated ninja files.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/21939002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1687 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Reduce scope of a variable.

"variables" is only used on mac and linux in this block, so don't declare it
for other platforms.

No functionality change.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/21938003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1688 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Give WriteSources() and WriteLink() an explicit ninja_file parameter.

For fat binary support on mac, compile and link lines will need different
flags for every arch (i386, x86_64, etc). The only way ninja currently supports
variable scoping is through subninja files, so compile and link commands for
multi-arch compiles will need to go into subninja files. Prepare WriteSources()
and WriteLink() for this.

No functionality change in this CL.

BUG=chromium:90185
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/21930004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1689 78cadc50-ecff-11dd-a971-7dbc132099af
ninja: Let WriteLink() return the linked binary.

This way, all branches in WriteTarget() write self.target.binary, which is a
bit more regular.

(Also, two minor formatting changes.)

No functionality change.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/21664004

git-svn-id: http://gyp.googlecode.com/svn/trunk@1690 78cadc50-ecff-11dd-a971-7dbc132099af