shake
minimal build system that generates Ninja build files
git clone https://9o.is/git/shake.git
commit 6f7052b93ba3f1ad248c212add06d9861f2d0b24 parent f19972f48ea4f15efcf75f6b7d1c0e3efad1908c Author: Jul <jul@9o.is> Date: Sun, 15 Mar 2026 15:47:47 +0800 do not auto target when running in subdirectory Diffstat:
| M | shake | | | 20 | ++++++++++---------- |
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/shake b/shake @@ -241,7 +241,9 @@ while [ ! -d "$ROOTDIR/$BUILDDIR" ]; do done if [ "$ROOTDIR" != "$PWD" ]; then - TARGET="${PWD#$ROOTDIR}/$TARGET" + if [ "$TARGET" ]; then + TARGET="${PWD#$ROOTDIR}/$TARGET" + fi cd "$ROOTDIR" 2>/dev/null || { printf "shake: cannot change to root directory: %s\n" "$ROOTDIR" >&2 exit 1 @@ -254,16 +256,14 @@ if [ ! -f Shakefile ]; then exit 1 fi -case "$TARGET" in -'') ;; -.|./) TARGET=.;; -*) - TARGET=${TARGET%/} - TARGET=${TARGET#/} - TARGET=./${TARGET#./} +if [ "$TARGET" ]; then + TARGET="$(cd "${TARGET#/}" && pwd)" + case "$TARGET" in + $PWD) TARGET=.;; + $PWD/*) TARGET="./${TARGET#$PWD/}";; + esac set_target_route $TARGET - ;; -esac +fi mkdir -p $BUILDDIR