Fix build-run and build-debug functions

This commit is contained in:
Kenneth Benzie 2018-08-22 17:17:06 +01:00
parent 9b54ebc366
commit 087a315289

View File

@ -33,7 +33,7 @@ build-dir() {
python $_build_dir_py $file;
local error=$?
# If the file exists, read the build directory from it, then delete it.
[ -f $file ] && build_dir=$PWD/`cat $file`; rm $file
[ -f $file ] && local build_dir=$PWD/`cat $file`; rm $file
# If choosing a build directory failed, return that error.
[[ "$error" = "0" ]] || return $error
# If `build.ninja` exists in alias `ninja`, return.
@ -59,14 +59,14 @@ build-dir() {
[[ "$1" = "--build" ]] && eval $build || true
}
# Build then run a target residing in `$build_dir/bin`.
# Build then run a target residing in `~build/bin`.
build-run() {
local target=$1; shift 1
build $target && $build_dir/bin/$target $*
eval build $target && ~build/bin/$target $*
}
# Build then debug a target residing in `$build_dir/bin`.
# Build then debug a target residing in `~build/bin`.
build-debug() {
local target=$1; shift 1
build $target && debug $build_dir/bin/$target $*
eval build $target && debug ~build/bin/$target $*
}