free counter

samurai: Ninja-compatible build tool written in C statusGitHub build status

samurai is really a ninja-compatible build tool written in C99 with a focus onsimplicity, speed, and portability.


samurai implements the ninja build language through version 1.9.0 exceptfor MSVC dependency handling (deps = msvc). It uses exactly the same formatfor .ninja_log and .ninja_deps as ninja, currently version 5 and 4respectively.

It really is feature-complete and supports the majority of the same options as ninja.


samurai requires various POSIX.1-2008 interfaces.

Scheduling jobs predicated on load average requires through the non-standard, butwidely available getloadavg function. This feature could be disabled bydefining the NO_GETLOADAVG macro when calling the C compiler.

Differences from ninja

samurai tries to complement ninja behavior whenever you can, but thereare several cases where it really is slightly different:

  • samurai uses the variable lookup order documented in the ninja manual,while ninja includes a quirk (ninja-build/ninja#1516) that when the buildedge does not have any variable bindings, the variable is looked up in file scopebefore the rule-level variables.
  • samurai schedules jobs utilizing a stack, therefore the last scheduled job isthe first to execute, while ninja schedules jobs in line with the pointervalue of the edge structure (they’re stored in a std::set),therefore the first to execute depends upon the address returned by malloc.This might bring about build failures because of insufficiently specifieddependencies in the project’s build system.
  • samurai will not post-process the work output at all, so if itincludes escape sequences they’ll be preserved, while ninja stripsescape sequences if standard output isn’t a terminal. Some buildsystems, like meson, force color output from gcc automagically using-fdiagnostics-color=always, if you intend to save the output to alog, you need to pass -Db_colorout=auto to meson.
  • samurai follows the POSIX Utility Syntax Guidelines, in particularguideline 9, so that it requires that any command-line options precedethe operands. It generally does not do GNU-style argument permutation.

Read More

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker