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