build is like Makefile for single files
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


build is like Makefile for single files.

Instead of having to write a separate Makefile, build reads the build instructions from comments in the file itself. Therefore, you can distribute a file (or gist) by itself without a build script or Makefile.


Add this line to a markdown file:

<!-- @build pandoc -N --toc -o %pdf %md -->

or this line to a mscgen file:

# @build mscgen -T png -o images/%png %msc

And then run build or build *.md to build multiple files at once.


A comment in the file should contain @build command. The command can expand %ext to filename.ext automatically.

Note that:

  • if the file does not contain a command, build attempts to load a default command for the file extension from ~/.config/build.defaults
  • build succeeds and exits after the run command is found

build types

You can define multiple build types with the following syntax (within files):

@build-{type} command

Then, invoke build with

build -{type} [files]


build is written in a single Lua file. To install:

  1. copy build.lua where you want;
  2. create a shell alias so that build invokes lua /path/to/build.lua.

For instance, for:

  • bash, run: alias build=lua /path/to/build.lua
  • fish, run:
function build
  lua /path/to/build.lua $argv
funcsave build


build is written by Henri Binsztok and licensed under the MIT license.