A build system for C and C++ in one C header. https://includebuild.com
  • C 74.7%
  • PowerShell 10%
  • Shell 9.7%
  • HTML 3.3%
  • CSS 1.8%
  • Other 0.5%
Find a file
2026-08-09 20:04:37 -07:00
.github/workflows Update CI checkout runtime 2026-08-09 11:36:34 -07:00
examples Cut promotional copy 2026-08-09 20:04:37 -07:00
scripts Simplify planning and fix library linking 2026-08-09 18:45:50 -07:00
tests/fixtures Simplify planning and fix library linking 2026-08-09 18:45:50 -07:00
www Cut promotional copy 2026-08-09 20:04:37 -07:00
.gitattributes Release IncludeBuild 3.0.0 2026-07-24 03:35:15 -07:00
.gitignore Simplify IncludeBuild API, repository, and site 2026-08-09 11:22:33 -07:00
build.h Cut promotional copy 2026-08-09 20:04:37 -07:00
LICENSE Fix safety, docs, and examples consistency 2026-06-02 00:13:06 -07:00
README.md Cut promotional copy 2026-08-09 20:04:37 -07:00

IncludeBuild

Put build.h next to build.c.

#define BUILD_IMPLEMENTATION
#include "build.h"

int main(int argc, char** argv) {
    build_init(argc, argv);
    executable("app", "**.c");
    return build();
}
cc -o build build.c
./build
./build release
./build run
./build clean
./build compdb
./build help

./build recompiles itself when build.c or build.h changes. It also checks compiler depfiles and the command used for each object. ./build -v prints the commands and rebuild reasons.

Targets

Target* executable(const char* name, const char* pattern);
Target* static_library(const char* name, const char* pattern);
Target* shared_library(const char* name, const char* pattern);

void sources(Target* target, const char* pattern);
void include_dir(Target* target, const char* path);
void compile_flags(Target* target, const char* flags);
void link_flags(Target* target, const char* flags);
void use(Target* target, Target* library);

* and ? match within a directory; ** crosses directories. Repeated patterns are sorted and deduplicated. A pattern that matches nothing is an error.

Configuration

Target* app = executable("app", "src/**.c");
config.cc = "clang";
config.compile_flags = "-Wall -Wextra";
config.debug_flags = "-g -O0 -DDEBUG";
config.release_flags = "-O3 -DNDEBUG";
config.output_dir = "bin";

if (config.release) {
    compile_flags(app, "-DFAST_PATH");
}

use(app, library) adds the library, its dependencies, and its include directories. Static libraries linked into shared libraries are compiled with -fPIC on Linux and macOS.

Requirements

C99. GCC, Clang, and MinGW are supported on Linux, macOS, and Windows. Compiler defaults can be changed with $CC, $CXX, and $AR.

Website · Development repository · CC0