shake

minimal build system that generates Ninja build files

git clone https://9o.is/git/shake.git

commit b9a2c57e6a517ff2c95cecc70d5d51719de9197e
parent 75a4cfd10561d56ec756c5e8169fdad480a6673d
Author: Jul <jul@9o.is>
Date:   Mon, 16 Mar 2026 20:55:47 +0800

fix handling files with dashes

Diffstat:
Mshake | 41++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/shake b/shake @@ -207,25 +207,6 @@ _shake_prefix() { esac } -_shake_build() { - if [ "${2%%$1*}" ]; then - _shake_prefix $_pre "${2%%$1*}" - fi - - case "$1" in - -) printf ' |' >&3;; - --) printf ' ||' >&3;; - :) - printf ': %s' $_brule >&3 - _pre=$dir - ;; - esac - - if [ "${2##*$1}" ]; then - _shake_prefix $_pre "${2##*$1}" - fi -} - build() { _brule=$1 _pre=$outdir @@ -233,10 +214,24 @@ build() { printf 'build' >&3 for _v in ${*:2}; do case "$_v" in - *:*) _shake_build : "$_v";; - *-*) _shake_build - "$_v";; - *--*) _shake_build -- "$_v";; - *) _shake_prefix $_pre "$_v";; + '-') printf ' |' >&3;; + '--') printf ' ||' >&3;; + ':') printf ': %s' $_brule >&3; _pre=$dir;; + *:*) + if [ "${_v%%:*}" ]; then + _shake_prefix $_pre "${_v%%:*}" + fi + + printf ': %s' $_brule >&3 + _pre=$dir + + if [ "${_v##*:}" ]; then + _shake_prefix $_pre "${_v##*:}" + fi + ;; + *) + _shake_prefix $_pre "$_v" + ;; esac done printf '\n' >&3