Properly substitute variables that reference paths outside SRCDIR.

Apply the same kind of trick added in r58 and use a define's base name if it
refers to a location outside SRCDIR; so far, GritNode::AssignFirstIds() would
parse a file name differently than _ReadFirstIdsFromFile() even though they
refer to the same entry.

TEST=in Chromium, make BUILDTYPE=Release builddir_name=/outside/srcdir/out tracing_resources
R=joi@chromium.org

Landing for original author raphael.kubo.da.costa@intel.com,
https://codereview.chromium.org/69463002/

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

git-svn-id: http://grit-i18n.googlecode.com/svn/trunk@138 7262f16d-afe8-6277-6482-052fa10e57b1