7 script_dir = os.path.dirname(__file__)
8 node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
10 sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
13 # Directory within which we want all generated files (including Makefiles)
15 output_dir = os.path.join(os.path.abspath(node_root), 'out')
20 print 'Error running GYP'
23 if __name__ == '__main__':
27 # On msvs it will crash if it gets an absolute path.
28 # On Mac/make it will crash if it doesn't get an absolute path.
29 if sys.platform == 'win32':
30 args.append(os.path.join(node_root, 'node.gyp'))
31 common_fn = os.path.join(node_root, 'common.gypi')
32 options_fn = os.path.join(node_root, 'config.gypi')
34 args.append(os.path.join(os.path.abspath(node_root), 'node.gyp'))
35 common_fn = os.path.join(os.path.abspath(node_root), 'common.gypi')
36 options_fn = os.path.join(os.path.abspath(node_root), 'config.gypi')
38 if os.path.exists(common_fn):
39 args.extend(['-I', common_fn])
41 if os.path.exists(options_fn):
42 args.extend(['-I', options_fn])
44 args.append('--depth=' + node_root)
46 # There's a bug with windows which doesn't allow this feature.
47 if sys.platform != 'win32' and 'ninja' not in args:
48 # Tell gyp to write the Makefiles into output_dir
49 args.extend(['--generator-output', output_dir])
51 # Tell make to write its output into the same dir
52 args.extend(['-Goutput_dir=' + output_dir])
54 args.append('-Dcomponent=static_library')
55 args.append('-Dlibrary=static_library')