shake
minimal build system that generates Ninja build files
git clone https://9o.is/git/shake.git
commit a834872d388cd578b39c3dd196b46121a3ca3708 parent 448f3f5533a81f3c82ff586bd8b3db9e6bcb2e4e Author: Jul <jul@9o.is> Date: Wed, 18 Mar 2026 14:53:23 +0800 flip the $dir/$outdir prefixing with phony builds Diffstat:
| M | shake | | | 36 | +++++++++++++++++------------------- |
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/shake b/shake @@ -210,13 +210,10 @@ _shake_prefix() { esac } -build() { - _brule=$1 - _pre=$outdir +_shake_build() { _mode=bout - printf 'build' >&3 - for _v in ${*:2}; do + for _v in $*; do case "$_v" in '-') case "$_mode" in @@ -233,14 +230,6 @@ build() { esac _mode=bord ;; - ':') - if [ "$_mode" != bout ]; then - error 'invalid rule' - fi - printf ': %s' $_brule >&3 - _mode=bin - _pre=$dir - ;; *:*) if [ "$_mode" != bout ]; then error 'invalid rule' @@ -251,7 +240,7 @@ build() { printf ': %s' $_brule >&3 _mode=bin - _pre=$dir + [ "$_pre" == $dir ] && _pre=$outdir || _pre=$dir if [ "${_v##*:}" ]; then _shake_prefix $_pre "${_v##*:}" @@ -263,6 +252,19 @@ build() { esac done printf '\n' >&3 + +} + +build() { + _brule=$1 + _pre=$outdir + _shake_build ${*:2} +} + +phony() { + _brule=phony + _pre=$dir + _shake_build $* } _shake_requires_arg() { @@ -347,10 +349,6 @@ default() { printf '\n' >&3 } -phony() { - build phony $* -} - groupin() { SHAKE_GROUPIN="${SHAKE_GROUPIN-} $1 $2" } @@ -442,7 +440,7 @@ bind restat 1 . $DIR/Shakefile -phony $dir/build.ninja: ninja +phony build.ninja: $dir/ninja bind generator 1 _shake_close