Compare commits
1 Commits
d0d03198c9
...
fb2e4aea7c
Author | SHA1 | Date | |
---|---|---|---|
fb2e4aea7c |
@ -30,12 +30,11 @@ build-dir() {
|
|||||||
# Get a unique filename to store the chosen build directory in.
|
# Get a unique filename to store the chosen build directory in.
|
||||||
[ `uname` = Darwin ] && local file=`mktemp` || local file=`tempfile`
|
[ `uname` = Darwin ] && local file=`mktemp` || local file=`tempfile`
|
||||||
# Prompt user to choose a build directory.
|
# Prompt user to choose a build directory.
|
||||||
python $_build_dir_py $file;
|
python $_build_dir_py $file || local error=$?
|
||||||
local error=$?
|
|
||||||
# If the file exists, read the build directory from it, then delete it.
|
# If the file exists, read the build directory from it, then delete it.
|
||||||
[ -f $file ] && build_dir=$PWD/`cat $file`; rm $file
|
[ -f $file ] && build_dir=$PWD/`cat $file`; rm $file
|
||||||
# If choosing a build directory failed, return that error.
|
# If choosing a build directory failed, return that error.
|
||||||
[[ "$error" = "0" ]] || return $error
|
[ -v error ] && return $error
|
||||||
# If `build.ninja` exists in alias `ninja`, return.
|
# If `build.ninja` exists in alias `ninja`, return.
|
||||||
[ -f $build_dir/build.ninja ] && \
|
[ -f $build_dir/build.ninja ] && \
|
||||||
local build="ninja -C $build_dir"
|
local build="ninja -C $build_dir"
|
||||||
@ -47,8 +46,7 @@ build-dir() {
|
|||||||
local build="make -j $cpu_count -C $build_dir"
|
local build="make -j $cpu_count -C $build_dir"
|
||||||
fi
|
fi
|
||||||
# If the build variable is not defined the command could not be determined.
|
# If the build variable is not defined the command could not be determined.
|
||||||
echo "$build"
|
if ! [ -v build ]; then
|
||||||
if [ -z $build ]; then
|
|
||||||
# TODO: Prompt user to choose a build command?
|
# TODO: Prompt user to choose a build command?
|
||||||
echo "could not determine build command"
|
echo "could not determine build command"
|
||||||
return 1
|
return 1
|
||||||
@ -56,7 +54,7 @@ build-dir() {
|
|||||||
# Define the new alias.
|
# Define the new alias.
|
||||||
alias build="$build"
|
alias build="$build"
|
||||||
# If `--build` is specified then evaluate the command.
|
# If `--build` is specified then evaluate the command.
|
||||||
[[ "$1" = "--build" ]] && eval $build
|
[ -v optbuild ] && eval $build
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build then run a target residing in `$build_dir/bin`.
|
# Build then run a target residing in `$build_dir/bin`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user