Lines Matching +full:- +full:- +full:build +full:- +full:root
9 # http://www.apache.org/licenses/LICENSE-2.0
17 """Script that generates the build.ninja for ninja itself.
20 or use a meta-build system that supports Ninja output."""
34 """Represents a host/target platform and its specific build attributes."""
120 Used to bootstrap Ninja from scratch. In --bootstrap mode this
121 class is used to execute all the commands to build an executable.
123 behave like non-bootstrap mode.
151 def build(self, outputs, rule, inputs=None, **kwargs): member in Bootstrap
158 # make the bootstrap build work.
168 return self.writer.build(outputs, rule, inputs, **kwargs)
174 """Expand $vars in an array of paths, e.g. from a 'build' block."""
199 parser.add_option('--bootstrap', action='store_true',
201 parser.add_option('--verbose', action='store_true',
202 help='enable verbose build')
203 parser.add_option('--platform',
207 parser.add_option('--host',
211 parser.add_option('--debug', action='store_true',
213 parser.add_option('--profile', metavar='TYPE',
216 parser.add_option('--with-gtest', metavar='PATH', help='ignored')
217 parser.add_option('--with-python', metavar='EXE',
220 parser.add_option('--force-pselect', action='store_true',
225 print('ERROR: extra unparsed command-line arguments:', args)
234 BUILD_FILENAME = 'build.ninja'
239 # Make the build directory.
241 os.mkdir('build')
249 n.comment('This file is used to build ninja itself.')
258 if '--bootstrap' in configure_args:
259 configure_args.remove('--bootstrap')
276 return os.path.join('$root', 'src', filename)
280 return os.path.join('$root', 'doc', filename)
282 return n.build(built(name + objext), 'cxx', src(name + '.c'), **kwargs)
284 return n.build(built(name + objext), 'cxx', src(name + '.cc'), **kwargs)
288 n.build(name, 'phony', exe)
292 root = sourcedir variable
293 if root == os.getcwd():
295 # tree, simplify all the paths to just be cwd-relative.
296 root = '.' variable
297 n.variable('root', root)
298 n.variable('builddir', 'build')
312 # Note that build settings are separately specified in CMakeLists.txt and
330 '/GR-', # Disable RTTI.
332 # Disable size_t -> int truncation warning.
345 cflags = ['-g', '-Wall', '-Wextra',
346 '-Wno-deprecated',
347 '-Wno-missing-field-initializers',
348 '-Wno-unused-parameter',
349 '-fno-rtti',
350 '-fno-exceptions',
351 '-std=c++11',
352 '-fvisibility=hidden', '-pipe',
353 '-DNINJA_PYTHON="%s"' % options.with_python]
355 cflags += ['-D_GLIBCXX_DEBUG', '-D_GLIBCXX_DEBUG_PEDANTIC']
356 cflags.remove('-fno-rtti') # Needed for above pedanticness.
358 cflags += ['-O2', '-DNDEBUG']
361 [CXX, '-fdiagnostics-color', '-c', '-x', 'c++', '/dev/null',
362 '-o', '/dev/null'],
365 cflags += ['-fdiagnostics-color']
369 cflags += ['-D_WIN32_WINNT=0x0601', '-D__USE_MINGW_ANSI_STDIO=1']
370 ldflags = ['-L$builddir']
372 cflags.append('-I/usr/local/include')
373 ldflags.append('-L/usr/local/lib')
376 cflags.append('-D__STDC_FORMAT_MACROS')
377 cflags.append('-D_LARGE_FILES')
383 cflags.remove('-fvisibility=hidden');
384 ldflags.append('-static')
386 cflags.remove('-fvisibility=hidden')
388 cflags.remove('-fvisibility=hidden')
393 cflags.append('-pg')
394 ldflags.append('-pg')
396 cflags.append('-fno-omit-frame-pointer')
397 libs.extend(['-Wl,--no-as-needed', '-lprofiler'])
400 cflags.append('-DUSE_PPOLL')
402 cflags.append('-DNINJA_HAVE_BROWSE')
404 # Search for generated headers relative to build dir.
405 cflags.append('-I.')
432 command='$cxx $cflags -c $in /Fo$out /Fd' + built('$pdb'),
438 command='$cxx -MMD -MT $out -MF $out.d $cflags -c $in -o $out',
454 command='rm -f $out && $ar crs $out $in',
464 command='$cxx $ldflags -o $out $in $libs',
475 n.build(built('browse_py.h'), 'inline', src('browse.py'),
486 proc = subprocess.Popen(['re2c', '-V'], stdout=subprocess.PIPE)
492 command='re2c -b -i --no-generation-date --no-version -o $out $in',
495 n.build(src('depfile_parser.cc'), 're2c', src('depfile_parser.in.cc'))
496 n.build(src('lexer.cc'), 're2c', src('lexer.in.cc'))
499 "changes to src/*.in.cc will not affect your build.")
506 n.comment('Generate a library for `ninja-re2c`.')
511 n.build(built('ninja-re2c.lib'), 'ar', re2c_objs)
513 n.build(built('libninja-re2c.a'), 'ar', re2c_objs)
516 n.comment('Core source files all build into ninja library.')
518 for name in ['build',
544 for name in ['subprocess-win32',
545 'includes_normalize-win32',
546 'msvc_helper-win32',
547 'msvc_helper_main-win32']:
550 objs += cxx('minidump-win32', variables=cxxvariables)
553 objs += cxx('subprocess-posix')
557 ninja_lib = n.build(built('ninja.lib'), 'ar', objs)
559 ninja_lib = n.build(built('libninja.a'), 'ar', objs)
565 libs.append('-lninja')
568 libs.append('-lperfstat')
574 ninja = n.build(binary('ninja'), 'link', objs, implicit=ninja_lib,
582 # build.ninja file.
587 if platform.is_aix() and '-maix64' not in ldflags:
589 # memory than will fit in the standard 32-bit AIX shared stack/heap (256M)
590 libs.append('-Wl,-bmaxdata:0x80000000')
601 all_targets += n.build(binary(name), 'link', objs,
608 command='./ninja -t graph all > $out')
610 command='dot -Tpng $in > $out')
611 dot = n.build(built('graph.dot'), 'gendot', ['ninja', 'build.ninja'])
612 n.build('graph.png', 'gengraph', dot)
617 command='asciidoc -b docbook -d book -o $out $in',
620 command='xsltproc --nonet doc/docbook.xsl $in > $out',
622 docbookxml = n.build(built('manual.xml'), 'asciidoc', doc('manual.asciidoc'))
623 manual = n.build(doc('manual.html'), 'xsltproc', docbookxml,
625 n.build('manual', 'phony',
630 command='dblatex -q -o $out -p doc/dblatex.xsl $in',
632 n.build(doc('manual.pdf'), 'dblatex', docbookxml,
644 mainpage = n.build(built('doxygen_mainpage'), 'doxygen_mainpage',
647 n.build('doxygen', 'doxygen', doc('doxygen.config'),
652 n.comment('Regenerate build files if build script changes.')
654 command='${configure_env}%s $root/configure.py $configure_args' %
657 n.build('build.ninja', 'configure',
658 implicit=['$root/configure.py',
659 os.path.normpath('$root/misc/ninja_syntax.py')])
670 n.build('rpm', 'rpmbuild')
673 n.build('all', 'phony', all_targets)
700 rebuild_args.append('-v')