import subprocess
import sys
-sourcedir = os.path.dirname(os.path.realpath(__file__))
-sys.path.insert(0, os.path.join(sourcedir, 'misc'))
+sys.path.insert(0, 'misc')
import ninja_syntax
objext = '.obj'
def src(filename):
- return os.path.join('$sourcedir', 'src', filename)
+ return os.path.join('src', filename)
def built(filename):
return os.path.join('$builddir', filename)
def doc(filename):
- return os.path.join('$sourcedir', 'doc', filename)
+ return os.path.join('doc', filename)
def cc(name, **kwargs):
return n.build(built(name + objext), 'cxx', src(name + '.c'), **kwargs)
def cxx(name, **kwargs):
return exe
return name
-n.variable('sourcedir', sourcedir)
n.variable('builddir', 'build')
n.variable('cxx', CXX)
if platform.is_msvc():
if platform.supports_ninja_browse():
cflags.append('-DNINJA_HAVE_BROWSE')
-# Search for generated headers relative to build dir.
-cflags.append('-I.')
-
def shell_escape(str):
"""Escape str such that it's interpreted as a single argument by
the shell."""
if platform.supports_ninja_browse():
n.comment('browse_py.h is used to inline browse.py.')
n.rule('inline',
- command=src('inline.sh') + ' $varname < $in > $out',
+ command='src/inline.sh $varname < $in > $out',
description='INLINE $out')
n.build(built('browse_py.h'), 'inline', src('browse.py'),
- implicit=src('inline.sh'),
+ implicit='src/inline.sh',
variables=[('varname', 'kBrowsePy')])
n.newline()
if not host.is_mingw():
n.comment('Regenerate build files if build script changes.')
n.rule('configure',
- command='${configure_env}%s $sourcedir/configure.py $configure_args' %
+ command='${configure_env}%s configure.py $configure_args' %
options.with_python,
generator=True)
n.build('build.ninja', 'configure',
- implicit=['$sourcedir/configure.py',
- os.path.normpath('$sourcedir/misc/ninja_syntax.py')])
+ implicit=['configure.py', os.path.normpath('misc/ninja_syntax.py')])
n.newline()
n.default(ninja)