7 Ninja is a small build system with a focus on speed.
8 https://ninja-build.org/
10 See [the manual](https://ninja-build.org/manual.html) or
11 `doc/manual.asciidoc` included in the distribution for background
14 Binaries for Linux, Mac and Windows are available on
15 [GitHub](https://github.com/ninja-build/ninja/releases).
16 Run `./ninja -h` for Ninja help.
18 Installation is not necessary because the only required file is the
19 resulting ninja binary. However, to enable features like Bash
20 completion and Emacs and Vim editing modes, some files in misc/ must be
21 copied to appropriate locations.
23 If you're interested in making changes to Ninja, read
24 [CONTRIBUTING.md](CONTRIBUTING.md) first.
26 ## Building Ninja itself
28 You can either build Ninja via the custom generator script written in Python or
29 via CMake. For more details see
30 [the wiki](https://github.com/ninja-build/ninja/wiki).
35 ./configure.py --bootstrap
38 This will generate the `ninja` binary and a `build.ninja` file you can now use
39 to build Ninja with itself.
41 If you have a GoogleTest source directory, you can build the tests
42 by passing its path with `--gtest-source-dir=PATH` option, or the
43 `GTEST_SOURCE_DIR` environment variable, e.g.:
46 ./configure.py --bootstrap --gtest-source-dir=/path/to/googletest
47 ./ninja all # build ninja_test and other auxiliary binaries
48 ./ninja_test` # run the unit-test suite.
51 Use the CMake build below if you want to use a preinstalled binary
52 version of the library.
56 To build the ninja binary without building the unit tests, disable test building by setting `BUILD_TESTING` to `OFF`:
59 cmake -Bbuild-cmake -DBUILD_TESTING=OFF
60 cmake --build build-cmake
63 The `ninja` binary will now be inside the `build-cmake` directory (you can
64 choose any other name you like).
66 To run the unit tests, omit the `-DBUILD_TESTING=OFF` option, and after building, run:
69 ./build-cmake/ninja_test
72 ## Generating documentation
76 You must have `asciidoc` and `xsltproc` in your PATH, then do:
80 ninja manual doc/manual.html
83 Which will generate `doc/manual.html`.
85 To generate the PDF version of the manual, you must have `dblatext` in your PATH then do:
88 ./configure.py # only if you didn't do it previously.
92 Which will generate `doc/manual.pdf`.
94 ### Doxygen documentation
96 If you have `doxygen` installed, you can build documentation extracted from C++
97 declarations and comments to help you navigate the code. Note that Ninja is a standalone
98 executable, not a library, so there is no public API, all details exposed here are
102 ./configure.py # if needed
106 Then open `doc/doxygen/html/index.html` in a browser to look at it.
112 Version 2.0, January 2010
113 http://www.apache.org/licenses/
115 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
119 "License" shall mean the terms and conditions for use, reproduction,
120 and distribution as defined by Sections 1 through 9 of this document.
122 "Licensor" shall mean the copyright owner or entity authorized by
123 the copyright owner that is granting the License.
125 "Legal Entity" shall mean the union of the acting entity and all
126 other entities that control, are controlled by, or are under common
127 control with that entity. For the purposes of this definition,
128 "control" means (i) the power, direct or indirect, to cause the
129 direction or management of such entity, whether by contract or
130 otherwise, or (ii) ownership of fifty percent (50%) or more of the
131 outstanding shares, or (iii) beneficial ownership of such entity.
133 "You" (or "Your") shall mean an individual or Legal Entity
134 exercising permissions granted by this License.
136 "Source" form shall mean the preferred form for making modifications,
137 including but not limited to software source code, documentation
138 source, and configuration files.
140 "Object" form shall mean any form resulting from mechanical
141 transformation or translation of a Source form, including but
142 not limited to compiled object code, generated documentation,
143 and conversions to other media types.
145 "Work" shall mean the work of authorship, whether in Source or
146 Object form, made available under the License, as indicated by a
147 copyright notice that is included in or attached to the work
148 (an example is provided in the Appendix below).
150 "Derivative Works" shall mean any work, whether in Source or Object
151 form, that is based on (or derived from) the Work and for which the
152 editorial revisions, annotations, elaborations, or other modifications
153 represent, as a whole, an original work of authorship. For the purposes
154 of this License, Derivative Works shall not include works that remain
155 separable from, or merely link (or bind by name) to the interfaces of,
156 the Work and Derivative Works thereof.
158 "Contribution" shall mean any work of authorship, including
159 the original version of the Work and any modifications or additions
160 to that Work or Derivative Works thereof, that is intentionally
161 submitted to Licensor for inclusion in the Work by the copyright owner
162 or by an individual or Legal Entity authorized to submit on behalf of
163 the copyright owner. For the purposes of this definition, "submitted"
164 means any form of electronic, verbal, or written communication sent
165 to the Licensor or its representatives, including but not limited to
166 communication on electronic mailing lists, source code control systems,
167 and issue tracking systems that are managed by, or on behalf of, the
168 Licensor for the purpose of discussing and improving the Work, but
169 excluding communication that is conspicuously marked or otherwise
170 designated in writing by the copyright owner as "Not a Contribution."
172 "Contributor" shall mean Licensor and any individual or Legal Entity
173 on behalf of whom a Contribution has been received by Licensor and
174 subsequently incorporated within the Work.
176 2. Grant of Copyright License. Subject to the terms and conditions of
177 this License, each Contributor hereby grants to You a perpetual,
178 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
179 copyright license to reproduce, prepare Derivative Works of,
180 publicly display, publicly perform, sublicense, and distribute the
181 Work and such Derivative Works in Source or Object form.
183 3. Grant of Patent License. Subject to the terms and conditions of
184 this License, each Contributor hereby grants to You a perpetual,
185 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
186 (except as stated in this section) patent license to make, have made,
187 use, offer to sell, sell, import, and otherwise transfer the Work,
188 where such license applies only to those patent claims licensable
189 by such Contributor that are necessarily infringed by their
190 Contribution(s) alone or by combination of their Contribution(s)
191 with the Work to which such Contribution(s) was submitted. If You
192 institute patent litigation against any entity (including a
193 cross-claim or counterclaim in a lawsuit) alleging that the Work
194 or a Contribution incorporated within the Work constitutes direct
195 or contributory patent infringement, then any patent licenses
196 granted to You under this License for that Work shall terminate
197 as of the date such litigation is filed.
199 4. Redistribution. You may reproduce and distribute copies of the
200 Work or Derivative Works thereof in any medium, with or without
201 modifications, and in Source or Object form, provided that You
202 meet the following conditions:
204 (a) You must give any other recipients of the Work or
205 Derivative Works a copy of this License; and
207 (b) You must cause any modified files to carry prominent notices
208 stating that You changed the files; and
210 (c) You must retain, in the Source form of any Derivative Works
211 that You distribute, all copyright, patent, trademark, and
212 attribution notices from the Source form of the Work,
213 excluding those notices that do not pertain to any part of
214 the Derivative Works; and
216 (d) If the Work includes a "NOTICE" text file as part of its
217 distribution, then any Derivative Works that You distribute must
218 include a readable copy of the attribution notices contained
219 within such NOTICE file, excluding those notices that do not
220 pertain to any part of the Derivative Works, in at least one
221 of the following places: within a NOTICE text file distributed
222 as part of the Derivative Works; within the Source form or
223 documentation, if provided along with the Derivative Works; or,
224 within a display generated by the Derivative Works, if and
225 wherever such third-party notices normally appear. The contents
226 of the NOTICE file are for informational purposes only and
227 do not modify the License. You may add Your own attribution
228 notices within Derivative Works that You distribute, alongside
229 or as an addendum to the NOTICE text from the Work, provided
230 that such additional attribution notices cannot be construed
231 as modifying the License.
233 You may add Your own copyright statement to Your modifications and
234 may provide additional or different license terms and conditions
235 for use, reproduction, or distribution of Your modifications, or
236 for any such Derivative Works as a whole, provided Your use,
237 reproduction, and distribution of the Work otherwise complies with
238 the conditions stated in this License.
240 5. Submission of Contributions. Unless You explicitly state otherwise,
241 any Contribution intentionally submitted for inclusion in the Work
242 by You to the Licensor shall be under the terms and conditions of
243 this License, without any additional terms or conditions.
244 Notwithstanding the above, nothing herein shall supersede or modify
245 the terms of any separate license agreement you may have executed
246 with Licensor regarding such Contributions.
248 6. Trademarks. This License does not grant permission to use the trade
249 names, trademarks, service marks, or product names of the Licensor,
250 except as required for reasonable and customary use in describing the
251 origin of the Work and reproducing the content of the NOTICE file.
253 7. Disclaimer of Warranty. Unless required by applicable law or
254 agreed to in writing, Licensor provides the Work (and each
255 Contributor provides its Contributions) on an "AS IS" BASIS,
256 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
257 implied, including, without limitation, any warranties or conditions
258 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
259 PARTICULAR PURPOSE. You are solely responsible for determining the
260 appropriateness of using or redistributing the Work and assume any
261 risks associated with Your exercise of permissions under this License.
263 8. Limitation of Liability. In no event and under no legal theory,
264 whether in tort (including negligence), contract, or otherwise,
265 unless required by applicable law (such as deliberate and grossly
266 negligent acts) or agreed to in writing, shall any Contributor be
267 liable to You for damages, including any direct, indirect, special,
268 incidental, or consequential damages of any character arising as a
269 result of this License or out of the use or inability to use the
270 Work (including but not limited to damages for loss of goodwill,
271 work stoppage, computer failure or malfunction, or any and all
272 other commercial damages or losses), even if such Contributor
273 has been advised of the possibility of such damages.
275 9. Accepting Warranty or Additional Liability. While redistributing
276 the Work or Derivative Works thereof, You may choose to offer,
277 and charge a fee for, acceptance of support, warranty, indemnity,
278 or other liability obligations and/or rights consistent with this
279 License. However, in accepting such obligations, You may act only
280 on Your own behalf and on Your sole responsibility, not on behalf
281 of any other Contributor, and only if You agree to indemnify,
282 defend, and hold each Contributor harmless for any liability
283 incurred by, or claims asserted against, such Contributor by reason
284 of your accepting any such warranty or additional liability.
286 END OF TERMS AND CONDITIONS
288 APPENDIX: How to apply the Apache License to your work.
290 To apply the Apache License to your work, attach the following
291 boilerplate notice, with the fields enclosed by brackets "[]"
292 replaced with your own identifying information. (Don't include
293 the brackets!) The text should be enclosed in the appropriate
294 comment syntax for the file format. We also recommend that a
295 file or class name and description of purpose be included on the
296 same "printed page" as the copyright notice for easier
297 identification within third-party archives.
299 Copyright [yyyy] [name of copyright owner]
301 Licensed under the Apache License, Version 2.0 (the "License");
302 you may not use this file except in compliance with the License.
303 You may obtain a copy of the License at
305 http://www.apache.org/licenses/LICENSE-2.0
307 Unless required by applicable law or agreed to in writing, software
308 distributed under the License is distributed on an "AS IS" BASIS,
309 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310 See the License for the specific language governing permissions and
311 limitations under the License.