Fix path to build/gen.py.

It was previously hardcoded to be ../build/gen.py, which fails if, for
example, you write build/gen.py --out-path=/tmp/gn

Change-Id: I8d0b459a8ce48c6c18ed09d94d5d90b56a6a6964
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/25160
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Commit-Queue: Matt Stark <msta@google.com>
diff --git a/build/gen.py b/build/gen.py
index 569f710..94fdcb8 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -297,6 +297,8 @@
   if args:
     args = " " + args
 
+  rel_self = os.path.relpath(os.path.join(SCRIPT_DIR, 'gen.py'), build_dir)
+
   ninja_header_lines = [
     'cxx = ' + cxx,
     'ar = ' + ar,
@@ -305,7 +307,7 @@
     '  depth = 1',
     '',
     'rule regen',
-    '  command = %s ../build/gen.py%s' % (sys.executable, args),
+    '  command = %s %s%s' % (sys.executable, rel_self, args),
     '  description = Regenerating ninja files',
     '',
     'build build.ninja: regen',