Google man open sources Chrome build system
'We call it Ninja. It strikes quickly'
Google Chrome developer Evan Martin has open sourced the custom-designed build system he uses to build the browser's Linux port.
Martin calls the system Ninja because it "strikes quickly." According to Martin's Ninja manual, he previously used a customized system based on the old GNU Make build-automation system, and while this needed 10 seconds to start building the open source Chromium browser after a file change was made, Ninja takes under a second.
When Google first decided to port Chrome beyond Windows, Martin says on his blog, the company considered using the Scons software-construction tool, but it was soon deemed to be too slow. According to Martin, Scons needed about 40 seconds before it started building.
Chrome is a single executable with about 30,000 source files.
Dropping Scons, Google began using plain old Makefiles to port the browser. And Martin was soon haunted by build times. "I [became] more and more obsessed with build performance," he says. "I once clocked our Windows build taking eight minutes to finish linking after a one-file change and I found it devastating for both my productivity and my morale."
Martin tweaked the system until he had worked incremental builds down to between 10 and 20 seconds. But this wasn't enough. "I still wasn't happy about the ten seconds of waiting between running 'make' and the first compilation step starting. It seemed to me that with a warm disk cache, it shouldn't need to think that hard," Martin says.
Eventually, Martin designed his own build system from scratch, trying to make it as fast as possible. "I thought I'd try making a very simple build system; conceptually very similar to Make, but with hardly any features," he says. And once this was up and running, he added in several tools missing from Make. And this became Ninja.
Update: This story has been updated to show that Ninja is Martin's personal project and that it is only used for the Chrome Linux port.
Sponsored: Customer Identity and Access Management