shake
minimal build system that generates Ninja build files
git clone https://9o.is/git/shake.git
commit abf6473eed93f6f533a5e2b7d9a5eda5cf5a30be parent b9a2c57e6a517ff2c95cecc70d5d51719de9197e Author: Jul <jul@9o.is> Date: Mon, 16 Mar 2026 21:26:44 +0800 auto add dependencies in rules to build Diffstat:
| M | shake | | | 31 | +++++++++++++++++++++++++++---- |
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/shake b/shake @@ -210,13 +210,28 @@ _shake_prefix() { build() { _brule=$1 _pre=$outdir + _mode=bout printf 'build' >&3 for _v in ${*:2}; do case "$_v" in - '-') printf ' |' >&3;; - '--') printf ' ||' >&3;; - ':') printf ': %s' $_brule >&3; _pre=$dir;; + '-') + if [ "$_mode" != bdep ]; then + printf ' |' >&3 + fi + _mode=bdep + ;; + '--') + if [ "$_mode" != bord ]; then + printf ' ||' >&3 + fi + _mode=bord + ;; + ':') + printf ': %s' $_brule >&3 + _mode=bin + _pre=$dir + ;; *:*) if [ "${_v%%:*}" ]; then _shake_prefix $_pre "${_v%%:*}" @@ -240,7 +255,15 @@ build() { rule() { printf 'rule %s\n' "$1" >&3 bind command "${*:2}" - eval "$1() { build $1 \$*; }" + + _d= + for _v in ${*:2}; do + case "$_v" in + \$*dir/*|/*|./|../) _d="${_d:-'-'} $_v";; + esac + done + + eval "$1() { build $1 \$* $_d; }" } default() {