Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Last active November 26, 2025 05:44
Show Gist options
  • Select an option

  • Save lidgnulinux/16bdfe6abeca764fc8f432b317d5a54e to your computer and use it in GitHub Desktop.

Select an option

Save lidgnulinux/16bdfe6abeca764fc8f432b317d5a54e to your computer and use it in GitHub Desktop.
Simple and clear build.ninja example.
# build.ninja
pkgname = dwl
version = v0.8-dev
rev = 0
cat = wayland
srcdir = dwl
format = ${pkgname}_${version}_${rev}@${cat}
rule edit
command = vim $srcdir/config.def.h
description = Edit default config.
pool = console
rule dwl
command = make -C $srcdir
description = Build the dwl executable.
rule package
command = make -C $srcdir DESTDIR="../package-$pkgname" install
description = Install the dwl package to package directory.
pool = console
rule archive
command = tar -C package-$pkgname -czvf ${format}.tar.gz .
description = Build the archive for $pkgname package.
rule clean
command = make -C $srcdir clean
description = Clean the dwl build.
build edit: edit
build dwl: dwl
build clean: clean
build package: package
build archive: archive
rule coba
command = echo "coba" $
&& touch coba $
&& echo "coba" > coba
description = coba
build coba: coba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment