Build Systems, But In C
IncludeBuild is a single-header build framework for C and C++ projects. Your build logic lives in
build.c, uses normal C control flow, and drives an explicit project and target graph.
The Gist
#define INCLUDEBUILD_IMPLEMENTATION
#include "build.h"
int main(void) {
ib_context* ctx = ib_context_create();
ib_project* project = ib_project_create(ctx, ".");
ib_target* target = ib_project_add_target(project, "app", IB_TARGET_EXECUTABLE);
ib_status status = IB_OK;
if (target) {
status = ib_target_set_entry(target, "main.c");
}
if (status == IB_OK) {
status = ib_project_build(project, IB_MODE_DEBUG);
}
ib_project_destroy(project);
ib_context_destroy(ctx);
return status == IB_OK ? 0 : 1;
}
Compile and run it:
$ cc -o build build.c
$ ./build
What You Get
- Single-header distribution with no runtime dependencies.
- Explicit project, target, and build-mode APIs.
- Incremental rebuilds backed by depfiles and command manifests.
- Per-target compile and link flags.
- Generated
compile_commands.jsonfrom the same planned compile actions used to build. - Support for executables, static libraries, and shared libraries.
Platform Support
IncludeBuild targets GCC/Clang-style toolchains on Linux, macOS, and Windows. The default compilers are
cc/c++ on Unix-like platforms and gcc/g++ on
Windows, and you can override them per project.
Get Started
Download build.h
Copy it into your project and write
build.c like any other small C program.