Re-land r1745: "Add an option to prune targets"

BUG=
R=mark@chromium.org

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

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