#include "build.h"
A build system in one C header v3.0.0
IncludeBuild is a single-header build system for C and C++. Build scripts are C programs. It supports parallel compilation, incremental rebuilds, executable and library targets, and a built-in command line.
Basic Usage
#define IB_IMPLEMENTATION
#include "build.h"int main(int argc, char** argv) {
ib_init(argc, argv);
ib_sources(ib_executable("app"), "**.c");
return ib_build();
}
$ cc -o build build.c # bootstrap
$ ./build # debug build
$ ./build release # release build
$ ./build run # build and run
$ ./build clean
$ ./build compdb # create compile_commands.json
$ ./build helpChanges to `build.c` or `build.h` cause `./build` to recompile itself. Header and flag changes rebuild affected targets. Use `./build -v` to see why each command ran.
Features
- Parallel compilation with `-jN`; the default is your CPU count.
- Incremental rebuilds using compiler depfiles and stored command lines.
- Executable, static library, and shared library targets.
- Transitive library ordering, include propagation, and automatic `-fPIC`. Source globs with ``, `?`, and `**`.
- Configuration through the `ib` struct.
- Self-rebuilding build scripts and automatic `compile_commands.json` updates.
Platform Support
GCC-compatible toolchains (gcc, clang, MinGW) on Linux, macOS, and Windows. Defaults honor `$CC`, `$CXX`, and `$AR`.
Get Started
Download build.h
`curl -O https://includebuild.com/build.h`
Copy `build.h` into your project, write `build.c`, and compile it once.