tcbuilder - Bash-based Build System

raw JSON →
1.0.4 verified Sat Apr 25 auth: no javascript

tcbuilder (also known as 'bb') is a Bash-based build system that generates automated Makefiles from user-defined bash variables. The current version is 1.0.4, released with an irregular cadence. It is designed for projects that already use Bash and Make, offering a lightweight alternative to full-featured build systems. Key differentiators include its simple variable-based configuration, no external dependencies beyond Bash and Make, and the ability to handle multi-group builds with per-source flags. It requires Node.js >= 20 for the npm package but the core build generator is purely bash scripts.

error make: *** No targets specified and no makefile found. Stop.
cause Forgot to generate the Makefile from the build variables file.
fix
Run the build variables file (e.g., ./build.vars.sh > Makefile) before executing make.
error line 1: ./bb/bb: No such file or directory
cause Shebang points to a non-existent bb binary (submodule not installed or wrong path).
fix
Install bb as a git submodule into the ./bb/ directory or adjust the shebang to /usr/bin/bb if globally installed.
error make: warning: overriding commands for target `all'
cause Multiple groups with the same target name or conflicting rules in the generated Makefile.
fix
Ensure group names are unique and do not use 'all' or 'default'.
gotcha The 'groups' variable cannot contain 'all' or 'default' as values.
fix Use unique group names like 'app', 'lib', etc.
gotcha The build directory must never be empty; always specify a build path.
fix Set ..._build_dir to a non-empty path.
gotcha Shebang line must point to the correct bb binary location (./bb/bb for submodule, /usr/bin/bb for system install).
fix Adjust the first line according to your installation method.
deprecated The 'default_final_executable' may be overridden by group-specific variables; behavior might change in future versions.
fix Use group-specific '..._final_executable' to avoid ambiguity.
npm install tcbuilder
yarn add tcbuilder
pnpm add tcbuilder

Demonstrates creating a build variables file with shebang, defining groups and sources, generating a Makefile, and running make.

# Install tcbuilder globally or use npx
npm install -g tcbuilder

# Create a build variables file (e.g., build.vars.sh)
#! /usr/bin/bb
# Enable silent output
all_silent="true"
# Define groups
groups="app"
app_description="Build the application"
app_build_dir="build"
app_sources="src/main.c src/utils.c"
# Final executable
app_final_executable="myapp"

# Make the file executable and run it to generate Makefile
chmod +x build.vars.sh
./build.vars.sh > Makefile

# Build the project using make
make