tsoding/nob.h logo

tsoding/nob.h

Free

Header only library for writing build recipes in C.

FreeFree tier
Type
Open Source

About tsoding/nob.h

nob.h is a header-only library that embodies the 'NoBuild' philosophy: building C projects using only a C compiler, without requiring Make, CMake, or other build tools. By embedding a minimal build system in a single header (nob.h), developers simply copy the file into their project, compile a small bootstrap binary with a C compiler, and then use that binary to run builds, tests, and other tasks. The library is designed to be extremely portable across Linux, macOS, Windows, and FreeBSD, and it encourages using the same language for both development and build scripting, enabling code reuse. While tsoding actively uses it in many personal C projects and finds it effective, the project is experimental and likely unsuitable for large projects with complex dependency management.

Key Features

Header-only: single file (nob.h) can be copied directly into any project
Zero external dependencies: only requires a C compiler
Cross-platform: works on Linux, macOS, Windows, FreeBSD, and more
Bootstraps build system from C source, enabling code reuse between build and project
Encourages writing build scripts in C instead of shell or Make
Includes examples in the how_to/ folder

Pros & Cons

Pros
  • Extremely portable across various operating systems, reducing build environment issues
  • Uses the same language (C) for building and developing, enabling code reuse
  • Minimal dependencies – only a C compiler needed
  • Lightweight and easy to embed: just copy the header file
  • Flexible for task automation similar to shell scripts but with C's type safety
Cons
  • Requires comfort with C programming and implementing build logic manually
  • Experimental – not yet proven for all scales of projects
  • Unsuitable for projects with complex dependency management (e.g., heavy CMake usage)
  • Only practical for C/C++ projects, not other languages
  • Limited community and ecosystem compared to established build systems

Best For

Building C or C++ projects without traditional build toolsCross-platform projects that need minimal dependency build systemsSmall to medium-sized projects where simplicity and portability are prioritiesReplacing shell scripts and Makefiles with C-based build logic

FAQ

What does 'nob' stand for?
'nob' stands for 'nobuild' – it's a shorter prefix for the library, reflecting the idea that building should require only a C compiler.
Is this build system suitable for large projects?
The library is experimental and likely not suitable for large projects with many dependencies (e.g., those using CMake modules). It is more appropriate for small to medium-sized C/C++ projects.
How do I use nob.h in my project?
Copy the nob.h file into your project directory. Then write a simple C file (e.g., nob.c) that includes nob.h and implements your build recipes. Compile it with a C compiler to produce a build executable, which is used to build the rest of the project.
Does nob.h work on Windows?
Yes, nob.h works on Windows, as well as Linux, macOS, and FreeBSD, as long as a C compiler is available.